From 4934c8c801051e2b3bdfd91be65adea47f20094c Mon Sep 17 00:00:00 2001 From: zhanghaitao <562681745@qq.com> Date: Wed, 13 Aug 2014 15:37:28 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E9=A1=B5=E9=9D=A2=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stores_controller.rb | 6 +++++ app/models/issue.rb | 13 ++++----- app/views/stores/index.html.erb | 4 +-- app/views/welcome/contest.html.erb | 40 ++++++++++++++-------------- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index ae9336161..26ed51a59 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -5,12 +5,18 @@ class StoresController < ApplicationController layout 'base_stores' def search + begin q = "%#{params[:name].strip}%" (redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank? result = find_public_attache q @searched_attach = paginateHelper result @result_all_count = result.count; + rescue Exception => e + #render 'stores' + redirect_to stores_path + end + end def find_public_attache keywords diff --git a/app/models/issue.rb b/app/models/issue.rb index 1978f5405..f81665035 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -138,10 +138,10 @@ class Issue < ActiveRecord::Base nil when 'default' user_ids = [user.id] + user.groups.map(&:id) - "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" + "(#{table_name}.is_private = #{connection.quoted_false}) OR (#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" when 'own' user_ids = [user.id] + user.groups.map(&:id) - "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" + "(#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" else '1=0' end @@ -159,9 +159,9 @@ class Issue < ActiveRecord::Base when 'all' true when 'default' - !self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to)) - when 'own' - self.author == user || user.is_or_belongs_to?(assigned_to) + (!self.is_private? ||self.tracker == user) || (self.author == user || user.is_or_belongs_to?(assigned_to)) + when 'own' + self.tracker == user || self.author == user || user.is_or_belongs_to?(assigned_to) else false end @@ -1009,9 +1009,10 @@ class Issue < ActiveRecord::Base s << ' overdue' if overdue? s << ' child' if child? s << ' parent' unless leaf? - s << ' private' if is_private? + #s << ' private' if is_private? s << ' created-by-me' if User.current.logged? && author_id == User.current.id s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id + s << ' tracker-id' if User.current.logged? && tracker_id == User.current.id s end diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 8ad37f504..6984169d7 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -21,7 +21,7 @@ <% k.each do |c1|%>
<%= l(:label_no_ftapplication) %>
- + <% end %>