From 18054dd96d01c9f3f4cfb5f41cb2f55f4f1e96e4 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 20 May 2016 17:04:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=81=E6=9C=89=E8=B5=84=E6=BA=90=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 ++-- app/views/users/_resources_list.html.erb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 15d731634..52fdad2e7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2705,7 +2705,7 @@ class UsersController < ApplicationController # 获取公共资源搜索 def get_public_resources_search user_course_ids, user_project_ids, order, score, search - attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的资源 @@ -2816,7 +2816,7 @@ class UsersController < ApplicationController # 获取我的用户类型资源 def get_principal_resources_public order, score - attchments = Attachment.where("container_type = 'Principal'and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("container_type = 'Principal' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的用户类型资源 diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 038a48c30..46a69f985 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -14,7 +14,11 @@
  • - <%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %> + <% if attach.is_public == 0 && attach.get_apply_resource_status(attach.id, attach.author_id) != 2 %> + + <% else %> + <%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %> + <% end %> <% if attach.is_public == 0 && (@type == "6" || @type == "2") && attach.author != User.current %> 私有 <% end %>