@@ -1,61 +1,61 | |||||
1 | # Be sure to restart your web server when you modify this file. |
|
1 | # Be sure to restart your web server when you modify this file. | |
2 |
|
2 | |||
3 | # Uncomment below to force Rails into production mode when |
|
3 | # Uncomment below to force Rails into production mode when | |
4 | # you don't control web/app server and can't set it the proper way |
|
4 | # you don't control web/app server and can't set it the proper way | |
5 | # ENV['RAILS_ENV'] ||= 'production' |
|
5 | # ENV['RAILS_ENV'] ||= 'production' | |
6 |
|
6 | |||
7 | # Specifies gem version of Rails to use when vendor/rails is not present |
|
7 | # Specifies gem version of Rails to use when vendor/rails is not present | |
8 |
RAILS_GEM_VERSION = '2.3. |
|
8 | RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION | |
9 |
|
9 | |||
10 | # Bootstrap the Rails environment, frameworks, and default configuration |
|
10 | # Bootstrap the Rails environment, frameworks, and default configuration | |
11 | require File.join(File.dirname(__FILE__), 'boot') |
|
11 | require File.join(File.dirname(__FILE__), 'boot') | |
12 |
|
12 | |||
13 | # Load Engine plugin if available |
|
13 | # Load Engine plugin if available | |
14 | begin |
|
14 | begin | |
15 | require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') |
|
15 | require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') | |
16 | rescue LoadError |
|
16 | rescue LoadError | |
17 | # Not available |
|
17 | # Not available | |
18 | end |
|
18 | end | |
19 |
|
19 | |||
20 | Rails::Initializer.run do |config| |
|
20 | Rails::Initializer.run do |config| | |
21 | # Settings in config/environments/* take precedence those specified here |
|
21 | # Settings in config/environments/* take precedence those specified here | |
22 |
|
22 | |||
23 | # Skip frameworks you're not going to use |
|
23 | # Skip frameworks you're not going to use | |
24 | # config.frameworks -= [ :action_web_service, :action_mailer ] |
|
24 | # config.frameworks -= [ :action_web_service, :action_mailer ] | |
25 |
|
25 | |||
26 | # Add additional load paths for sweepers |
|
26 | # Add additional load paths for sweepers | |
27 | config.load_paths += %W( #{RAILS_ROOT}/app/sweepers ) |
|
27 | config.autoload_paths += %W( #{RAILS_ROOT}/app/sweepers ) | |
28 |
|
28 | |||
29 | # Force all environments to use the same logger level |
|
29 | # Force all environments to use the same logger level | |
30 | # (by default production uses :info, the others :debug) |
|
30 | # (by default production uses :info, the others :debug) | |
31 | # config.log_level = :debug |
|
31 | # config.log_level = :debug | |
32 |
|
32 | |||
33 | # Enable page/fragment caching by setting a file-based store |
|
33 | # Enable page/fragment caching by setting a file-based store | |
34 | # (remember to create the caching directory and make it readable to the application) |
|
34 | # (remember to create the caching directory and make it readable to the application) | |
35 | # config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache" |
|
35 | # config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache" | |
36 |
|
36 | |||
37 | # Activate observers that should always be running |
|
37 | # Activate observers that should always be running | |
38 | # config.active_record.observers = :cacher, :garbage_collector |
|
38 | # config.active_record.observers = :cacher, :garbage_collector | |
39 | config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer |
|
39 | config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer | |
40 |
|
40 | |||
41 | # Make Active Record use UTC-base instead of local time |
|
41 | # Make Active Record use UTC-base instead of local time | |
42 | # config.active_record.default_timezone = :utc |
|
42 | # config.active_record.default_timezone = :utc | |
43 |
|
43 | |||
44 | # Use Active Record's schema dumper instead of SQL when creating the test database |
|
44 | # Use Active Record's schema dumper instead of SQL when creating the test database | |
45 | # (enables use of different database adapters for development and test environments) |
|
45 | # (enables use of different database adapters for development and test environments) | |
46 | # config.active_record.schema_format = :ruby |
|
46 | # config.active_record.schema_format = :ruby | |
47 |
|
47 | |||
48 | # Deliveries are disabled by default. Do NOT modify this section. |
|
48 | # Deliveries are disabled by default. Do NOT modify this section. | |
49 | # Define your email configuration in configuration.yml instead. |
|
49 | # Define your email configuration in configuration.yml instead. | |
50 | # It will automatically turn deliveries on |
|
50 | # It will automatically turn deliveries on | |
51 | config.action_mailer.perform_deliveries = false |
|
51 | config.action_mailer.perform_deliveries = false | |
52 |
|
52 | |||
53 | config.gem 'rubytree', :lib => 'tree' |
|
53 | config.gem 'rubytree', :lib => 'tree' | |
54 | config.gem 'coderay', :version => '~>0.9.7' |
|
54 | config.gem 'coderay', :version => '~>0.9.7' | |
55 |
|
55 | |||
56 | # Load any local configuration that is kept out of source control |
|
56 | # Load any local configuration that is kept out of source control | |
57 | # (e.g. gems, patches). |
|
57 | # (e.g. gems, patches). | |
58 | if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) |
|
58 | if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) | |
59 | instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) |
|
59 | instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) | |
60 | end |
|
60 | end | |
61 | end |
|
61 | end |
@@ -1,104 +1,100 | |||||
1 |
|
1 | |||
2 | require 'active_record' |
|
2 | require 'active_record' | |
3 |
|
3 | |||
4 | module ActiveRecord |
|
4 | module ActiveRecord | |
5 | class Base |
|
5 | class Base | |
6 | include Redmine::I18n |
|
6 | include Redmine::I18n | |
7 |
|
7 | |||
8 | # Translate attribute names for validation errors display |
|
8 | # Translate attribute names for validation errors display | |
9 | def self.human_attribute_name(attr) |
|
9 | def self.human_attribute_name(attr) | |
10 | l("field_#{attr.to_s.gsub(/_id$/, '')}") |
|
10 | l("field_#{attr.to_s.gsub(/_id$/, '')}") | |
11 | end |
|
11 | end | |
12 | end |
|
12 | end | |
13 | end |
|
13 | end | |
14 |
|
14 | |||
15 | module ActiveRecord |
|
15 | module ActiveRecord | |
16 | class Errors |
|
16 | class Errors | |
17 | def full_messages(options = {}) |
|
17 | def full_messages(options = {}) | |
18 | full_messages = [] |
|
18 | full_messages = [] | |
19 |
|
19 | |||
20 | @errors.each_key do |attr| |
|
20 | @errors.each_key do |attr| | |
21 | @errors[attr].each do |message| |
|
21 | @errors[attr].each do |message| | |
22 | next unless message |
|
22 | next unless message | |
23 |
|
23 | |||
24 | if attr == "base" |
|
24 | if attr == "base" | |
25 | full_messages << message |
|
25 | full_messages << message | |
26 | elsif attr == "custom_values" |
|
26 | elsif attr == "custom_values" | |
27 | # Replace the generic "custom values is invalid" |
|
27 | # Replace the generic "custom values is invalid" | |
28 | # with the errors on custom values |
|
28 | # with the errors on custom values | |
29 | @base.custom_values.each do |value| |
|
29 | @base.custom_values.each do |value| | |
30 | value.errors.each do |attr, msg| |
|
30 | value.errors.each do |attr, msg| | |
31 | full_messages << value.custom_field.name + ' ' + msg |
|
31 | full_messages << value.custom_field.name + ' ' + msg | |
32 | end |
|
32 | end | |
33 | end |
|
33 | end | |
34 | else |
|
34 | else | |
35 | attr_name = @base.class.human_attribute_name(attr) |
|
35 | attr_name = @base.class.human_attribute_name(attr) | |
36 | full_messages << attr_name + ' ' + message.to_s |
|
36 | full_messages << attr_name + ' ' + message.to_s | |
37 | end |
|
37 | end | |
38 | end |
|
38 | end | |
39 | end |
|
39 | end | |
40 | full_messages |
|
40 | full_messages | |
41 | end |
|
41 | end | |
42 | end |
|
42 | end | |
43 | end |
|
43 | end | |
44 |
|
44 | |||
45 | module ActionView |
|
45 | module ActionView | |
46 | module Helpers |
|
46 | module Helpers | |
47 | module DateHelper |
|
47 | module DateHelper | |
48 | # distance_of_time_in_words breaks when difference is greater than 30 years |
|
48 | # distance_of_time_in_words breaks when difference is greater than 30 years | |
49 | def distance_of_date_in_words(from_date, to_date = 0, options = {}) |
|
49 | def distance_of_date_in_words(from_date, to_date = 0, options = {}) | |
50 | from_date = from_date.to_date if from_date.respond_to?(:to_date) |
|
50 | from_date = from_date.to_date if from_date.respond_to?(:to_date) | |
51 | to_date = to_date.to_date if to_date.respond_to?(:to_date) |
|
51 | to_date = to_date.to_date if to_date.respond_to?(:to_date) | |
52 | distance_in_days = (to_date - from_date).abs |
|
52 | distance_in_days = (to_date - from_date).abs | |
53 |
|
53 | |||
54 | I18n.with_options :locale => options[:locale], :scope => :'datetime.distance_in_words' do |locale| |
|
54 | I18n.with_options :locale => options[:locale], :scope => :'datetime.distance_in_words' do |locale| | |
55 | case distance_in_days |
|
55 | case distance_in_days | |
56 | when 0..60 then locale.t :x_days, :count => distance_in_days.round |
|
56 | when 0..60 then locale.t :x_days, :count => distance_in_days.round | |
57 | when 61..720 then locale.t :about_x_months, :count => (distance_in_days / 30).round |
|
57 | when 61..720 then locale.t :about_x_months, :count => (distance_in_days / 30).round | |
58 | else locale.t :over_x_years, :count => (distance_in_days / 365).floor |
|
58 | else locale.t :over_x_years, :count => (distance_in_days / 365).floor | |
59 | end |
|
59 | end | |
60 | end |
|
60 | end | |
61 | end |
|
61 | end | |
62 | end |
|
62 | end | |
63 | end |
|
63 | end | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" } |
|
66 | ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" } | |
67 |
|
67 | |||
68 | # Adds :async_smtp and :async_sendmail delivery methods |
|
68 | # Adds :async_smtp and :async_sendmail delivery methods | |
69 | # to perform email deliveries asynchronously |
|
69 | # to perform email deliveries asynchronously | |
70 | module AsynchronousMailer |
|
70 | module AsynchronousMailer | |
71 | %w(smtp sendmail).each do |type| |
|
71 | %w(smtp sendmail).each do |type| | |
72 | define_method("perform_delivery_async_#{type}") do |mail| |
|
72 | define_method("perform_delivery_async_#{type}") do |mail| | |
73 | Thread.start do |
|
73 | Thread.start do | |
74 | send "perform_delivery_#{type}", mail |
|
74 | send "perform_delivery_#{type}", mail | |
75 | end |
|
75 | end | |
76 | end |
|
76 | end | |
77 | end |
|
77 | end | |
78 | end |
|
78 | end | |
79 |
|
79 | |||
80 | ActionMailer::Base.send :include, AsynchronousMailer |
|
80 | ActionMailer::Base.send :include, AsynchronousMailer | |
81 |
|
81 | |||
82 | # TODO: Hack to support i18n 4.x on Rails 2.3.5. Remove post 2.3.6. |
|
82 | # TMail::Unquoter.convert_to_with_fallback_on_iso_8859_1 introduced in TMail 1.2.7 | |
83 | # See http://www.redmine.org/issues/6428 and http://www.redmine.org/issues/5608 |
|
83 | # triggers a test failure in test_add_issue_with_japanese_keywords(MailHandlerTest) | |
84 |
module |
|
84 | module TMail | |
85 | module Backend |
|
85 | class Unquoter | |
86 | module Base |
|
86 | class << self | |
87 | def warn_syntax_deprecation!(*args) |
|
87 | alias_method :convert_to, :convert_to_without_fallback_on_iso_8859_1 | |
88 | return if @skip_syntax_deprecation |
|
|||
89 | warn "The {{key}} interpolation syntax in I18n messages is deprecated and will be removed in Redmine 1.2. Please use %{key} instead, see http://www.redmine.org/issues/7013 for more information." |
|
|||
90 | @skip_syntax_deprecation = true |
|
|||
91 | end |
|
|||
92 | end |
|
88 | end | |
93 | end |
|
89 | end | |
94 | end |
|
90 | end | |
95 |
|
91 | |||
96 | module ActionController |
|
92 | module ActionController | |
97 | module MimeResponds |
|
93 | module MimeResponds | |
98 | class Responder |
|
94 | class Responder | |
99 | def api(&block) |
|
95 | def api(&block) | |
100 | any(:xml, :json, &block) |
|
96 | any(:xml, :json, &block) | |
101 | end |
|
97 | end | |
102 | end |
|
98 | end | |
103 | end |
|
99 | end | |
104 | end |
|
100 | end |
General Comments 0
You need to be logged in to leave comments.
Login now