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,16 @@
<section class="mt-5">
<h1 class="h3"><%= t(".heading") %> (<%= directories.size %>)</h1>
<ul class="list-unstyled mt-2 row">
<div class="col-sm-6 col-md-4 col-lg-3 mt-4">
<li class="card h-100 shadow-sm">
<div class="card-body d-flex flex-column justify-content-center align-items-center">
<%= fa_icon("plus-circle", class: "text-success", style: "font-size:4rem") %>
<% if policy(Directory).new? %>
<%= link_to t("projects.index.actions.folder"), [:new, @project, :directory], class: "mt-4 text-reset text-decoration-none stretched-link" %>
<% end %>
</div>
</li>
</div>
<%= render directories, project: @project %>
</ul>
</section>

View File

@@ -0,0 +1,29 @@
<div class="col-sm-6 col-md-4 col-lg-3 mt-4">
<li class="card h-100 shadow-sm">
<div class="card-header d-flex justify-content-between align-items-end bg-white border-bottom-0 pr-2">
<small class="text-more-muted text-uppercase font-weight-bold"><%= directory.permissions %></small>
<div class="dropdown">
<%= button_tag fa_icon("gear"), class: "btn btn-white btn-sm border text-muted", data: { toggle: "dropdown" }, aria: { haspopup: true, expanded: false } %>
<div class="dropdown-menu dropdown-menu-right">
<% if policy(directory).edit? %>
<%= link_to fa_icon("pencil fw", text: t(".actions.edit")), [:edit, project, directory], class: "dropdown-item" %>
<% end %>
<% if policy(directory).destroy? %>
<%= link_to fa_icon("trash fw", text: t(".actions.delete")), [project, directory], method: :delete, class: "dropdown-item", data: { confirm: t(".confirm_delete", count: directory.files.count) } %>
<% end %>
</div>
</div>
</div>
<div class="card-body py-0">
<%= link_to [project, directory], class: "d-block pb-5 text-decoration-none text-reset link-stretched" do %>
<h2 class="h5"><%= directory.name %></h2>
<% end %>
</div>
<div class="card-footer bg-white border-top-0 px-2">
<div class="d-flex flex-row justify-content-start align-items-center flex-wrap">
<%#= team_member_list project.users.first(3) %>
<small class="ml-1"><%#= link_to pluralize(project.account.users.size, t(".team_member")), [project, :project_memberships], class: "text-muted" %></small>
</div>
</div>
</li>
</div>

View File

@@ -0,0 +1,21 @@
<tr id="<%= dom_id(file) %>">
<td>
<%= file.filename %>
</td>
<td>
<%= file.created_at %>
</td>
<td class="text-right">
<div class="btn-group">
<%= button_tag t(".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">
<% if policy(Directory).download_file? %>
<%= link_to fa_icon("download fw", text: "Download File"), file, class: "dropdown-item", target: "_blank" %>
<% end %>
<% if policy(Directory).destroy_file? %>
<%= link_to fa_icon("trash fw", text: "Delete File"), [:destroy_file, @project, @directory, { file_id: file.id }], class: "dropdown-item", method: :delete, data: { confirm: "Are you sure?" } %>
<% end %>
</div>
</div>
</td>
</tr>

View File

@@ -0,0 +1,8 @@
<%= bootstrap_form_with model: model do |form| %>
<%= field_set_tag content_tag(:span, t(".heading"), class: "h6 text-muted text-uppercase") do %>
<%= render "shared/files_dropzone_fields", form: form, directory: directory %>
<% end %>
<div class="pt-3">
<%= form.submit t(".submit"), class: "btn btn-block btn-success", data: { disable_with: t("shared.disable_with") } %>
</div>
<% end %>

View File

@@ -0,0 +1,21 @@
<%= errors_summary_for directory %>
<%= bootstrap_form_with model: model, local: true do |form| %>
<%= form.text_field :name %>
<%= form.select :category, Directory.categories.keys, {}, class: "form-control custom-select" %>
<% if policy(@directory).can_view_permissions_settings? %>
<%= form.form_group :permissions, label: { text: "Access Permissions:" }, help: t(".permissions_help") do %>
<% if Current.user.manager?(Current.account) %>
<%= form.radio_button :permissions, "Everyone", label: "Everyone" %>
<%= form.radio_button :permissions, "Account Managers & Project Managers", label: "Account Managers & Project Managers" %>
<% elsif Current.user.account_manager?(Current.account) %>
<%= form.radio_button :permissions, "Everyone", label: "Everyone" %>
<%= form.radio_button :permissions, "Account Managers & Project Managers", label: "Account Managers & Project Managers" %>
<%= form.radio_button :permissions, "Account Managers Only", label: "Account Managers Only" %>
<% end %>
<% end %>
<% end %>
<div class="pt-3">
<%= form.submit class: class_string("btn btn-block", ["btn-success", "btn-primary"] => directory.new_record?), data: { disable_with: t("shared.disable_with") } %>
</div>
<% end %>

View File

@@ -0,0 +1,6 @@
<div class="card shadow-sm">
<%= card_header text: t(".heading"), close_action_path: @project %>
<div class="card-body">
<%= render "form", model: [@project, @directory], directory: @directory %>
</div>
</div>

View File

@@ -0,0 +1,6 @@
<div class="card shadow-sm">
<%= card_header text: t(".heading"), close_action_path: @project %>
<div class="card-body">
<%= render "form", model: [@project, @directory], directory: @directory %>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<div class="card shadow-sm">
<div class="card-body">
<%= render "file_form", model: [@project, @directory], directory: @directory %>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<div class="d-flex flex-row justify-content-between align-items-center mb-3">
<% if policy(Directory).new_file? %>
<%= link_to fa_icon("plus", text: "Add File"), [:new_file, @project, @directory], class: "btn btn-primary" %>
<% end %>
<%= bootstrap_form_with url: [@project, @directory], method: :get, remote: true, layout: :inline 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"), class: "btn btn-light border rounded-pill-left") %>
<% 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><%= Directory.human_attribute_name(:name) %></th>
<th><%= Directory.human_attribute_name(:created_at) %></th>
<th></th>
</tr>
</thead>
<tbody id="files">
<% if @files.any? %>
<%= render partial: "file", collection: @files %>
<% else %>
<tr>
<td colspan="3" class="py-4 text-center text-muted"><%= t(".empty") %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div id="files_pagination" class="mt-3">
<%= will_paginate @files %>
</div>

View File

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