From 89f71ffa46df0a4f9fb92e4b2f4bf3bbf5f79b78 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 10 Jun 2015 15:19:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=9B=B8=E5=85=B3=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=90=8E=E7=9A=84=E4=B8=8B=E8=BD=BD=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=90=8E=E5=B0=B1=E7=9B=B4=E6=8E=A5=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E4=BA=86=EF=BC=8C=E4=B8=8D=E5=90=88=E9=80=82=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 +++--- app/views/files/_course_list.html.erb | 4 ++-- app/views/files/_project_file_list.html.erb | 4 ++-- app/views/stores/index.html.erb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index ec0480c19..c1e5af48a 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -79,9 +79,7 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - if params[:force] == 'true' - direct_download - else + if params[:preview] == 'true' convered_file = @attachment.diskfile #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化 unless pdf?(convered_file) @@ -96,6 +94,8 @@ class AttachmentsController < ApplicationController else direct_download end + else + direct_download end end else diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 1d5684d31..7f3e426fc 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -25,7 +25,7 @@ <% if file.is_public? || User.current.member_of_course?(course) %>
- <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),: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 (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> @@ -40,7 +40,7 @@ <% else %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <% end %> - <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %> + <%= link_to_attachment file, text: '下载', class: 'f_l re_open' %> <% else %> <% end %>
diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index a5152ecdc..81b69d754 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -18,7 +18,7 @@ <% project_attachments.each do |file| %>
- <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :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" %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),: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) %> <%= 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) %> @@ -30,7 +30,7 @@ <% else %> <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <% end %> - <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %> + <%= link_to_attachment file, text: '下载', class: 'f_l re_open' %> <% end %>
diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 6fab364b5..84116a561 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -35,7 +35,7 @@ <%= c1.downloads %>
- <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%> + <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>c
<% end -%>