From bb7204846fff4a57a66c8a69eec9c761dd689767 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 May 2016 14:41:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E8=B5=84=E6=BA=90=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AE=9A=E5=88=B6=E6=A8=A1=E5=BC=8F6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 5 +- .../organizations/_org_custom_right3.html.erb | 233 +++++++++++------- 2 files changed, 146 insertions(+), 92 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 4a712c0f0..cd3322283 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -44,9 +44,8 @@ module OrganizationsHelper def get_attach_org2(field) org_attachments = field.attachments - attachments = User.current.admin? ? org_attachments : visable_attachemnts(org_attachments) - return attachments.sort_by{|x| x.created_on}.reverse.first(6) - # Attachment.find_by_sql("SELECT * FROM `attachments` where container_id =#{field_id} and container_type = 'OrgSubfield' and is_public =1 order by created_on limit 6;") + attachments = User.current.admin? ? org_attachments.first(5) : visable_attachemnts(org_attachments).first(5) + attachments.sort_by{|x| x.created_on}.reverse end # 从内容中获取路径 diff --git a/app/views/organizations/_org_custom_right3.html.erb b/app/views/organizations/_org_custom_right3.html.erb index 698a2ea25..c29097400 100644 --- a/app/views/organizations/_org_custom_right3.html.erb +++ b/app/views/organizations/_org_custom_right3.html.erb @@ -1,91 +1,146 @@ -
- -
-
    -
  • - -
    - 张晓华张晓华张晓华张晓华 -

    国防科学技术大学学技术大学学技术大学学技术大学学技术大学

    -
    -

    博客20 课程20学生 20

    -
    +<% if field.field_type == "Resource" %> +
    +

    <%= field.name %><%= link_to "更多", org_subfield_files_path(field), :target => "_blank", :class => "por_more_index fr" %>

    +
    +
      + <% get_attach_org2(field).each do |attach| %> +
    • + <%= link_to image_tag(url_to_avatar(attach.author),:width => "43", :height => "43", :class => "por_teachers_img fl mr15"), user_path(attach.author), :target => "_blank", :class => "fl" %> + +
      + <%= link_to attach.author, user_path(attach.author), :class => " por_teachers_name fl", :target => "_blank" %> +

      + <%= link_to truncate(attach.filename,length: 20, omission: '...'), + download_named_attachment_path(attach.id, attach.filename), + :title => attach.filename+"\n"+attach.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> +

      +
      +

      + 类型:<%= attach.tag_list[0] %> + 下载:<%= attach.downloads %> + 引用:<%= attach.quotes.nil? ? 0 : attach.quotes %> +

      +
      +
      +
    • + <% end %> +
    +
    +
    + +
    +
    +<% else %> +
    + +
    + -
    -
    - -
    -
    \ No newline at end of file +
+
+
+ +
+
+<% end %>