From 70a762220a9dcd3e393126b5b679df53613674d1 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Thu, 16 Jun 2016 16:55:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E4=BF=AE=E6=94=B9=E5=8F=8A=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=97=B6=E5=80=99=E6=B7=BB=E5=8A=A0=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=EF=BC=8C=E5=B9=B6=E4=B8=94=E6=89=80=E6=9C=89=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=AF=B9=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=BC=80=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 4 ++++ app/views/files/_org_subfield_list.html.erb | 19 ++++++++++++++++++ app/views/files/_project_file_list.html.erb | 20 +++++++++++++++++-- app/views/files/_project_list.html.erb | 16 +++++++++++++++ app/views/files/_resource_detail.html.erb | 8 ++++---- app/views/files/_tool_settings.html.erb | 6 +++--- app/views/files/_upload_project_files.erb | 7 +++++++ .../files/_upload_subfield_file.html.erb | 7 +++++++ config/routes.rb | 2 ++ 9 files changed, 80 insertions(+), 9 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1c05399c4..f06725d01 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -483,6 +483,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end @@ -493,6 +494,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end @@ -600,6 +602,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end @@ -610,6 +613,7 @@ class FilesController < ApplicationController if !attachments.empty? && attachments[:files] && tag_name != "" attachments[:files].each do |attachment| attachment.tag_list.add(tag_name) + attachment.description = params[:description] attachment.save end end diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index a3337b1ce..2b0dce4fa 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -36,6 +36,25 @@

文件大小:<%= number_to_human_size(file.filesize) %>

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+
+ + <% if User.current.logged? && ((delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" )%> +
+
+ <%= render :partial => 'files/file_description', :locals => {:file => file} %> +
+ +
+ <% else %> +
+ <% unless file.description.blank? %> +
+
资源描述:<%= file.description %>
+ <% end %> +
+ <% end %> +
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index 6dc5b6753..b8b38f7b9 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -21,8 +21,8 @@ <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> - <% if User.current.logged? %> - <% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %> + <% if User.current.logged? || User.current.admin? %> + <% if ((manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file)) || User.current.admin? %> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <% if authority_pubilic_for_files(project, file) && delete_allowed %> @@ -43,6 +43,22 @@

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+ <% if User.current.admin? || ( User.current.logged? && ( (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file))) %> +
+
+ <%= render :partial => 'files/file_description', :locals => {:file => file} %> +
+ +
+ <% else %> +
+ <% unless file.description.blank? %> +
+
资源描述:<%= file.description %>
+ <% end %> +
+ <% end %>
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb index 831dc0e68..48fb4c86f 100644 --- a/app/views/files/_project_list.html.erb +++ b/app/views/files/_project_list.html.erb @@ -35,6 +35,22 @@

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+ <% if User.current.admin? || (User.current.logged? && ( (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project")) %> +
+
+ <%= render :partial => 'files/file_description', :locals => {:file => file} %> +
+ +
+ <% else %> +
+ <% unless file.description.blank? %> +
+
资源描述:<%= file.description %>
+ <% end %> +
+ <% end %>
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb index e7d43a9d4..8aedc3c03 100644 --- a/app/views/files/_resource_detail.html.erb +++ b/app/views/files/_resource_detail.html.erb @@ -37,7 +37,7 @@
<%# unless file.description.blank? %>
- <% if User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %> + <% if User.current.admin? || ( User.current.logged? && ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) && ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course")) %>
<%= render :partial => 'files/file_description', :locals => {:file => file} %> @@ -63,9 +63,9 @@
  • - <% if User.current.logged? %> - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %> + <% if User.current.logged? || User.current.admin? %> + <% if User.current.admin? || ((is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file)) %> + <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course") %>
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • <%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
    • diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index 41d74b7df..a0ce42eac 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -1,8 +1,8 @@
      • - <% if User.current.logged? %> - <% if (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file) %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %> + <% if User.current.admin? || (User.current.logged? ) %> + <% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %> + <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
        • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
        • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
        • diff --git a/app/views/files/_upload_project_files.erb b/app/views/files/_upload_project_files.erb index ed68e3b2d..478297af5 100644 --- a/app/views/files/_upload_project_files.erb +++ b/app/views/files/_upload_project_files.erb @@ -22,6 +22,13 @@ <%= render :partial => 'files/new_style_attachment_list',:locals => {:container => project} %>
+
+ +
+ +
+
+
<%= l(:button_cancel)%> diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb index 3f8f1359a..8dcfe2dd5 100644 --- a/app/views/files/_upload_subfield_file.html.erb +++ b/app/views/files/_upload_subfield_file.html.erb @@ -16,6 +16,13 @@ <%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org_subfield}%>
+
+ +
+ +
+
+
<%= l(:button_cancel)%> <%= l(:button_confirm)%> <% end %> diff --git a/config/routes.rb b/config/routes.rb index a778a8016..10c3cb870 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -130,6 +130,7 @@ RedmineApp::Application.routes.draw do end member do match "quote_resource_show_org_subfield", :via => [:get] + get "update_file_description" end end @@ -779,6 +780,7 @@ RedmineApp::Application.routes.draw do member do match "quote_resource_show", :via => [:get] get "file_hidden" + get "update_file_description" end end