Add folders to the documents plugin
This commit is contained in:
parent
611a29fe2d
commit
dc94e98138
19 changed files with 141 additions and 71 deletions
|
|
@ -11,7 +11,7 @@
|
|||
%tbody
|
||||
- for document in @documents
|
||||
%tr
|
||||
%td= link_to document.name, document
|
||||
%td= link_to document.name, document, class: "documents-item-#{document.folder? ? 'folder' : 'file'}"
|
||||
%td= format_time(document.created_at)
|
||||
%td= h show_user(document.created_by)
|
||||
%td
|
||||
|
|
|
|||
12
plugins/documents/app/views/documents/_form.html.haml
Normal file
12
plugins/documents/app/views/documents/_form.html.haml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
= simple_form_for @document, validate: true do |f|
|
||||
= f.hidden_field :parent_id
|
||||
.modal-header
|
||||
= close_button :modal
|
||||
%h3= @document.folder? ? t('.new_folder') : t('.new')
|
||||
.modal-body
|
||||
= f.input :name, as: :string, required: @document.folder?
|
||||
- if @document.file?
|
||||
= f.input :data, as: :file, required: true
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
= f.submit t('.submit'), class: 'btn btn-primary'
|
||||
|
|
@ -1,7 +1,21 @@
|
|||
- title t('.title')
|
||||
|
||||
- content_for :actionbar do
|
||||
= link_to t('.new'), new_document_path, class: 'btn btn-primary'
|
||||
- options = { document_id: @document || 0 }
|
||||
= link_to t('.new_folder'), document_new_path(options.merge(type: :folder)), remote: true, class: 'btn'
|
||||
= link_to t('.new'), document_new_path(options), remote: true, class: 'btn btn-primary'
|
||||
|
||||
- if @document
|
||||
%ul.breadcrumb
|
||||
%li
|
||||
= link_to t('.title'), documents_path
|
||||
%span.divider /
|
||||
- for parent_folder in @document.ancestors.reverse
|
||||
%li
|
||||
= link_to parent_folder.name, parent_folder
|
||||
%span.divider /
|
||||
%li.active
|
||||
= @document.name
|
||||
|
||||
#documentsTable
|
||||
= render :partial => "documents"
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
- title t('.title')
|
||||
|
||||
= simple_form_for(@document) do |f|
|
||||
= f.input :name, as: :string
|
||||
= f.input :data, as: :file
|
||||
.form-actions
|
||||
= f.submit class: 'btn'
|
||||
= link_to t('ui.or_cancel'), :back
|
||||
2
plugins/documents/app/views/documents/new.js.haml
Normal file
2
plugins/documents/app/views/documents/new.js.haml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$('#modalContainer').html('#{j(render("form"))}');
|
||||
$('#modalContainer').modal();
|
||||
Loading…
Add table
Add a link
Reference in a new issue