diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 13895578..d929af8e 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -350,10 +350,15 @@ class DmsfController < ApplicationController end def save_root - @project.dmsf_description = params[:project][:dmsf_description] - @project.save! - flash[:notice] = l(:notice_folder_details_were_saved) - redirect_to :controller => 'dmsf', :action => 'show', :id => @project + if params[:project] + @project.dmsf_description = params[:project][:dmsf_description] + if @project.save + flash[:notice] = l(:notice_folder_details_were_saved) + else + flash[:error] = @project.errors.full_messages.to_sentence + end + end + redirect_to dmsf_folder_path(:id => @project) end def notify_activate diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index 39412d05..007bdd79 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -206,8 +206,8 @@ class DmsfWorkflowsController < ApplicationController # Reload if params[:dmsf_workflow] && params[:dmsf_workflow][:name].present? @dmsf_workflow.name = params[:dmsf_workflow][:name] - elsif params[:dmsf_workflow_id].present? - wf = DmsfWorkflow.find_by_id params[:dmsf_workflow_id] + elsif params[:dmsf_workflow] && params[:dmsf_workflow][:id].present? + wf = DmsfWorkflow.find_by_id params[:dmsf_workflow][:id] @dmsf_workflow.name = wf.name if wf end @@ -216,8 +216,8 @@ class DmsfWorkflowsController < ApplicationController def create if params[:dmsf_workflow] - if (params[:dmsf_workflow_id].to_i > 0) - wf = DmsfWorkflow.find_by_id params[:dmsf_workflow_id] + if (params[:dmsf_workflow][:id].to_i > 0) + wf = DmsfWorkflow.find_by_id params[:dmsf_workflow][:id] @dmsf_workflow = wf.copy_to(@project, params[:dmsf_workflow][:name]) if wf else @dmsf_workflow = DmsfWorkflow.new diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index a3e336a9..8444f078 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -68,23 +68,21 @@ <%= render(:partial => 'path', :locals => {:folder => @pathfolder, :filename => create ? l(:heading_new_folder) : nil, :title => nil}) %> -<%= form_for(@folder, :url => {:action => create ? 'create' : 'save', :id => @project, :folder_id => @folder, :parent_id => @parent}, +<%= labelled_form_for(@folder, :url => {:action => create ? 'create' : 'save', :id => @project, :folder_id => @folder, :parent_id => @parent}, :html => {:method=>:post}) do |f| %> <%= error_messages_for(@folder) %>
-

- - <%= f.text_field(:title, :size => '32', :required => true) %> +

+ <%= f.text_field(:title, :required => true) %>

-

- <%= label_tag('', l(:field_folder)) %> +

<%= f.select(:dmsf_folder_id, options_for_select(DmsfFolder.directory_tree(@project, @folder), - :selected => @parent? @parent.id : (@pathfolder.id if @pathfolder))) + :selected => @parent? @parent.id : (@pathfolder.id if @pathfolder)), + :label => l(:field_folder)) %>

-

- <%= label_tag('dmsf_folder_description', l(:label_description)) %> +

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit' %>

<% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %> diff --git a/app/views/dmsf/edit_root.html.erb b/app/views/dmsf/edit_root.html.erb index 3a6ec4a5..e76f87c8 100644 --- a/app/views/dmsf/edit_root.html.erb +++ b/app/views/dmsf/edit_root.html.erb @@ -43,15 +43,15 @@ <%= render(:partial => 'path', :locals => {:folder => nil, :filename => nil, :title => nil}) %> -<%= form_for(@project, :url => {:action => 'save_root', :id => @project}, - :html => {:method=>:post}) do |f| %> +<%= labelled_form_for(@project, :url => {:action => 'save_root', :id => @project}, + :html => {:method => :post}) do |f| %>
-

- <%= label_tag('project_dmsf_description', l(:label_description)) %> - <%= f.text_area(:dmsf_description, :rows => 8, :class => 'wiki-edit') %> +

+ <%= f.text_area(:dmsf_description, :rows => 8, :class => 'wiki-edit', + :label => l(:field_description)) %>

- <%= submit_tag(l(:submit_save)) %> + <%= f.submit l(:submit_save) %> <% end %> <%= wikitoolbar_for 'project_dmsf_description' %> \ No newline at end of file diff --git a/app/views/dmsf_files/_file_new_revision.html.erb b/app/views/dmsf_files/_file_new_revision.html.erb index 051033e5..215efc29 100644 --- a/app/views/dmsf_files/_file_new_revision.html.erb +++ b/app/views/dmsf_files/_file_new_revision.html.erb @@ -28,24 +28,21 @@ <% if @file.locked_for_user? %>

<%= l(:info_file_locked) %>

<% else %> - <%= form_for(@revision, :url => { :action => 'create_revision', :id => @file }, + <%= labelled_form_for(@revision, :url => { :action => 'create_revision', :id => @file }, :html => { :method => :post, :multipart => true, :id => 'new_revision_form' }) do |f| %>
-

- <%= label_tag('dmsf_file_revision_title', l(:label_title)) %> - <%= f.text_field(:title, :size => 32) %> +

+ <%= f.text_field(:title) %>

-

- <%= label_tag('', l(:label_file)) %> - <%= f.text_field(:name, :size => 22) %> +

+ <%= f.text_field(:name, :label => l(:label_file)) %>

-

- <%= label_tag('dmsf_file_revision_description', l(:label_description)) %> +

<%= f.text_area(:description, :rows => 6, :class => 'wiki-edit') %>

@@ -93,11 +90,10 @@

<%= custom_field_tag_with_label(:dmsf_file_revision, value) %>

<% end %>
-

- <%= label_tag('dmsf_file_revision_comment', l(:label_comment)) %> - <%= f.text_area(:comment, :rows => 2) %> +

+ <%= f.text_area(:comment, :rows => 2, :label => l(:label_comment)) %>

- <%= submit_tag(l(:submit_create)) %> + <%= f.submit l(:submit_create) %> <% end %> <% end %>
diff --git a/app/views/dmsf_links/_form.html.erb b/app/views/dmsf_links/_form.html.erb index 423ebdbb..cf661626 100644 --- a/app/views/dmsf_links/_form.html.erb +++ b/app/views/dmsf_links/_form.html.erb @@ -17,7 +17,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +%> <% html_title l(:dmsf) %> @@ -73,19 +74,19 @@ <% files = @dmsf_link.target_project.dmsf_files.visible if @dmsf_link.target_project %> <% end %> <%= f.select(:target_file_id, - options_for_select(DmsfFolder.file_list(files), @target_file_id)) %> + options_for_select(DmsfFolder.file_list(files), @target_file_id)) %>

<% end %> -

- - <%= text_field_tag 'dmsf_link[name]', @dmsf_link.name, :size => 40, :maxlength => 255 %> +

+ <%= f.text_field :name, + :maxlength => 255, :required => true, :label => l(:label_link_name) %>

<%= f.submit l(:button_create) %>

diff --git a/app/views/dmsf_upload/_multi_upload.html.erb b/app/views/dmsf_upload/_multi_upload.html.erb index 85a32ac8..a2ccc21a 100644 --- a/app/views/dmsf_upload/_multi_upload.html.erb +++ b/app/views/dmsf_upload/_multi_upload.html.erb @@ -1,10 +1,11 @@ <% # encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/upload_file.html.erb b/app/views/dmsf_upload/upload_file.html.erb index 769ed941..7f8986ae 100644 --- a/app/views/dmsf_upload/upload_file.html.erb +++ b/app/views/dmsf_upload/upload_file.html.erb @@ -1,8 +1,11 @@ -<%# Redmine plugin for Document Management System "Features" +<% +# encoding: utf-8 # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2012 Daniel Munn -# Copyright (C) 2014 Karel Pičman +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2012 Daniel Munn +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff --git a/app/views/dmsf_upload/upload_files.html.erb b/app/views/dmsf_upload/upload_files.html.erb index 615e3f51..c5539e71 100644 --- a/app/views/dmsf_upload/upload_files.html.erb +++ b/app/views/dmsf_upload/upload_files.html.erb @@ -19,21 +19,23 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +%> -<% html_title(l(:dmsf)) %> +<% html_title l(:dmsf) %> -<%= render(:partial => '/dmsf/path', :locals => {:folder => @folder, :filename => nil}) %> +<%= render(:partial => '/dmsf/path', + :locals => {:folder => @folder, :filename => nil, :title => l(:heading_uploaded_files)}) %> -
- <%= textilizable(@folder.description) if @folder %> -
+<% if (@folder && @folder.description.present?) || @project.description.present? %> +
+ <%= textilizable(@folder ? @folder.description : @project.description) %> +
+<% end %> -

<%=l(:heading_uploaded_files)%>

-<% i = 1 %> <%= form_tag({:action => 'commit_files', :id => @project, :folder_id => @folder}, - :method=>:post) do %> - <% @uploads.each do |upload| %> + :method => :post) do %> + <% @uploads.each_with_index do |upload, i| %> <% if upload.locked %> <%= render(:partial => 'upload_file_locked', :locals => {:upload => upload, :i => i}) %> <% else %> @@ -41,5 +43,5 @@ <% end %> <% i += 1 %> <% end %> - <%= submit_tag(l(:submit_commit)) %> + <%= submit_tag l(:submit_commit) %> <% end %> \ No newline at end of file diff --git a/app/views/dmsf_workflows/_new_step_form.html.erb b/app/views/dmsf_workflows/_new_step_form.html.erb index 5157e57f..3e60cf75 100644 --- a/app/views/dmsf_workflows/_new_step_form.html.erb +++ b/app/views/dmsf_workflows/_new_step_form.html.erb @@ -1,8 +1,9 @@ <% # encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,7 +21,7 @@ %>
- <%=l(:label_dmsf_workflow_add_approver)%> + <%= l(:label_dmsf_workflow_add_approver) %>

<%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %>

<%= javascript_tag "observeSearchfield('user_search', 'users', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, :dmsf_workflow_step_assignment_id => nil, :dmsf_file_revision_id => nil, :project_id => @project ? @project.id : nil) }')" %> diff --git a/app/views/dmsf_workflows/_new_step_modal.html.erb b/app/views/dmsf_workflows/_new_step_modal.html.erb index 61ed2c36..059131d8 100644 --- a/app/views/dmsf_workflows/_new_step_modal.html.erb +++ b/app/views/dmsf_workflows/_new_step_modal.html.erb @@ -1,8 +1,9 @@ <% # encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -21,11 +22,11 @@

<%= l(:dmsf_new_step) %>

-<%= form_for(:dmsf_workflow, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %> +<%= labelled_form_for(@dmsf_workflow, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %> <%= render :partial => 'new_step_form' %>

- <%= submit_tag l(:dmsf_and), :id => 'add-step-and' %> - <%= submit_tag l(:dmsf_or), :id => 'add-step-or' %> - <%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %> + <%= f.submit l(:dmsf_and), :id => 'add-step-and' %> + <%= f.submit l(:dmsf_or), :id => 'add-step-or' %> + <%= f.submit l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>

<% end %> \ No newline at end of file diff --git a/app/views/dmsf_workflows/_steps.html.erb b/app/views/dmsf_workflows/_steps.html.erb index 7b993134..dd131443 100644 --- a/app/views/dmsf_workflows/_steps.html.erb +++ b/app/views/dmsf_workflows/_steps.html.erb @@ -1,8 +1,9 @@ <% # encoding: utf-8 +# # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,8 +28,11 @@ <%= labelled_form_for @dmsf_workflow do |f| %> <%= error_messages_for 'workflow' %> -
-

<%= f.text_field :name, :value => @dmsf_workflow.name, :required => true %><%= submit_tag l(:button_save) %>

+
+

+ <%= f.text_field :name, :required => true %> + <%= f.submit l(:button_save) %> +

<% end %> diff --git a/app/views/dmsf_workflows/new.html.erb b/app/views/dmsf_workflows/new.html.erb index 4f9e5bad..8e170668 100644 --- a/app/views/dmsf_workflows/new.html.erb +++ b/app/views/dmsf_workflows/new.html.erb @@ -1,6 +1,9 @@ -<%# Redmine plugin for Document Management System "Features" +<% +# encoding: utf-8 # -# Copyright (C) 2011-14 Karel Pičman +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -14,30 +17,30 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +%> <% project = Project.find_by_id params[:project_id] if params[:project_id] %> <% if project %> -

<%= link_to l(:label_dmsf_workflow_plural), settings_project_path(project, :tab => 'dmsf_workflow') %> » <%= l(:label_dmsf_workflow_new) %>

+

<%= link_to l(:label_dmsf_workflow_plural), settings_project_path(project, :tab => 'dmsf_workflow') %> » <%= l(:label_dmsf_workflow_new) %>

<% else %>

<%= link_to l(:label_dmsf_workflow_plural), dmsf_workflows_path %> » <%= l(:label_dmsf_workflow_new) %>

<% end %> -<%= labelled_form_for @dmsf_workflow do |f| %> +<%= labelled_form_for @dmsf_workflow do |f| %> + <%= f.hidden_field(:project_id) if project %> <%= error_messages_for 'dmsf_workflow' %>

- <%= f.text_field :name, :value => @dmsf_workflow.name, :size => 25, :maxlength => 255, :required => true %> + <%= f.text_field :name, :required => true %>

-

- <%= label_tag :label_copy_workflow_from, l(:label_copy_workflow_from) %> - <%= select_tag('dmsf_workflow_id', dmsf_all_workflows_for_select(params[:dmsf_workflow_id])) %> -

- <% if project %> -

<%= hidden_field_tag :project_id, project.id %>

- <% end %> +

+ <%= f.select(:id, + dmsf_all_workflows_for_select(params[:dmsf_workflow] ? params[:dmsf_workflow][:id] : nil), + :label => l(:label_copy_workflow_from)) %> +

- <%= submit_tag l(:button_create) %> + <%= f.submit l(:button_create) %> <% end %>