Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<tr id="<%= dom_id(account) %>">
<td>
<%= account.name %>
</td>
<td>
<%= account.plan_name %>
</td>
<td>
<%= account.projects.size %>
</td>
<td>
<%= number_with_delimiter convert_duration(account.current_month_video_duration_total, from: :seconds, to: :minutes).round %> minutes
</td>
<td>
<%= number_with_delimiter convert_duration(account.video_duration_total, from: :seconds, to: :minutes).round %> minutes
</td>
<td>
<%= number_to_human_size account.storage_total %>
</td>
<td>
<%= time_ago_in_words(account.created_at) %> ago
</td>
<td>
<div class="btn-group">
<%= button_tag "Manage", class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
<div class="dropdown-menu dropdown-menu-right">
<%= link_to fa_icon("arrow-right", text: "Overview"), admin_account_path(account), class: "dropdown-item" %>
<%= link_to fa_icon("pencil", text: "Edit"), edit_admin_account_path(account), class: "dropdown-item" %>
<%= link_to fa_icon("arrow-right", text: "Account Managers"), account_auths_path({ account_id: account.id}), class: "dropdown-item" %>
</div>
</div>
</td>
</tr>

View File

@@ -0,0 +1,14 @@
<%= errors_summary_for account %>
<%= bootstrap_form_with model: [:admin, account], local: true do |form| %>
<%= field_set_tag content_tag(:span, "Account Details", class: "h6 text-muted text-uppercase") do %>
<%= form.text_field :name %>
<%= form.select :plan_uid, options_for_account_plan_select, { label: "Plan" }, class: "form-control custom-select" %>
<% end %>
<div class="row align-items-center text-center mt-4">
<%= link_to t("shared.cancel"), [:admin, :accounts], class: "col-3 text-reset" %>
<div class="col-9">
<%= form.button class: class_string("btn btn-block", ["btn-success", "btn-primary"] => account.new_record?), data: { disable_with: t("shared.disable_with") } %>
</div>
</div>
<% end %>

View File

@@ -0,0 +1,16 @@
<tr>
<td><%= user.email %></td>
<td><%= user.account_auths.map(&:role).join(',') %></td>
<td class="text-right">
<% if user != Current.user %>
<div class="btn-group">
<%= button_tag "Manage", class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
<div class="dropdown-menu dropdown-menu-right">
<%= link_to fa_icon("user-secret", text: "Masquerade"), [:admin, user, :masquerade], method: :post, class: "dropdown-item" %>
<%= link_to fa_icon("pencil", text: "Edit"), [:edit, :admin, user], class: "dropdown-item" %>
<%= link_to fa_icon("trash", text: "Delete"), [:admin, user], class: "dropdown-item", remote: true, method: :delete, data: { confirm: "Are you sure?" } %>
</div>
</div>
<% end %>
</td>
</tr>

View File

@@ -0,0 +1,13 @@
<tr>
<td><%= video.project.name %></td>
<td><%= video.name %></td>
<td class="text-right">
<div class="btn-group">
<%= button_tag "Manage", class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
<div class="dropdown-menu dropdown-menu-right">
<%= link_to fa_icon("sticky-note fw", text: "Analysis"), [video, :video_analyses, locale: I18n.locale], class: "dropdown-item" %>
<%= link_to fa_icon("tags fw", text: "Re-analyze"), [video, :video_analyses, locale: I18n.locale], method: "post", class: "dropdown-item" %>
</div>
</div>
</td>
</tr>

View File

@@ -0,0 +1,6 @@
<div class="card shadow-sm">
<%= card_header text: "Edit Account", close_action_path: [:admin, :accounts] %>
<div class="card-body">
<%= render "form", account: @account %>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<div class="d-flex flex-row-reverse justify-content-between align-items-right mb-3">
<%= bootstrap_form_with url: admin_accounts_path, method: :get, remote: true, layout: :inline, id: "search" do |form| %>
<%= form.search_field :query, hide_label: true, placeholder: t(".actions.search"), class: "rounded-pill-right", value: params[:query], prepend: form.button(fa_icon("search"), id: "search-button", class: "btn btn-light border rounded-pill-left") %>
<% end%>
<% if policy(Account).new? %>
<%= link_to fa_icon("plus", text: "New Account"), [:new, :admin, :account], class: "btn btn-primary mb-3" %>
<% end %>
</div>
<div class="border bg-white rounded shadow-sm pb-3 table-responsive">
<table class="table table-striped tr-px-4 align-all-middle">
<thead class="thead-light">
<tr>
<th>Name</th>
<th>Plan</th>
<th># Projects</th>
<th>Monthly Video Upload Minutes</th>
<th>Total Video Upload Minutes</th>
<th>Total Storage</th>
<th>Created At</th>
<th></th>
</tr>
</thead>
<tbody id="accounts">
<% if @accounts.any? %>
<%= render @accounts %>
<% else %>
<tr>
<td colspan="6" class="py-4 text-center text-muted"><%= t(".empty") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div id="accounts_pagination" class="mt-3">
<%= will_paginate @accounts %>
</div>

View File

@@ -0,0 +1,3 @@
$("#accounts").html("<%= j render @accounts %>");
$("form input[type='search']").val("<%= params[:query] %>");
$("#accounts_pagination").html("<%= j will_paginate @accounts %>");

View File

@@ -0,0 +1,6 @@
<div class="card shadow-sm">
<%= card_header text: "New Account", close_action_path: [:admin, :accounts] %>
<div class="card-body">
<%= render "form", account: @account %>
</div>
</div>

View File

@@ -0,0 +1,38 @@
<div class="card shadow-sm">
<%= card_header text: @account.name, close_action_path: [:admin, :accounts] %>
<div class="card-body">
<%= card_field_set_tag "Account Details" do %>
<dl class="row">
<dt class="col-sm-2">Plan</dt>
<dd class="col-sm-10"><%= @account.plan_name %></dd>
<dt class="col-sm-2">Users</dt>
<dd class="col-sm-10"><%= @account.users.size %></dd>
<dt class="col-sm-2">Created at</dt>
<dd class="col-sm-10"><%= time_ago_in_words(@account.created_at) %> ago</dd>
</dl>
<% end %>
<%= card_field_set_tag "Videos" do %>
<%= bootstrap_form_with url: [:admin, @account], method: :get, remote: true, layout: :inline, id: "search" do |form| %>
<%= form.search_field :query, hide_label: true, placeholder: t("shared.search"), class: "rounded-pill-right", value: params[:query], prepend: form.button(fa_icon("search"), id: "search-button", class: "btn btn-light border rounded-pill-left") %>
<% end%>
<div class="table-responsive-sm">
<table class="table table-striped tr-px-4 align-all-middle">
<thead class="thead-light">
<tr>
<th>Project</th>
<th>Name</th>
<th></th>
</tr>
</thead>
<tbody id="videos">
<%= render partial: "admin/accounts/video", collection: @videos %>
</tbody>
</table>
</div>
<div id="videos_pagiantion">
<%= will_paginate @videos %>
</div>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,2 @@
$("#videos").html("<%= j render partial: "admin/accounts/video", collection: @videos %>");
$("#videos_pagination").html("<%= j will_paginate @videos %>");