From d70df6a89d332d11ad97b3bda94062a7842e38e9 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Mar 2016 17:41:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=85=AC=E5=BC=80=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=EF=BC=8C=E9=9D=9E=E6=88=90=E5=91=98?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=9C=8B=E5=88=B0=E7=A7=81=E6=9C=89=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_org_subfield_list.html.erb | 120 ++++++++++---------- 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index 641029bf2..90ae3516d 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -1,70 +1,72 @@ <% delete_allowed = User.current.admin? %> <% org_subfield_attachments.each do |file| %> -
-
-
- <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> -
-
-
- <%= link_to file.is_public? ? truncate(file.filename, length: 70) : truncate(file.filename,length: 50, 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 => "linkGrey3 f_14 f_l" %> - <%= file_preview_eye(file, class: 'preview') %> - - <% if file.is_public? == false%> - 私有 - <%end %> - -
-
-
- 上传时间:<%= format_date(file.created_on)%> - <% if file.tag_list.length > 0%> - 上传类型:<%= file.tag_list[0] %> - <% end %> -

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

-

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

-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> -
-
-
    -
  • - <% if User.current.logged? %> - <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %> -
      -
    • <%= 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 %>
    • -
    • - - <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> - -
    • -
    • - <%= link_to( '删除资源', attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %> -
    • -
    - <%else%> -
      -
    • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • -
    - <% end %> + <% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) %> +
    +
    +
    + <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> +
    +
    +
    + <%= link_to file.is_public? ? truncate(file.filename, length: 70) : truncate(file.filename,length: 50, 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 => "linkGrey3 f_14 f_l" %> + <%= file_preview_eye(file, class: 'preview') %> + + <% if file.is_public? == false%> + 私有 + <%end %> + +
    +
    +
    + 上传时间:<%= format_date(file.created_on)%> + <% if file.tag_list.length > 0%> + 上传类型:<%= file.tag_list[0] %> <% end %> -
  • -
+

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

+

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

+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %> +
+
+
    +
  • + <% if User.current.logged? %> + <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %> +
      +
    • <%= 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 %>
    • +
    • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
    • +
    • + <%= link_to( '删除资源', attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %> +
    • +
    + <%else%> +
      +
    • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
    • +
    + <% end %> + <% end %> +
  • +
+
+
+
-
-
- + <% end %> <% end %> <% if org_subfield_attachments.count == 10 %> From c3eb8e05cd10706b87602fc96141c594972f35b7 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Mar 2016 18:12:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=9A=84=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=B5=84=E6=BA=90=EF=BC=8C=E6=95=B0=E9=87=8F=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/files_helper.rb | 2 +- app/views/files/_subfield_files.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 6b748649b..238999a71 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -126,7 +126,7 @@ module FilesHelper (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))|| (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)|| attachment.author_id == User.current.id || - attachment.container_type == "OrgSubfield" + (attachment.container_type == "OrgSubfield" and User.current.member_of_org?(attachment.container.organization)) result << attachment end end diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index 6531aa96b..7fb9e2e0a 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -54,7 +54,7 @@ <%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
-

共有 <%= @all_attachments.count %> 个资源

+

共有 <%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.count %> 个资源

<% if @order == "asc" %> 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /