diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 7318a4dc2..54babdd64 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -26,7 +26,7 @@ class FilesController < ApplicationController
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
- :search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description]
+ :search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description, :edit_file_description]
helper :sort
include SortHelper
@@ -981,6 +981,13 @@ class FilesController < ApplicationController
def upload_files_menu
end
+
+ def edit_file_description
+ @attachment = Attachment.find(params[:id])
+ @attachment.description = params[:file_description_edit]
+ @attachment.save
+ end
+
def update_file_description
@attachment = Attachment.find(params[:id])
@attachment.description = params[:description]
diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb
index de37ed054..45aa7095b 100644
--- a/app/views/files/_org_subfield_list.html.erb
+++ b/app/views/files/_org_subfield_list.html.erb
@@ -43,8 +43,10 @@
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
-
+ <%= form_tag(edit_file_description_org_subfield_file_path(file, :org_subfield_id => org_subfield.id ),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
+
+ <% end %>
<% else %>
@@ -108,3 +110,8 @@
<%end%>
<% end%>
+
\ No newline at end of file
diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb
index faf254015..3193f4b42 100644
--- a/app/views/files/_project_list.html.erb
+++ b/app/views/files/_project_list.html.erb
@@ -40,8 +40,10 @@
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
-
+ <%= form_tag(edit_file_description_project_file_path(file, :project_id => project.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
+
+ <% end %>
<% else %>
@@ -70,6 +72,11 @@
<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
+
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
index b60814afd..08b85ab2f 100644
--- a/app/views/files/_resource_detail.html.erb
+++ b/app/views/files/_resource_detail.html.erb
@@ -42,8 +42,10 @@
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
-
+ <%= form_tag(edit_file_description_course_file_path(file, :course_id => @course.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
+
+ <% end %>
<% else %>
@@ -99,4 +101,9 @@
-
\ No newline at end of file
+
+
diff --git a/app/views/files/edit_file_description.js.erb b/app/views/files/edit_file_description.js.erb
new file mode 100644
index 000000000..40b47a2ec
--- /dev/null
+++ b/app/views/files/edit_file_description.js.erb
@@ -0,0 +1,3 @@
+$("#file_description_show_<%= @attachment.id %>").html("<%= escape_javascript render(:partial => "files/file_description", :locals => {:file => @attachment}) %>");
+$("#file_description_show_<%= @attachment.id %>").show();
+$("#file_description_edit_<%= @attachment.id %>").hide();
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 4ff75cbf9..7ca24d861 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -133,6 +133,7 @@ RedmineApp::Application.routes.draw do
member do
match "quote_resource_show_org_subfield", :via => [:get]
get "update_file_description"
+ post "edit_file_description"
end
end
@@ -809,6 +810,7 @@ RedmineApp::Application.routes.draw do
match "quote_resource_show", :via => [:get]
get "file_hidden"
get "update_file_description"
+ post "edit_file_description"
end
end
@@ -1219,6 +1221,7 @@ RedmineApp::Application.routes.draw do
get "file_hidden"
post "republish_file"
get "update_file_description"
+ post "edit_file_description"
end
end
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do