Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c178a87b
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c178a87b
编写于
6月 23, 2008
作者:
S
Sven Fuchs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove call to self.locale from helpers
上级
2ee9f2a0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
14 deletion
+5
-14
actionpack/lib/action_view/helpers/active_record_helper.rb
actionpack/lib/action_view/helpers/active_record_helper.rb
+1
-4
actionpack/lib/action_view/helpers/date_helper.rb
actionpack/lib/action_view/helpers/date_helper.rb
+1
-4
actionpack/lib/action_view/helpers/number_helper.rb
actionpack/lib/action_view/helpers/number_helper.rb
+3
-6
未找到文件。
actionpack/lib/action_view/helpers/active_record_helper.rb
浏览文件 @
c178a87b
...
@@ -159,9 +159,6 @@ def error_messages_for(*params)
...
@@ -159,9 +159,6 @@ def error_messages_for(*params)
end
end
count
=
objects
.
inject
(
0
)
{
|
sum
,
object
|
sum
+
object
.
errors
.
count
}
count
=
objects
.
inject
(
0
)
{
|
sum
,
object
|
sum
+
object
.
errors
.
count
}
locale
=
options
[
:locale
]
locale
||=
self
.
locale
if
respond_to?
(
:locale
)
unless
count
.
zero?
unless
count
.
zero?
html
=
{}
html
=
{}
[
:id
,
:class
].
each
do
|
key
|
[
:id
,
:class
].
each
do
|
key
|
...
@@ -174,7 +171,7 @@ def error_messages_for(*params)
...
@@ -174,7 +171,7 @@ def error_messages_for(*params)
end
end
options
[
:object_name
]
||=
params
.
first
options
[
:object_name
]
||=
params
.
first
I18n
.
with_options
:locale
=>
locale
,
:scope
=>
[
:active_record
,
:error
]
do
|
locale
|
I18n
.
with_options
:locale
=>
options
[
:locale
]
,
:scope
=>
[
:active_record
,
:error
]
do
|
locale
|
header_message
=
if
options
.
include?
(
:header_message
)
header_message
=
if
options
.
include?
(
:header_message
)
options
[
:header_message
]
options
[
:header_message
]
else
else
...
...
actionpack/lib/action_view/helpers/date_helper.rb
浏览文件 @
c178a87b
...
@@ -59,15 +59,12 @@ module DateHelper
...
@@ -59,15 +59,12 @@ module DateHelper
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
#
#
def
distance_of_time_in_words
(
from_time
,
to_time
=
0
,
include_seconds
=
false
,
options
=
{})
def
distance_of_time_in_words
(
from_time
,
to_time
=
0
,
include_seconds
=
false
,
options
=
{})
locale
=
options
[
:locale
]
locale
||=
self
.
locale
if
respond_to?
(
:locale
)
from_time
=
from_time
.
to_time
if
from_time
.
respond_to?
(
:to_time
)
from_time
=
from_time
.
to_time
if
from_time
.
respond_to?
(
:to_time
)
to_time
=
to_time
.
to_time
if
to_time
.
respond_to?
(
:to_time
)
to_time
=
to_time
.
to_time
if
to_time
.
respond_to?
(
:to_time
)
distance_in_minutes
=
(((
to_time
-
from_time
).
abs
)
/
60
).
round
distance_in_minutes
=
(((
to_time
-
from_time
).
abs
)
/
60
).
round
distance_in_seconds
=
((
to_time
-
from_time
).
abs
).
round
distance_in_seconds
=
((
to_time
-
from_time
).
abs
).
round
I18n
.
with_options
:locale
=>
locale
,
:scope
=>
:'datetime.distance_in_words'
do
|
locale
|
I18n
.
with_options
:locale
=>
options
[
:locale
]
,
:scope
=>
:'datetime.distance_in_words'
do
|
locale
|
case
distance_in_minutes
case
distance_in_minutes
when
0
..
1
when
0
..
1
return
distance_in_minutes
==
0
?
return
distance_in_minutes
==
0
?
...
...
actionpack/lib/action_view/helpers/number_helper.rb
浏览文件 @
c178a87b
...
@@ -69,12 +69,9 @@ def number_to_phone(number, options = {})
...
@@ -69,12 +69,9 @@ def number_to_phone(number, options = {})
# number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "", :format => "%n %u")
# number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "", :format => "%n %u")
# # => 1234567890,50 £
# # => 1234567890,50 £
def
number_to_currency
(
number
,
options
=
{})
def
number_to_currency
(
number
,
options
=
{})
options
=
options
.
symbolize_keys
options
=
options
.
symbolize_keys
defaults
=
:'currency.format'
.
t
(
options
[
:locale
])
||
{}
locale
=
options
[
:locale
]
locale
||=
self
.
locale
if
respond_to?
(
:locale
)
defaults
=
:'currency.format'
.
t
(
locale
)
||
{}
precision
=
options
[
:precision
]
||
defaults
[
:precision
]
precision
=
options
[
:precision
]
||
defaults
[
:precision
]
unit
=
options
[
:unit
]
||
defaults
[
:unit
]
unit
=
options
[
:unit
]
||
defaults
[
:unit
]
separator
=
options
[
:separator
]
||
defaults
[
:separator
]
separator
=
options
[
:separator
]
||
defaults
[
:separator
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录