* 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
This commit is contained in:
vit.jonas@gmail.com 2011-05-17 08:50:43 +00:00
parent 4b4c74f2b3
commit d0fa6cebc1
6 changed files with 62 additions and 16 deletions

View File

@ -187,7 +187,7 @@ class DmsfController < ApplicationController
def send_revision def send_revision
send_file(@revision.disk_file, 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, :type => @revision.detect_content_type,
:disposition => "attachment") :disposition => "attachment")
end end

View File

@ -31,7 +31,8 @@ class DmsfStateController < ApplicationController
@file.lock @file.lock
flash[:notice] = l(:notice_file_locked) flash[:notice] = l(:notice_file_locked)
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 end
def unlock_file def unlock_file
@ -45,7 +46,8 @@ class DmsfStateController < ApplicationController
flash[:error] = l(:error_only_user_that_locked_file_can_unlock_it) flash[:error] = l(:error_only_user_that_locked_file_can_unlock_it)
end end
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 end
def user_pref def user_pref
@ -66,7 +68,8 @@ class DmsfStateController < ApplicationController
@folder.notify_activate @folder.notify_activate
flash[:notice] = l(:notice_folder_notifications_activated) flash[:notice] = l(:notice_folder_notifications_activated)
end 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 end
def folder_notify_deactivate def folder_notify_deactivate
@ -76,7 +79,8 @@ class DmsfStateController < ApplicationController
@folder.notify_deactivate @folder.notify_deactivate
flash[:notice] = l(:notice_folder_notifications_deactivated) flash[:notice] = l(:notice_folder_notifications_deactivated)
end 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 end
def file_notify_activate def file_notify_activate
@ -86,7 +90,8 @@ class DmsfStateController < ApplicationController
@file.notify_activate @file.notify_activate
flash[:notice] = l(:notice_file_notifications_activated) flash[:notice] = l(:notice_file_notifications_activated)
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 end
def file_notify_deactivate def file_notify_deactivate
@ -96,7 +101,8 @@ class DmsfStateController < ApplicationController
@file.notify_deactivate @file.notify_deactivate
flash[:notice] = l(:notice_file_notifications_deactivated) flash[:notice] = l(:notice_file_notifications_deactivated)
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 end
private private

View File

@ -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 }, {:controller => "dmsf_detail", :action => "file_detail", :id => @project, :file_id => file },
:title => l(:link_details, :title =>h(file.last_revision.title))) %> :title => l(:link_details, :title =>h(file.last_revision.title))) %>
</div> </div>
<div style="float: right"> <div style="float: right; width: 44px;">
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%> <% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%>
<% if file.locked? %> <% if file.locked? %>
<%= link_to(image_tag("unlock.png", :plugin => "redmine_dmsf"), <%= 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 %>
&nbsp; &nbsp;
<% 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"), <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"),
{:controller => "dmsf_detail", :action => "delete_file", :id => @project, {:controller => "dmsf_detail", :action => "delete_file", :id => @project,
:file_id => file}, :class => "delete-link", :title => l(:title_delete)) %> :file_id => file}, :class => "delete-link", :title => l(:title_delete)) %>

View File

@ -1,13 +1,46 @@
<% html_title(l(:dmsf)) %> <% html_title(l(:dmsf)) %>
<div class="contextual"> <div class="contextual">
<% 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? %>
&nbsp;
<%= 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) %>
&nbsp;
<% 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 %>
</div> </div>
<% path = @file.folder.nil? ? [] : @file.folder.dmsf_path %> <% path = @file.folder.nil? ? [] : @file.folder.dmsf_path %>
<h2> <h2>
<%= render(:partial => "/dmsf/path", :locals => {:path => path}) %> <%= render(:partial => "/dmsf/path", :locals => {:path => path}) %>
/ /
<%= h(@file.last_revision.title) %> <div style="float: right"><%= h(@file.name) %></div> <%= h(@file.last_revision.title) %>
<% if @file.notification %> <% if @file.notification %>
<%= image_tag("notify.png", :plugin => "redmine_dmsf", <%= image_tag("notify.png", :plugin => "redmine_dmsf",
:title => l(:title_notifications_active)) %> :title => l(:title_notifications_active)) %>
@ -22,12 +55,14 @@
<% @file.revisions.each do |revision| %> <% @file.revisions.each do |revision| %>
<div class="box dmsf_detail"> <div class="box dmsf_detail">
<div style="float:right"> <div style="float:right">
<%= link_to(l(:title_download), <%= link_to(image_tag("download.png", :plugin => "redmine_dmsf"),
{:controller=>"dmsf", :action => "download_revision", :id => @project, :revision_id => revision}) %> {: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) %> <% if User.current.allowed_to?(:file_approval, @project) %>
| <%= link_to(l(:title_delete), &nbsp;
<%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"),
{:action => "delete_revision", :id => @project, :revision_id => revision}, {:action => "delete_revision", :id => @project, :revision_id => revision},
:class => "delete-link", :title => l(:title_delete_revision)) %> :class => "delete-revision", :title => l(:title_delete_revision)) %>
<% end %> <% end %>
</div> </div>
<p class="no-ident"> <p class="no-ident">
@ -94,10 +129,14 @@
jQuery.noConflict(); jQuery.noConflict();
jQuery(document).ready(function() { 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(); 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() { jQuery("#fileFileUpload").change(function() {
if(jQuery("input[name=\"file[version]\"]:checked").val() == "same") { if(jQuery("input[name=\"file[version]\"]:checked").val() == "same") {
jQuery("#fileMinorVersionRadio").prop("checked", true); jQuery("#fileMinorVersionRadio").prop("checked", true);

BIN
assets/images/download.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -107,3 +107,4 @@ en:
:option_version_major: "Major" :option_version_major: "Major"
:label_new_content: "New content" :label_new_content: "New content"