#48 drop box shape

This commit is contained in:
Karel Picman 2017-07-20 08:40:03 +02:00
parent bf47687615
commit 23176ba0e3
4 changed files with 20 additions and 19 deletions

View File

@ -37,12 +37,9 @@
<%= form_tag({:controller => 'dmsf_upload', :action => 'upload_files', :id => @project, :folder_id => @folder},
:id => 'uploadform', :method => :post, :multipart => true) do %>
<div id="dmsf_uploader">
<div class="dmsf_uploader">
<p>
<label><%= l(:label_document_plural) %></label>
<%= render :partial => 'dmsf_upload/form', :locals => { :multiple => true, :container => nil } %>
</p>
</div>
<span class="dmsf_uploader">
<%= render :partial => 'dmsf_upload/form', :locals => { :multiple => true, :container => nil } %>
</span>
<%= submit_tag l(:label_upload) %>
</div>
<% end %>

View File

@ -252,7 +252,7 @@ function dmsfSetupFileDrop() {
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
$('form div.dmsf_uploader').has('input:file').each(function() {
$('form span.dmsf_uploader').has('input:file').each(function() {
$(this).on({
dragover: dmsfDragOverHandler,
dragleave: dmsfDragOutHandler,

View File

@ -310,6 +310,8 @@ div.dmsf_revision_inner_box .attribute .label {
border: 1px solid #e4e4e4;
word-wrap: break-word;
border-radius: 3px;
min-height: 50px;
display: block;
}
#dmsf_attachments_fields input.description {margin-left:4px; width:340px;}

View File

@ -53,7 +53,7 @@ module RedmineDmsf
private
def get_links(container)
if User.current.allowed_to?(:view_dmsf_files, container.project) &&
if defined?(container.dmsf_files) && User.current.allowed_to?(:view_dmsf_files, container.project) &&
Setting.plugin_redmine_dmsf['dmsf_act_as_attachable'] &&
(container.project.dmsf_act_as_attachable == Project::ATTACHABLE_DMS_AND_ATTACHMENTS)
links = []
@ -75,10 +75,12 @@ module RedmineDmsf
def show_thumbnails(container, controller)
links = get_links(container)
html = controller.send(:render_to_string,
{ :partial => 'dmsf_files/thumbnails',
:locals => { :links => links, :thumbnails => Setting.thumbnails_enabled?} })
html.html_safe
if links.present?
html = controller.send(:render_to_string,
{ :partial => 'dmsf_files/thumbnails',
:locals => { :links => links, :thumbnails => Setting.thumbnails_enabled?} })
html.html_safe
end
end
def attach_documents_form(context)
@ -88,13 +90,13 @@ module RedmineDmsf
if User.current.allowed_to?(:file_manipulation, issue.project) &&
Setting.plugin_redmine_dmsf['dmsf_act_as_attachable'] &&
(issue.project.dmsf_act_as_attachable == Project::ATTACHABLE_DMS_AND_ATTACHMENTS)
html = "<div class=\"dmsf_uploader\">"
html << '<p>'
html << "<label>#{l(:label_document_plural)}</label>"
html << context[:controller].send(:render_to_string,
{ :partial => 'dmsf_upload/form', :locals => { :container => issue, :multiple => true }})
html = '<p>'
html << "<label>#{l(:label_document_plural)}</label>"
html << "<span class=\"dmsf_uploader\">"
html << context[:controller].send(:render_to_string,
{ :partial => 'dmsf_upload/form', :locals => { :container => issue, :multiple => true }})
html << '</span>'
html << '</p>'
html << '</div>'
html.html_safe
end
end
@ -103,7 +105,7 @@ module RedmineDmsf
def show_attached_documents(container, controller)
# Add list of attached documents
links = get_links(container)
if links.any?
if links.present?
unless defined?(EasyExtensions)
controller.send(:render_to_string, {:partial => 'dmsf_files/links',
:locals => { :links => links, :thumbnails => Setting.thumbnails_enabled? }})