Folder's description in the upload form

This commit is contained in:
Karel.Picman 2021-10-21 09:42:11 +02:00
parent eb55a242c2
commit cbbb923550
5 changed files with 45 additions and 19 deletions

View File

@ -29,6 +29,7 @@ class DmsfUploadController < ApplicationController
before_action :authorize_global, only: [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment] before_action :authorize_global, only: [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
before_action :find_folder, except: [:upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment] before_action :find_folder, except: [:upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
before_action :permissions, except: [:upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment] before_action :permissions, except: [:upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
before_action :wiki, only: [:multi_upload, :upload_files]
helper :all helper :all
helper :dmsf_workflows helper :dmsf_workflows
@ -41,7 +42,6 @@ class DmsfUploadController < ApplicationController
end end
def upload_files def upload_files
@wiki = Setting.text_formatting != 'HTML'
uploaded_files = params[:dmsf_attachments] uploaded_files = params[:dmsf_attachments]
@uploads = [] @uploads = []
if uploaded_files if uploaded_files
@ -145,4 +145,8 @@ class DmsfUploadController < ApplicationController
render_403 render_403
end end
def wiki
@wiki = Setting.text_formatting != 'HTML'
end
end end

View File

@ -0,0 +1,35 @@
<%
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% if @project %>
<div class="dmsf-header">
<% if @wiki %>
<div class="wiki">
<%= textilizable @folder ? @folder.description : @project.dmsf_description %>
</div>
<% else %>
<div class="dmsf-description">
<%= h @folder ? @folder.description : @project.dmsf_description %>
</div>
<% end %>
</div>
<% end %>

View File

@ -60,19 +60,7 @@
<%= render partial: 'path', locals: { folder: @folder, filename: nil, title: nil } %> <%= render partial: 'path', locals: { folder: @folder, filename: nil, title: nil } %>
<% if @project %> <%= render partial: 'description' %>
<div class="dmsf-header">
<% if @wiki %>
<div class="wiki">
<%= textilizable @folder ? @folder.description : @project.dmsf_description %>
</div>
<% else %>
<div class="dmsf-description">
<%= h @folder ? @folder.description : @project.dmsf_description %>
</div>
<% end %>
</div>
<% end %>
<%= form_tag(@project ? dmsf_folder_path(id: @project, folder_id: @folder) : dmsf_index_path, <%= form_tag(@project ? dmsf_folder_path(id: @project, folder_id: @folder) : dmsf_index_path,
method: :get, id: 'query_form', class: 'dmsf-query-form') do %> method: :get, id: 'query_form', class: 'dmsf-query-form') do %>

View File

@ -22,6 +22,9 @@
<%= render partial: '/dmsf/path', <%= render partial: '/dmsf/path',
locals: { folder: @folder, filename: nil, title: l(:label_attachment_new) } %> locals: { folder: @folder, filename: nil, title: l(:label_attachment_new) } %>
<%= render partial: 'dmsf/description' %>
<%= form_tag({ controller: 'dmsf_upload', action: 'upload_files', id: @project, folder_id: @folder }, <%= form_tag({ controller: 'dmsf_upload', action: 'upload_files', id: @project, folder_id: @folder },
{ id: 'uploadform', multipart: true }) do %> { id: 'uploadform', multipart: true }) do %>
<div class="box tabular"> <div class="box tabular">

View File

@ -33,11 +33,7 @@
</div> </div>
<% end %> <% end %>
<% if (@folder && @folder.description.present?) || @project.dmsf_description.present? %> <%= render partial: 'dmsf/description' %>
<div class="wiki">
<%= textilizable(@folder ? @folder.description : @project.dmsf_description) %>
</div>
<% end %>
<% unless @uploads.empty? %> <% unless @uploads.empty? %>
<%= form_tag({ action: 'commit_files', id: @project, folder_id: @folder }, method: :post) do %> <%= form_tag({ action: 'commit_files', id: @project, folder_id: @folder }, method: :post) do %>