mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-23 03:51:46 +00:00
Patch by Seiei Miyagi. git-svn-id: http://svn.redmine.org/redmine/trunk@19454 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0aaf07ac6d
commit
ba7d4745e2
@ -248,7 +248,7 @@ class Import < ActiveRecord::Base
|
|||||||
wrapper = settings['wrapper'].to_s
|
wrapper = settings['wrapper'].to_s
|
||||||
csv_options[:quote_char] = wrapper if wrapper.size == 1
|
csv_options[:quote_char] = wrapper if wrapper.size == 1
|
||||||
|
|
||||||
CSV.foreach(filepath, csv_options) do |row|
|
CSV.foreach(filepath, **csv_options) do |row|
|
||||||
yield row if block_given?
|
yield row if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -33,7 +33,7 @@ module Redmine
|
|||||||
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
|
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
|
||||||
|
|
||||||
has_many :attachments, lambda {order("#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC")},
|
has_many :attachments, lambda {order("#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC")},
|
||||||
options.merge(:as => :container, :dependent => :destroy, :inverse_of => :container)
|
**options, as: :container, dependent: :destroy, inverse_of: :container
|
||||||
send :include, Redmine::Acts::Attachable::InstanceMethods
|
send :include, Redmine::Acts::Attachable::InstanceMethods
|
||||||
before_save :attach_saved_attachments
|
before_save :attach_saved_attachments
|
||||||
after_rollback :detach_saved_attachments
|
after_rollback :detach_saved_attachments
|
||||||
|
|||||||
@ -29,7 +29,7 @@ module Redmine
|
|||||||
::I18n.t(*args)
|
::I18n.t(*args)
|
||||||
when 2
|
when 2
|
||||||
if args.last.is_a?(Hash)
|
if args.last.is_a?(Hash)
|
||||||
::I18n.t(*args)
|
::I18n.t(*args.first, **args.last)
|
||||||
elsif args.last.is_a?(String)
|
elsif args.last.is_a?(String)
|
||||||
::I18n.t(args.first, :value => args.last)
|
::I18n.t(args.first, :value => args.last)
|
||||||
else
|
else
|
||||||
@ -57,7 +57,7 @@ module Redmine
|
|||||||
def ll(lang, str, arg=nil)
|
def ll(lang, str, arg=nil)
|
||||||
options = arg.is_a?(Hash) ? arg : {:value => arg}
|
options = arg.is_a?(Hash) ? arg : {:value => arg}
|
||||||
locale = lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }
|
locale = lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }
|
||||||
::I18n.t(str.to_s, options.merge(:locale => locale))
|
::I18n.t(str.to_s, **options, locale: locale)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Localizes the given args with user's language
|
# Localizes the given args with user's language
|
||||||
@ -70,7 +70,7 @@ module Redmine
|
|||||||
return nil unless date
|
return nil unless date
|
||||||
options = {}
|
options = {}
|
||||||
options[:format] = Setting.date_format unless Setting.date_format.blank?
|
options[:format] = Setting.date_format unless Setting.date_format.blank?
|
||||||
::I18n.l(date.to_date, options)
|
::I18n.l(date.to_date, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_time(time, include_date=true, user=nil)
|
def format_time(time, include_date=true, user=nil)
|
||||||
@ -80,7 +80,7 @@ module Redmine
|
|||||||
options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
|
options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
|
||||||
time = time.to_time if time.is_a?(String)
|
time = time.to_time if time.is_a?(String)
|
||||||
local = user.convert_time_to_user_timezone(time)
|
local = user.convert_time_to_user_timezone(time)
|
||||||
(include_date ? "#{format_date(local)} " : "") + ::I18n.l(local, options)
|
(include_date ? "#{format_date(local)} " : "") + ::I18n.l(local, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_hours(hours)
|
def format_hours(hours)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user