Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
a9a9e8a3
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,发现更多精彩内容 >>
提交
a9a9e8a3
编写于
5月 21, 2012
作者:
C
Carlos Galdino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor date related helpers
上级
d7de7a79
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
26 addition
and
50 deletion
+26
-50
actionpack/lib/action_view/helpers/tags/date_field.rb
actionpack/lib/action_view/helpers/tags/date_field.rb
+6
-7
actionpack/lib/action_view/helpers/tags/datetime_field.rb
actionpack/lib/action_view/helpers/tags/datetime_field.rb
+4
-4
actionpack/lib/action_view/helpers/tags/datetime_local_field.rb
...pack/lib/action_view/helpers/tags/datetime_local_field.rb
+6
-10
actionpack/lib/action_view/helpers/tags/month_field.rb
actionpack/lib/action_view/helpers/tags/month_field.rb
+2
-11
actionpack/lib/action_view/helpers/tags/time_field.rb
actionpack/lib/action_view/helpers/tags/time_field.rb
+6
-7
actionpack/lib/action_view/helpers/tags/week_field.rb
actionpack/lib/action_view/helpers/tags/week_field.rb
+2
-11
未找到文件。
actionpack/lib/action_view/helpers/tags/date_field.rb
浏览文件 @
a9a9e8a3
module
ActionView
module
Helpers
module
Tags
class
DateField
<
TextField
#:nodoc:
def
render
options
=
@options
.
stringify_keys
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
value
(
object
).
try
(
:to_date
)
}
@options
=
options
super
end
class
DateField
<
DatetimeField
#:nodoc:
private
def
format_date
(
value
)
value
.
try
(
:strftime
,
"%Y-%m-%d"
)
end
end
end
end
...
...
actionpack/lib/action_view/helpers/tags/datetime_field.rb
浏览文件 @
a9a9e8a3
...
...
@@ -4,16 +4,16 @@ module Tags
class
DatetimeField
<
TextField
#:nodoc:
def
render
options
=
@options
.
stringify_keys
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
format_
global_date_time_string
(
value
(
object
))
}
options
[
"min"
]
=
format_
global_date_time_string
(
options
[
"min"
])
options
[
"max"
]
=
format_
global_date_time_string
(
options
[
"max"
])
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
format_
date
(
value
(
object
))
}
options
[
"min"
]
=
format_
date
(
options
[
"min"
])
options
[
"max"
]
=
format_
date
(
options
[
"max"
])
@options
=
options
super
end
private
def
format_
global_date_time_string
(
value
)
def
format_
date
(
value
)
value
.
try
(
:strftime
,
"%Y-%m-%dT%T.%L%z"
)
end
end
...
...
actionpack/lib/action_view/helpers/tags/datetime_local_field.rb
浏览文件 @
a9a9e8a3
module
ActionView
module
Helpers
module
Tags
class
DatetimeLocalField
<
TextField
#:nodoc:
def
render
options
=
@options
.
stringify_keys
options
[
"type"
]
=
"datetime-local"
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
format_local_date_time_string
(
value
(
object
))
}
options
[
"min"
]
=
format_local_date_time_string
(
options
[
"min"
])
options
[
"max"
]
=
format_local_date_time_string
(
options
[
"max"
])
@options
=
options
super
class
DatetimeLocalField
<
DatetimeField
#:nodoc:
class
<<
self
def
field_type
@field_type
||=
"datetime-local"
end
end
private
def
format_
local_date_time_string
(
value
)
def
format_
date
(
value
)
value
.
try
(
:strftime
,
"%Y-%m-%dT%T"
)
end
end
...
...
actionpack/lib/action_view/helpers/tags/month_field.rb
浏览文件 @
a9a9e8a3
module
ActionView
module
Helpers
module
Tags
class
MonthField
<
TextField
#:nodoc:
def
render
options
=
@options
.
stringify_keys
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
format_month_string
(
value
(
object
))
}
options
[
"min"
]
=
format_month_string
(
options
[
"min"
])
options
[
"max"
]
=
format_month_string
(
options
[
"max"
])
@options
=
options
super
end
class
MonthField
<
DatetimeField
#:nodoc:
private
def
format_
month_string
(
value
)
def
format_
date
(
value
)
value
.
try
(
:strftime
,
"%Y-%m"
)
end
end
...
...
actionpack/lib/action_view/helpers/tags/time_field.rb
浏览文件 @
a9a9e8a3
module
ActionView
module
Helpers
module
Tags
class
TimeField
<
TextField
#:nodoc:
def
render
options
=
@options
.
stringify_keys
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
value
(
object
).
try
(
:strftime
,
"%T.%L"
)
}
@options
=
options
super
end
class
TimeField
<
DatetimeField
#:nodoc:
private
def
format_date
(
value
)
value
.
try
(
:strftime
,
"%T.%L"
)
end
end
end
end
...
...
actionpack/lib/action_view/helpers/tags/week_field.rb
浏览文件 @
a9a9e8a3
module
ActionView
module
Helpers
module
Tags
class
WeekField
<
TextField
#:nodoc:
def
render
options
=
@options
.
stringify_keys
options
[
"value"
]
=
@options
.
fetch
(
"value"
)
{
format_week_string
(
value
(
object
))
}
options
[
"min"
]
=
format_week_string
(
options
[
"min"
])
options
[
"max"
]
=
format_week_string
(
options
[
"max"
])
@options
=
options
super
end
class
WeekField
<
DatetimeField
#:nodoc:
private
def
format_
week_string
(
value
)
def
format_
date
(
value
)
value
.
try
(
:strftime
,
"%Y-W%W"
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录