From d0fa6cebc1b7a02423710fa96e2c0b513f8d0118 Mon Sep 17 00:00:00 2001 From: "vit.jonas@gmail.com" Date: Tue, 17 May 2011 08:50:43 +0000 Subject: [PATCH] * improved file detail available actions * replaced action links with icons * fixed Issue 7: Include lock state info in file detail git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@48 5e329b0b-a2ee-ea63-e329-299493fc886d --- app/controllers/dmsf_controller.rb | 2 +- app/controllers/dmsf_state_controller.rb | 18 ++++--- app/views/dmsf/index.html.erb | 4 +- app/views/dmsf_detail/file_detail.html.erb | 53 ++++++++++++++++++--- assets/images/download.png | Bin 0 -> 3313 bytes config/locales/en.yml | 1 + 6 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 assets/images/download.png diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 081643c8..9333c0f0 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -187,7 +187,7 @@ class DmsfController < ApplicationController def send_revision send_file(@revision.disk_file, - :filename => filename_for_content_disposition(@revision.file.name), + :filename => filename_for_content_disposition(@revision.name), :type => @revision.detect_content_type, :disposition => "attachment") end diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index 434df33f..ef05e34f 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -31,7 +31,8 @@ class DmsfStateController < ApplicationController @file.lock flash[:notice] = l(:notice_file_locked) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end def unlock_file @@ -45,7 +46,8 @@ class DmsfStateController < ApplicationController flash[:error] = l(:error_only_user_that_locked_file_can_unlock_it) end end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end def user_pref @@ -66,7 +68,8 @@ class DmsfStateController < ApplicationController @folder.notify_activate flash[:notice] = l(:notice_folder_notifications_activated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder} end def folder_notify_deactivate @@ -76,7 +79,8 @@ class DmsfStateController < ApplicationController @folder.notify_deactivate flash[:notice] = l(:notice_folder_notifications_deactivated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder} end def file_notify_activate @@ -86,7 +90,8 @@ class DmsfStateController < ApplicationController @file.notify_activate flash[:notice] = l(:notice_file_notifications_activated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end def file_notify_deactivate @@ -96,7 +101,8 @@ class DmsfStateController < ApplicationController @file.notify_deactivate flash[:notice] = l(:notice_file_notifications_deactivated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end private diff --git a/app/views/dmsf/index.html.erb b/app/views/dmsf/index.html.erb index 9dd4c78d..c55a8d46 100644 --- a/app/views/dmsf/index.html.erb +++ b/app/views/dmsf/index.html.erb @@ -141,7 +141,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder {:controller => "dmsf_detail", :action => "file_detail", :id => @project, :file_id => file }, :title => l(:link_details, :title =>h(file.last_revision.title))) %> -
+
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%> <% if file.locked? %> <%= link_to(image_tag("unlock.png", :plugin => "redmine_dmsf"), @@ -154,7 +154,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder <% end %>   <% end %> - <% if User.current.allowed_to?(:file_manipulation, @project) %> + <% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %> <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"), {:controller => "dmsf_detail", :action => "delete_file", :id => @project, :file_id => file}, :class => "delete-link", :title => l(:title_delete)) %> diff --git a/app/views/dmsf_detail/file_detail.html.erb b/app/views/dmsf_detail/file_detail.html.erb index 950b5f83..4e803061 100644 --- a/app/views/dmsf_detail/file_detail.html.erb +++ b/app/views/dmsf_detail/file_detail.html.erb @@ -1,13 +1,46 @@ <% html_title(l(:dmsf)) %>
+ <% if User.current.allowed_to?(:file_manipulation, @project) %> + <% unless @file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%> + <% if @file.locked? %> + <%= link_to(image_tag("unlock.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "unlock_file", :id => @project, :file_id => @file, + :current => request.url }, + :title => l(:title_unlock_file)) %> + <% else %> + <%= link_to(image_tag("lock.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "lock_file", :id => @project, :file_id => @file, + :current => request.url }, + :title => l(:title_lock_file)) %> + <% end %> + <% end %> + <% if User.current.allowed_to?(:file_manipulation, @project) && !@file.locked_for_user? %> +   + <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_detail", :action => "delete_file", :id => @project, + :file_id => @file}, :class => "delete-entry", :title => l(:title_delete)) %> + <% end %> + <% if User.current.allowed_to?(:file_approval, @project) %> +   + <% if @file.notification %> + <%= link_to(image_tag("notify.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "file_notify_deactivate", :id => @project, + :file_id => @file, :current => request.url }, :title => l(:title_notifications_active_deactivate)) %> + <% else %> + <%= link_to(image_tag("notifynot.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "file_notify_activate", :id => @project, + :file_id => @file, :current => request.url}, :title => l(:title_notifications_not_active_activate)) %> + <% end %> + <% end %> + <% end %>
<% path = @file.folder.nil? ? [] : @file.folder.dmsf_path %>

<%= render(:partial => "/dmsf/path", :locals => {:path => path}) %> / -<%= h(@file.last_revision.title) %>
<%= h(@file.name) %>
+<%= h(@file.last_revision.title) %> <% if @file.notification %> <%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) %> @@ -22,12 +55,14 @@ <% @file.revisions.each do |revision| %>
- <%= link_to(l(:title_download), - {:controller=>"dmsf", :action => "download_revision", :id => @project, :revision_id => revision}) %> + <%= link_to(image_tag("download.png", :plugin => "redmine_dmsf"), + {:controller=>"dmsf", :action => "download_revision", :id => @project, :revision_id => revision}, + :title => l(:title_title_version_version_download, :title => h(revision.title), :version => revision.version)) %> <% if User.current.allowed_to?(:file_approval, @project) %> - | <%= link_to(l(:title_delete), - {:action => "delete_revision", :id => @project, :revision_id => revision}, - :class => "delete-link", :title => l(:title_delete_revision)) %> +   + <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"), + {:action => "delete_revision", :id => @project, :revision_id => revision}, + :class => "delete-revision", :title => l(:title_delete_revision)) %> <% end %>

@@ -94,10 +129,14 @@ jQuery.noConflict(); jQuery(document).ready(function() { - jQuery("a.delete-link").click(function(event) { + jQuery("a.delete-revision").click(function(event) { if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_revision) %>")) event.preventDefault(); }) + jQuery("a.delete-entry").click(function(event) { + if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) event.preventDefault(); + }) + jQuery("#fileFileUpload").change(function() { if(jQuery("input[name=\"file[version]\"]:checked").val() == "same") { jQuery("#fileMinorVersionRadio").prop("checked", true); diff --git a/assets/images/download.png b/assets/images/download.png new file mode 100644 index 0000000000000000000000000000000000000000..64d92be910053cfe6d6f9c7a6cbf3b390861b7d5 GIT binary patch literal 3313 zcmV&P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*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