From 6c09656467c6a86ccb36fa2a1e024be51d5d27dd Mon Sep 17 00:00:00 2001 From: Daniel Munn Date: Sun, 3 Jun 2012 12:37:50 +0100 Subject: [PATCH] Updating routes to integrate with projects (more appropriately), dmsf_state and settings html updated --- app/controllers/dmsf_state_controller.rb | 4 ++-- app/views/dmsf_files_copy/new.html.erb | 4 ++-- app/views/dmsf_state/_user_pref.html.erb | 6 +++--- app/views/settings/_dmsf_settings.erb | 6 +++--- config/routes.rb | 25 ++++++++++++------------ 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index 5f4a15fa..4eecd4a2 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -24,9 +24,9 @@ class DmsfStateController < ApplicationController before_filter :find_project before_filter :authorize - verify :method => :post, :only => [:user_pref_save], :render => { :nothing => true, :status => :method_not_allowed } +# verify :method => :post, :only => [:user_pref_save], :render => { :nothing => true, :status => :method_not_allowed } - helper :all + helper :all def user_pref_save member = @project.members.find(:first, :conditions => {:user_id => User.current.id}) diff --git a/app/views/dmsf_files_copy/new.html.erb b/app/views/dmsf_files_copy/new.html.erb index 522649c9..b37865bc 100644 --- a/app/views/dmsf_files_copy/new.html.erb +++ b/app/views/dmsf_files_copy/new.html.erb @@ -11,8 +11,8 @@ <%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) if @file.notification %> -<% unless DmsfFile.allowed_target_projects_on_copy.blank? - form_tag({:action => "create", :id => @file}, :id => "copyForm") do |f| %> +<% unless DmsfFile.allowed_target_projects_on_copy.blank? %> + <%= form_tag({:action => "create", :id => @file}, :id => "copyForm") do |f| %>

diff --git a/app/views/dmsf_state/_user_pref.html.erb b/app/views/dmsf_state/_user_pref.html.erb index 80747fdc..b4cf8672 100644 --- a/app/views/dmsf_state/_user_pref.html.erb +++ b/app/views/dmsf_state/_user_pref.html.erb @@ -14,9 +14,9 @@ :selected => mail_notification)) %> <%= submit_tag(l(:submit_save), :title => l(:title_save_preferences)) %>

- <% end %> - - <% form_for :project, @project, :url => project_path(@project), :html => {:method=>:post} do %> + <% end %> + + <%= form_for @project, :url => project_path(@project), :html => {:method=>:post} do %> <% custom_fields = DmsfFileRevisionCustomField.find(:all) %> <% unless custom_fields.empty? %>
<%=l(:label_custom_field_plural)%> diff --git a/app/views/settings/_dmsf_settings.erb b/app/views/settings/_dmsf_settings.erb index 58c4dccc..b7972aef 100644 --- a/app/views/settings/_dmsf_settings.erb +++ b/app/views/settings/_dmsf_settings.erb @@ -26,10 +26,10 @@ <%=content_tag(:label, l(:label_file_storage_directory) + ":") %> <% storage_dir = @settings["dmsf_storage_directory"].strip - storage_dir = "#{RAILS_ROOT}/files/dmsf" if storage_dir.blank? + storage_dir = "#{Rails.root}/files/dmsf" if storage_dir.blank? %> <%=text_field_tag "settings[dmsf_storage_directory]", storage_dir, :size=>50 %>
- (<%=l(:label_default)%>: <%="#{RAILS_ROOT}/files/dmsf"%>) + (<%=l(:label_default)%>: <%="#{Rails.root}/files/dmsf"%>)

<% unless File.exists?(storage_dir) begin @@ -93,7 +93,7 @@

<%=content_tag(:label, l(:label_index_database) + ":") %> <%=text_field_tag 'settings[dmsf_index_database]', @settings['dmsf_index_database'], :disabled => xapian_disabled, :size=>50 %>
- (<%=l(:label_default)%>: <%="#{RAILS_ROOT}/files/dmsf_index"%>) + (<%=l(:label_default)%>: <%="#{Rails.root}/files/dmsf_index"%>)

diff --git a/config/routes.rb b/config/routes.rb index ba5f5f39..5a20af4a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,16 +16,18 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#ActionController::Routing::Routes.draw do |map| RedmineApp::Application.routes.draw do -# map.resources :dmsf -# map.resources :dmsf_files resources :dmsf -# resources :dmsf_files - post '/dmsf/:id/upload/files', :controller => 'dmsf_upload', :action => 'upload_files' - post '/dmsf/:id/upload/file', :controller => 'dmsf_upload', :action => 'upload_file' - post '/dmsf/:id/upload/commit', :controller => 'dmsf_upload', :action => 'commit_files' + #/projects//dmsf/state - dmsf_state controller + post '/projects/:id/dmsf/state', :controller => 'dmsf_state', :action => 'user_pref_save' + + + #/projects//dmsf/upload - dmsf_upload controller + + post '/projects/:id/dmsf/upload/files', :controller => 'dmsf_upload', :action => 'upload_files' + post '/projects/:id/dmsf/upload/file', :controller => 'dmsf_upload', :action => 'upload_file' + post '/projects/:id/dmsf/upload/commit', :controller => 'dmsf_upload', :action => 'commit_files' #/dmsf/files - dmsf_files controller post '/dmsf/files/:id/notify/activate', :controller => 'dmsf_files', :action => 'notify_activate' @@ -34,18 +36,17 @@ RedmineApp::Application.routes.draw do post '/dmsf/files/:id/unlock', :controller => 'dmsf_files', :action => 'unlock' post '/dmsf/files/:id/delete', :controller => 'dmsf_files', :action => 'delete' post '/dmsf/files/:id/revision/create', :controller => 'dmsf_files', :action => 'create_revision' - post '/dmsf/files/revision/:id/delete', :controller => 'dmsf_files', :action => 'delete_revision' + post '/dmsf/files/:id/revision/delete', :controller => 'dmsf_files', :action => 'delete_revision' - get '/dmsf/files/:id/download', :controller => 'dmsf_files', :action => 'show', :download => '' - get '/dmsf/files/:id/revision/:download/download', :controller => 'dmsf_files', :action => 'show', :download => /\d*/ + get '/dmsf/files/:id/download', :controller => 'dmsf_files', :action => 'show' get '/dmsf/files/:id', :controller => 'dmsf_files', :action => 'show' -# post '/dmsf/files/:id/revision/delete' # # files_copy controller ## -##### POST :create, :move + post '/dmsf/files/:id/copy/create', :controller => 'dmsf_files_copy', :action => 'create' + post '/dmsf/files/:id/copy/move', :controller => 'dmsf_files_copy', :action => 'move' get '/dmsf/files/:id/copy', :controller => 'dmsf_files_copy', :action => 'new' end