]> source.dussan.org Git - redmine.git/commitdiff
remove trailing white-spaces from vendor/plugins/acts_as_searchable/lib/acts_as_searc...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 2 Apr 2012 13:50:12 +0000 (13:50 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 2 Apr 2012 13:50:12 +0000 (13:50 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9305 e93f8b46-1217-0410-a6f0-8f06a7374b81

vendor/plugins/acts_as_searchable/lib/acts_as_searchable.rb

index 1af226ae47a33b3c31b35c29187ec331ec60a961..ff9d2d507cc6123b9c0bec7f97fac3a818d79783 100644 (file)
@@ -1,16 +1,16 @@
 # Redmine - project management software
-# Copyright (C) 2006-2011  Jean-Philippe Lang
+# Copyright (C) 2006-2012  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; either version 2
 # of the License, or (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
@@ -18,9 +18,9 @@
 module Redmine
   module Acts
     module Searchable
-      def self.included(base) 
+      def self.included(base)
         base.extend ClassMethods
-      end 
+      end
 
       module ClassMethods
         # Options:
@@ -31,7 +31,7 @@ module Redmine
         # * :permission - permission required to search the model (default to :view_"objects")
         def acts_as_searchable(options = {})
           return if self.included_modules.include?(Redmine::Acts::Searchable::InstanceMethods)
-  
+
           cattr_accessor :searchable_options
           self.searchable_options = options
 
@@ -44,10 +44,10 @@ module Redmine
           searchable_options[:project_key] ||= "#{table_name}.project_id"
           searchable_options[:date_column] ||= "#{table_name}.created_on"
           searchable_options[:order_column] ||= searchable_options[:date_column]
-          
+
           # Should we search custom fields on this model ?
           searchable_options[:search_custom_fields] = !reflect_on_association(:custom_values).nil?
-          
+
           send :include, Redmine::Acts::Searchable::InstanceMethods
         end
       end
@@ -71,21 +71,21 @@ module Redmine
             user = User.current
             tokens = [] << tokens unless tokens.is_a?(Array)
             projects = [] << projects unless projects.nil? || projects.is_a?(Array)
-            
+
             find_options = {:include => searchable_options[:include]}
             find_options[:order] = "#{searchable_options[:order_column]} " + (options[:before] ? 'DESC' : 'ASC')
-            
+
             limit_options = {}
             limit_options[:limit] = options[:limit] if options[:limit]
             if options[:offset]
               limit_options[:conditions] = "(#{searchable_options[:date_column]} " + (options[:before] ? '<' : '>') + "'#{connection.quoted_date(options[:offset])}')"
             end
-            
+
             columns = searchable_options[:columns]
             columns = columns[0..0] if options[:titles_only]
-            
+
             token_clauses = columns.collect {|column| "(LOWER(#{column}) LIKE ?)"}
-            
+
             if !options[:titles_only] && searchable_options[:search_custom_fields]
               searchable_custom_field_ids = CustomField.find(:all,
                                                              :select => 'id',
@@ -98,11 +98,11 @@ module Redmine
                 token_clauses << custom_field_sql
               end
             end
-            
+
             sql = (['(' + token_clauses.join(' OR ') + ')'] * tokens.size).join(options[:all_words] ? ' AND ' : ' OR ')
-            
+
             find_options[:conditions] = [sql, * (tokens.collect {|w| "%#{w.downcase}%"} * token_clauses.size).sort]
-            
+
             scope = self
             project_conditions = []
             if searchable_options.has_key?(:permission)
@@ -116,7 +116,7 @@ module Redmine
             # TODO: use visible scope options instead
             project_conditions << "#{searchable_options[:project_key]} IN (#{projects.collect(&:id).join(',')})" unless projects.nil?
             project_conditions = project_conditions.empty? ? nil : project_conditions.join(' AND ')
-            
+
             results = []
             results_count = 0