##// END OF EJS Templates
[#20288] Update styles to match CodeRay 1.1.0 (preserving changes of r10132)....
[#20288] Update styles to match CodeRay 1.1.0 (preserving changes of r10132). This commit updates the CSS styles to match with CodeRay 1.1.0, while it preserves the custom changes applied in r10132. The CSS styles were still based on CodeRay 1.0.6 (included since Redmine 1.4.0) with the custom changes from r10132 (included since Redmine 2.1.0). Redmine 2.3.2 till 2.3.4 came with CodeRay 1.0.9, an upgrade that didn't needed changes in the CSS styles. Starting with 2.4.0 Redmine comes with CodeRay 1.1.0, a minor upgrade that came with new/changed token_kinds and lots of changes in the alpha stylesheet, that in turn is used as a base for Redmine's own CodeRay CSS styles. As such, this upgrade needed CSS stylesheet changes like done before in r7618 and r7623 (for 1.0.0 upgrade) and r9389 (for 1.0.6 upgrade). But these changes, plus an update of the Redmine core documentation that is shipped along the core (wiki_syntax_detailed_[markdown|textile].html), aren't integrated up untill today. Contributed by Mischa The Evil. git-svn-id: http://svn.redmine.org/redmine/trunk@14488 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r13490:000124f44f53
r14106:6fbb56e55735
Show More
enumeration.rb
142 lines | 3.9 KiB | text/x-ruby | RubyLexer
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r13490 # Copyright (C) 2006-2015 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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.
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381 #
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 # 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.
class Enumeration < ActiveRecord::Base
Jean-Philippe Lang
Resourcified enumerations....
r8069 include Redmine::SubclassFactory
Jean-Philippe Lang
Fixed SQL errors with SQLServer (column specified more than once in the order by list) after r13526....
r13145 default_scope lambda {order(:position)}
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Eric Davis
Added project specific Enumeration overrides....
r2833 belongs_to :project
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 acts_as_list :scope => 'type = \'#{type}\''
Eric Davis
Enumerations can now have custom fields defined on them. #4077...
r2831 acts_as_customizable
Jean-Philippe Lang
Removed ORDER option on acts_as_tree that duplicates default_scope....
r13146 acts_as_tree
Jean-Philippe Lang
Added position on Enumeration model....
r789
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 before_destroy :check_integrity
Toshi MARUYAMA
Rails3: model: replace deprecated 'before_save' method at Enumeration model...
r7307 before_save :check_default
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
Resourcified enumerations....
r8069 attr_protected :type
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 validates_presence_of :name
Eric Davis
Added a Activities tab to Project Settings...
r2835 validates_uniqueness_of :name, :scope => [:type, :project_id]
Jean-Philippe Lang
Added several validates_length_of...
r590 validates_length_of :name, :maximum => 30
Jean-Philippe Lang
Added position on Enumeration model....
r789
Jean-Baptiste Barth
Use lambda form in model scopes (#12499)...
r10722 scope :shared, lambda { where(:project_id => nil) }
Jean-Philippe Lang
Order scopes cleanup....
r13144 scope :sorted, lambda { order(:position) }
Jean-Baptiste Barth
Use lambda form in model scopes (#12499)...
r10722 scope :active, lambda { where(:active => true) }
Jean-Philippe Lang
Propose system activities only when reassigning time entries (#13783)....
r11532 scope :system, lambda { where(:project_id => nil) }
Jean-Philippe Lang
Code cleanup....
r9530 scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
Eric Davis
Added an active field track if an Enumeration is active on the frontend view....
r2832
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 def self.default
# Creates a fake default scope so Enumeration.default will check
# it's type. STI subclasses will automatically add their own
# types to the finder.
if self.descends_from_active_record?
Jean-Philippe Lang
Code cleanup....
r9530 where(:is_default => true, :type => 'Enumeration').first
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 else
# STI classes are
Jean-Philippe Lang
Code cleanup....
r9530 where(:is_default => true).first
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 # Overloaded on concrete classes
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 def option_name
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 nil
end
Jean-Philippe Lang
Added default value for enumerations....
r792
Toshi MARUYAMA
Rails3: model: replace deprecated 'before_save' method at Enumeration model...
r7307 def check_default
Jean-Philippe Lang
Fixed: default flag removed when editing a default enumeration (#2327)....
r2121 if is_default? && is_default_changed?
Toshi MARUYAMA
Rails4: replace deprecated Relation#update_all at Enumeration model...
r12235 Enumeration.where({:type => type}).update_all({:is_default => false})
Jean-Philippe Lang
Fixed: default flag removed when editing a default enumeration (#2327)....
r2121 end
Jean-Philippe Lang
Added default value for enumerations....
r792 end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 # Overloaded on concrete classes
Jean-Philippe Lang
Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value (#1467)....
r1544 def objects_count
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 0
Jean-Philippe Lang
Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value (#1467)....
r1544 end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value (#1467)....
r1544 def in_use?
self.objects_count != 0
end
Eric Davis
Added project specific Enumeration overrides....
r2833
Toshi MARUYAMA
fix typos of source comments at Enumeration model...
r12797 # Is this enumeration overriding a system level enumeration?
Eric Davis
Added project specific Enumeration overrides....
r2833 def is_override?
!self.parent.nil?
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value (#1467)....
r1544 alias :destroy_without_reassign :destroy
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value (#1467)....
r1544 # Destroy the enumeration
# If a enumeration is specified, objects are reassigned
def destroy(reassign_to = nil)
if reassign_to && reassign_to.is_a?(Enumeration)
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 self.transfer_relations(reassign_to)
Jean-Philippe Lang
Ability to remove enumerations (activities, priorities, document categories) that are in use. Associated objects can be reassigned to another value (#1467)....
r1544 end
destroy_without_reassign
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
Added radio buttons on the documents list to sort documents by category, date, title or author....
r866 def <=>(enumeration)
position <=> enumeration.position
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
Added the ability to customize columns of a saved query....
r771 def to_s; name end
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677
# Returns the Subclasses of Enumeration. Each Subclass needs to be
# required in development mode.
#
# Note: subclasses is protected in ActiveRecord
def self.get_subclasses
Jean-Philippe Lang
Use subclasses method instead of class variable....
r8857 subclasses
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677 end
Eric Davis
Added a Activities tab to Project Settings...
r2835
# Does the +new+ Hash override the previous Enumeration?
Toshi MARUYAMA
fix typo of Enumeration#overridding_change?...
r12781 def self.overriding_change?(new, previous)
Eric Davis
Added a Activities tab to Project Settings...
r2835 if (same_active_state?(new['active'], previous.active)) && same_custom_values?(new,previous)
return false
else
return true
end
end
# Does the +new+ Hash have the same custom values as the previous Enumeration?
def self.same_custom_values?(new, previous)
previous.custom_field_values.each do |custom_value|
if custom_value.value != new["custom_field_values"][custom_value.custom_field_id.to_s]
return false
end
end
return true
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Eric Davis
Added a Activities tab to Project Settings...
r2835 # Are the new and previous fields equal?
def self.same_active_state?(new, previous)
new = (new == "1" ? true : false)
return new == previous
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/enumeration.rb....
r6381
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 private
def check_integrity
Jean-Philippe Lang
Replaced "can't" with "cannot" in error messages....
r13399 raise "Cannot delete enumeration" if self.in_use?
Jean-Philippe Lang
Initial commit...
r2 end
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677
Jean-Philippe Lang
Initial commit...
r2 end
Eric Davis
Changed Enumerations to use a Single Table Inheritance...
r2677
# Force load the subclasses in development mode
require_dependency 'time_entry_activity'
require_dependency 'document_category'
require_dependency 'issue_priority'