diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index ac78b5a22..8225697d2 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -6,19 +6,24 @@ class StoresController < ApplicationController def search name = params[:name] ||= '' - redirect_to stores_path, :notice => l(:field_course_un) if name.blank? + (redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if name.blank? # 按文件名搜索 - result = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{name}%"). + resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{name}%"). reorder("created_on DESC") - # result = result.to_a - result.map { |res| + + result = resultSet.to_a.dup + + resultSet.to_a.map { |res| if(res.container.nil? || (res.container.class.to_s=="Project" && res.container.is_public == false) || (res.container.has_attribute?(:project) && res.container.project.is_public == false) || (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) || false ) + # logger.debug("=====================================#{result.include? res}") + # logger.debug("=====================================#{res}") result.delete(res) + # logger.debug("=====================================#{result.include? res}") end } @searched_attach = paginateHelper result diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 17eec7392..5eb34dc99 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -77,7 +77,7 @@ <% else %> <%= join_in_course(@project, User.current) %> - <% end %> 1111 + <% end %> <% unless User.current.member_of?(@project) %>
<%=t(:label_course_file)%> | +<%=t(:label_stores_index)%> | <%= l(:label_user_location) %> : | |
<%= link_to stores_url , stores_url %> | -<%=link_to l(:label_home),home_path %> > <%=link_to l(:label_course_file),stores_url %> |
+ <%=link_to l(:label_home),home_path %> > <%=link_to l(:label_stores_index),stores_url %> |