diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 936c6052..9e940e5a 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -203,26 +203,46 @@ class DmsfController < ApplicationController redirect_to :controller => "dmsf", :action => "show", :id => @project end - def notify_activate - if @folder.notification + def notify_activate + if((@folder && @folder.notification) || (@folder.nil? && @project.dmsf_notification)) flash[:warning] = l(:warning_folder_notifications_already_activated) else - @folder.notify_activate + if @folder + @folder.notify_activate + else + @project.dmsf_notification = true + @project.save + end flash[:notice] = l(:notice_folder_notifications_activated) end - redirect_to params[:current] ? params[:current] : - {:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder.folder} + if params[:current] + redirect_to params[:current] + elsif @folder + redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder}) + else + redirect_to({:controller => 'dmsf', :action => 'show', :id => @project}) + end end def notify_deactivate - if !@folder.notification + if((@folder && !@folder.notification) || (@folder.nil? && !@project.dmsf_notification)) flash[:warning] = l(:warning_folder_notifications_already_deactivated) else - @folder.notify_deactivate + if @folder + @folder.notify_deactivate + else + @project.dmsf_notification = false + @project.save + end flash[:notice] = l(:notice_folder_notifications_deactivated) end - redirect_to params[:current] ? params[:current] : - {:controller => "dmsf", :action => "show", :id => @project, :folder_id => @folder.folder} + if params[:current] + redirect_to params[:current] + elsif @folder + redirect_to({:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @folder.folder}) + else + redirect_to({:controller => 'dmsf', :action => 'show', :id => @project}) + end end diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index ca5b7461..216383ad 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -157,6 +157,7 @@ class DmsfFile < ActiveRecord::Base def notify? return true if self.notification return true if folder && folder.notify? + return true if !folder && self.project.dmsf_notification return false end diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 8ab595e2..45103f67 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -115,6 +115,7 @@ class DmsfFolder < ActiveRecord::Base def notify? return true if self.notification return true if folder && folder.notify? + return true if !folder && self.project.dmsf_notification return false end diff --git a/app/views/dmsf/_path.html.erb b/app/views/dmsf/_path.html.erb deleted file mode 100644 index a937bff4..00000000 --- a/app/views/dmsf/_path.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= link_to(l(:link_documents), {:controller => "dmsf", :action => "show", :id=> @project }) %> -<% path.each do |path_element| %> - / - <%= link_to(h(path_element.title), {:controller => "dmsf", :action => "show", :id=> @project, :folder_id => path_element}) %> - <% if path_element.notification %> - <%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) %> - <% end %> -<% end %> diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index bc4309aa..cb5be56a 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -1,40 +1,56 @@ <% html_title(l(:dmsf)) %>
- <%= link_to(h(file.dmsf_path_str),
- {:only_path => false, :controller => "dmsf_files", :action => "show", :id => file,
- :download => ""}) %> (<%= file.name %>),
- <%= number_to_human_size(file.last_revision.size) %>,
- version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
- <%= "#{file.last_revision.workflow_str(true)}," unless file.last_revision.workflow_str(true).blank? %>
- <%= link_to("Details",
- {:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
- <% unless file.last_revision.comment.blank? %>
-
<%= h(file.last_revision.comment) %>
- <% end %>
-
+ <%= link_to(h(file.dmsf_path_str),
+ {:only_path => false, :controller => "dmsf_files", :action => "show", :id => file,
+ :download => ""}) %> (<%= file.name %>),
+ <%= number_to_human_size(file.last_revision.size) %>,
+ version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
+ <%= "#{file.last_revision.workflow_str(true)}," unless file.last_revision.workflow_str(true).blank? %>
+ <%= link_to("Details",
+ {:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
+ <% unless file.last_revision.comment.blank? %>
+
<%= h(file.last_revision.comment) %>
+ <% end %>
+
- <%= link_to(h(file.dmsf_path_str),
- {:only_path => false, :controller => "dmsf_files", :action => "show", :id => file,
- :download => ""}) %> (<%= file.name %>),
- <%= number_to_human_size(file.last_revision.size) %>,
- version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
- <%= "#{file.last_revision.workflow_str(true)}," unless file.last_revision.workflow_str(true).blank? %>
- <%= link_to("Details",
- {:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
- <% unless file.last_revision.comment.blank? %>
-
<%= h(file.last_revision.comment) %>
- <% end %>
-
Dear user,
-- <%= @text1 %> -
-- <%= @text2 %> -
- - \ No newline at end of file +Dear user,
++ <%= @text1 %> +
++ <%= @text2 %> +
+ \ No newline at end of file diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb index 38a1532b..4a43f9b1 100644 --- a/app/views/dmsf_upload/upload_files.html.erb +++ b/app/views/dmsf_upload/upload_files.html.erb @@ -3,9 +3,13 @@