diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index afbaf4be..4bc7cdd0 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -89,12 +89,12 @@ <% if !@system_folder %>
<%= submit_tag(l(:button_download), :title => l(:title_download_checked), :name => 'download_entries', - :class => 'toggle-selection') if @file_view_allowed %> + :class => 'toggle-selection') if @file_view_allowed %> <%= submit_tag(l(:field_mail), :title => l(:title_send_checked_by_email), :name => 'email_entries', - :class => 'toggle-selection') if (@file_view_allowed && User.current.allowed_to?(:email_documents, @project)) %> + :class => 'toggle-selection') if (@file_view_allowed && User.current.allowed_to?(:email_documents, @project)) %> <% if @file_delete_allowed %> - <%= submit_tag(l(:button_delete), :title => l(:title_delete_checked), :name => 'delete_entries', - :class => 'toggle-selection') if @file_delete_allowed %> + <%= submit_tag(l(:button_delete), :title => l(:title_delete_checked), :name => 'delete_entries', + :class => 'toggle-selection', :data => { :confirm => l(:text_are_you_sure) }) if @file_delete_allowed %> <% end %>
<% end %> @@ -124,19 +124,6 @@ <%= context_menu %> -<%= late_javascript_tag do %> - $('#entries_delete_button').click(function () { - if (window.confirm("<%= l(:text_are_you_sure) %>")) { - $('#entries_form').attr('action', "<%= delete_entries_path(:id => @project, :folder_id => @folder) %>"); - $('#entries_form').submit(); - } - }); - $('.list_cf').change(function() { - $('#entries_form').attr('action', "<%= tag_changed_path(:id => @project, :folder_id => @folder) %>"); - $('#entries_form').submit(); - }); -<% end %> - <% content_for :header_tags do %> <%= stylesheet_link_tag 'jquery.dataTables/datatables.min.css', :plugin => 'redmine_dmsf' %> <%= javascript_include_tag 'jquery.dataTables/datatables.min.js', :plugin => 'redmine_dmsf' %> @@ -153,68 +140,74 @@ <% modified = DmsfFolder.get_column_position('modified') %> <%= late_javascript_tag do %> - EASY.schedule.main(function() { - $("#browser").dataTable({ - orderClasses: false, - responsive: { - details: false - }, - language: { - url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>" - }, - autoWidth: false, - paginate: false, - <% if title %> - order: [[<%= title %>, "asc"]], + $("#browser").dataTable({ + orderClasses: false, + responsive: { + details: false + }, + language: { + url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>" + }, + autoWidth: false, + paginate: false, + <% if title %> + order: [[<%= title %>, "asc"]], + <% end %> + sortingFixed: [[ <%= position %>, "asc"]], + columnDefs: [ + { responsivePriority: 1, targets: <%= title %> }, + { responsivePriority: 2, targets: <%= commands %> }, + { searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] }, + { sortable: false, targets: [0, <%= commands %>] } + <% if size %> + ,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] } + <% end %> + <% if modified %> + ,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] } + <% end %> + <% if version %> + ,{ iDataSort: <%= version_calculated %>, targets: [ <%= version %> ] } + <% end %> + ], + "fnInitComplete": function() { + var browserFilter = $("#browser_filter"); + $("#dmsf_buttons").insertBefore(browserFilter); + $("#dmsf_tag").insertBefore(browserFilter); + }, + "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) { + <% if @tree_view %> + <% if @folder %> + return "<%= "#{l(:label_number_of_folders)}: #{@folder.deep_folder_count} #{l(:label_number_of_documents)}: #{@folder.deep_file_count}" %>"; + <% else %> + return "<%= "#{l(:label_number_of_folders)}: #{DmsfFolder.visible.where(:project_id => @project.id).count + DmsfLink.visible.where(:project_id => @project.id, :target_type => 'DmsfFolder').count}, #{l(:label_number_of_documents)}: #{DmsfFile.visible.where(:project_id => @project.id).count + DmsfLink.visible.where(:project_id => @project.id, :target_type => ['DmsfFile', 'DmsfUrl']).count}" %>"; <% end %> - sortingFixed: [[ <%= position %>, "asc"]], - columnDefs: [ - { responsivePriority: 1, targets: <%= title %> }, - { responsivePriority: 2, targets: <%= commands %> }, - { searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] }, - { sortable: false, targets: [0, <%= commands %>] } - <% if size %> - ,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] } - <% end %> - <% if modified %> - ,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] } - <% end %> - <% if version %> - ,{ iDataSort: <%= version_calculated %>, targets: [ <%= version %> ] } - <% end %> - ], - "fnInitComplete": function() { - $("#dmsf_buttons").prependTo($("#browser_wrapper div.fg-toolbar")[0]); - $("#dmsf_tag").prependTo($("#browser_wrapper div.fg-toolbar")[0]); - }, - "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) { - <% if @tree_view %> - <% if @folder %> - return "<%= "#{l(:label_number_of_folders)}: #{@folder.deep_folder_count} #{l(:label_number_of_documents)}: #{@folder.deep_file_count}" %>"; - <% else %> - return "<%= "#{l(:label_number_of_folders)}: #{DmsfFolder.visible.where(:project_id => @project.id).count + DmsfLink.visible.where(:project_id => @project.id, :target_type => 'DmsfFolder').count}, #{l(:label_number_of_documents)}: #{DmsfFile.visible.where(:project_id => @project.id).count + DmsfLink.visible.where(:project_id => @project.id, :target_type => ['DmsfFile', 'DmsfUrl']).count}" %>"; - <% end %> - <% else %> - return "<%= "#{l(:label_number_of_folders)}: #{@subfolders.count + @dir_links.count}, #{l(:label_number_of_documents)}: #{@files.count + @file_links.count + @url_links.count}" %>"; - <% end %> - } - }); + <% else %> + return "<%= "#{l(:label_number_of_folders)}: #{@subfolders.count + @dir_links.count}, #{l(:label_number_of_documents)}: #{@files.count + @file_links.count + @url_links.count}" %>"; + <% end %> + } + }); - $("[data-downloadurl]").each(function() { - var url = this.getAttribute("data-downloadurl"); - if (this.addEventListener) { - this.addEventListener("dragstart", function(e) { - if (e.dataTransfer) { - e.dataTransfer.setData("DownloadURL", url); - } - },false); - } - }); + $("[data-downloadurl]").each(function() { + var url = this.getAttribute("data-downloadurl"); + if (this.addEventListener) { + this.addEventListener("dragstart", function(e) { + if (e.dataTransfer) { + e.dataTransfer.setData("DownloadURL", url); + } + },false); + } + }); - $("#entries_form").submit(function () { - $(this).removeAttr("data-submitted"); - }); - }); + var entriesForm = $('#entries_form'); + + entriesForm.submit(function () { + $(this).removeAttr("data-submitted"); + }); + + $('.list_cf').change(function() { + entriesForm.attr('action', "<%= tag_changed_path(:id => @project, :folder_id => @folder) %>"); + entriesForm.submit(); + }); <% end %> <% end %> diff --git a/app/views/dmsf/trash.html.erb b/app/views/dmsf/trash.html.erb index 56dfcbf8..7948be8f 100644 --- a/app/views/dmsf/trash.html.erb +++ b/app/views/dmsf/trash.html.erb @@ -35,13 +35,13 @@ <%= form_tag(entries_operations_dmsf_path(:id => @project, :folder_id => @folder), :method => :post, :class => 'dmsf_entries', :id => 'entries_form', :data => {:cm_url => dmsf_trash_context_menu_path}) do %> <%= hidden_field_tag('action') %> -
+
<% if @file_manipulation_allowed && @folder_manipulation_allowed %> - <%= submit_tag(l(:title_restore), :title => l(:title_restore_checked), :name => 'restore_entries', - :class => 'toggle-selection') %> + <%= submit_tag l(:title_restore), :title => l(:title_restore_checked), :name => 'restore_entries', + :class => 'toggle-selection' %> <% if @file_delete_allowed%> - <%= submit_tag(l(:button_delete), :title => l(:title_delete_checked), :name => 'destroy_entries', - :class => 'toggle-selection') %> + <%= submit_tag l(:button_delete), :title => l(:title_delete_checked), :name => 'destroy_entries', + :class => 'toggle-selection', :data => { :confirm => l(:text_are_you_sure) } %> <% end %> <% end %>
@@ -153,13 +153,13 @@ <% end %> <% @url_links.each do |link| %> - <%= render(:partial => 'url_trash', :locals => { - :project => link.target_project, - :file => link.target_file, - :link => link, - :id => link.id, - :name => 'url-link', - :title => link.name }) %> + <%= render(:partial => 'url_trash', :locals => { + :project => link.target_project, + :file => link.target_file, + :link => link, + :id => link.id, + :name => 'url-link', + :title => link.name }) %> <% end %> @@ -168,19 +168,6 @@ <%= context_menu %> -<%= late_javascript_tag do %> - $('#entries_delete_button').click(function() { - if(window.confirm("<%= l(:text_are_you_sure) %>")) { - $('#entries_form').attr('action', "<%= delete_entries_path(:id => @project, :folder_id => @folder) %>"); - $('#entries_form').submit(); - } - }); - $('.list_cf').change(function() { - $('#entries_form').attr('action', "<%= tag_changed_path(:id => @project, :folder_id => @folder) %>"); - $('#entries_form').submit(); - }); -<% end %> - <% content_for :header_tags do %> <%= stylesheet_link_tag 'jquery.dataTables/datatables.min.css', :plugin => 'redmine_dmsf' %> <%= javascript_include_tag 'jquery.dataTables/datatables.min.js', :plugin => 'redmine_dmsf' %> @@ -197,47 +184,45 @@ <% modified = DmsfFolder.get_column_position('modified') %> <%= late_javascript_tag do %> - EASY.schedule.main(function() { - $('#browser').dataTable({ - orderClasses: false, - responsive: { - details: false - }, - language: { - url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>" - }, - autoWidth: false, - paginate: false, - <% if title %> - order: [[<%= title %>, "asc"]], - <% end %> - sortingFixed: [[ <%= position %>, "asc"]], - columnDefs: [ - { responsivePriority: 1, targets: <%= title %> }, - { responsivePriority: 2, targets: <%= commands %> }, - { searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] }, - { sortable: false, targets: [0, <%= commands %>] } - <% if size %> - ,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] } - <% end %> - <% if modified %> - ,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] } - <% end %> - <% if version %> - ,{ iDataSort: <%= version_calculated %>, targets: [ <%= version %> ] } - <% end %> - ], - "fnInitComplete": function() { - $("div.dmsf_controls").prependTo($("#browser_wrapper div.fg-toolbar")[0]); - }, - "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) { - return "<%= l(:label_number_of_folders)%>: <%= @subfolders.count + @dir_links.count %>, <%= l(:label_number_of_documents)%>: <%= @files.count + @file_links.count + @url_links.count %>"; - } - }); + $('#browser').dataTable({ + orderClasses: false, + responsive: { + details: false + }, + language: { + url: "<%= plugin_asset_path(:redmine_dmsf, 'javascripts', json_url) %>" + }, + autoWidth: false, + paginate: false, + <% if title %> + order: [[<%= title %>, "asc"]], + <% end %> + sortingFixed: [[ <%= position %>, "asc"]], + columnDefs: [ + { responsivePriority: 1, targets: <%= title %> }, + { responsivePriority: 2, targets: <%= commands %> }, + { searchable: false, targets: [0, <%= commands %>, <%= position %>, <%= size_calculated %>, <%= modified_calculated %>, <%= version_calculated %>] }, + { sortable: false, targets: [0, <%= commands %>] } + <% if size %> + ,{ iDataSort: <%= size_calculated %>, targets: [ <%= size %> ] } + <% end %> + <% if modified %> + ,{ iDataSort: <%= modified_calculated %>, targets: [ <%= modified %> ] } + <% end %> + <% if version %> + ,{ iDataSort: <%= version_calculated %>, targets: [ <%= version %> ] } + <% end %> + ], + "fnInitComplete": function() { + $("#dmsf_buttons").insertBefore($("#browser_filter")); + }, + "fnInfoCallback": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) { + return "<%= l(:label_number_of_folders)%>: <%= @subfolders.count + @dir_links.count %>, <%= l(:label_number_of_documents)%>: <%= @files.count + @file_links.count + @url_links.count %>"; + } + }); - $("#entries_form").submit(function () { - $(this).removeAttr("data-submitted"); - }); + $("#entries_form").submit(function () { + $(this).removeAttr("data-submitted"); }); <% end %> <% end %> diff --git a/app/views/dmsf_context_menus/dmsf.html.erb b/app/views/dmsf_context_menus/dmsf.html.erb index 32cd878a..5f16341e 100644 --- a/app/views/dmsf_context_menus/dmsf.html.erb +++ b/app/views/dmsf_context_menus/dmsf.html.erb @@ -34,7 +34,7 @@
  • <%= context_menu_link l(:button_delete), entries_operations_dmsf_path(:id => @project, :folder_id => @folder, :ids => params[:ids], :delete_entries => true), :method => :post, :class => 'icon-del', - :disabled => @disabled %> + :data => { :confirm => l(:text_are_you_sure) }, :id => 'dmsf-cm-delete', :disabled => @disabled %>
  • <% if @file %>
  • @@ -54,4 +54,8 @@ $('#dmsf-cm-download').click(function (event) { contextMenuHide(); }); + + $('#dmsf-cm-delete').click(function (event) { + contextMenuHide(); + }); <% end %> diff --git a/app/views/dmsf_context_menus/trash.html.erb b/app/views/dmsf_context_menus/trash.html.erb index d9bb9067..44f01e91 100644 --- a/app/views/dmsf_context_menus/trash.html.erb +++ b/app/views/dmsf_context_menus/trash.html.erb @@ -23,10 +23,17 @@ + +<%= late_javascript_tag do %> + $('#dmsf-cm-delete').click(function (event) { + contextMenuHide(); + }); +<% end %>