Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6ba4c6d4
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,发现更多精彩内容 >>
提交
6ba4c6d4
编写于
1月 10, 2015
作者:
D
Daniel Gomez de Souza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use option url: false to allow entries without a link tag
上级
b74c3565
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
2 deletion
+30
-2
actionview/CHANGELOG.md
actionview/CHANGELOG.md
+3
-0
actionview/lib/action_view/helpers/atom_feed_helper.rb
actionview/lib/action_view/helpers/atom_feed_helper.rb
+3
-2
actionview/test/template/atom_feed_helper_test.rb
actionview/test/template/atom_feed_helper_test.rb
+24
-0
未找到文件。
actionview/CHANGELOG.md
浏览文件 @
6ba4c6d4
...
...
@@ -28,5 +28,8 @@
*Angelo Capilleri*
*
Allow entries without a link tag in AtomFeedHelper.
*Daniel Gomez de Souza*
Please check
[
4-2-stable
](
https://github.com/rails/rails/blob/4-2-stable/actionview/CHANGELOG.md
)
for previous changes.
actionview/lib/action_view/helpers/atom_feed_helper.rb
浏览文件 @
6ba4c6d4
...
...
@@ -174,7 +174,7 @@ def updated(date_or_time = nil)
#
# * <tt>:published</tt>: Time first published. Defaults to the created_at attribute on the record if one such exists.
# * <tt>:updated</tt>: Time of update. Defaults to the updated_at attribute on the record if one such exists.
# * <tt>:url</tt>: The URL for this entry. Defaults to the polymorphic_url for the record.
# * <tt>:url</tt>: The URL for this entry
or false or nil for not having a link tag
. Defaults to the polymorphic_url for the record.
# * <tt>:id</tt>: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}"
# * <tt>:type</tt>: The TYPE for this entry. Defaults to "text/html".
def
entry
(
record
,
options
=
{})
...
...
@@ -191,7 +191,8 @@ def entry(record, options = {})
type
=
options
.
fetch
(
:type
,
'text/html'
)
@xml
.
link
(
:rel
=>
'alternate'
,
:type
=>
type
,
:href
=>
options
[
:url
]
||
@view
.
polymorphic_url
(
record
))
url
=
options
.
fetch
(
:url
)
{
@view
.
polymorphic_url
(
record
)
}
@xml
.
link
(
:rel
=>
'alternate'
,
:type
=>
type
,
:href
=>
url
)
if
url
yield
AtomBuilder
.
new
(
@xml
)
end
...
...
actionview/test/template/atom_feed_helper_test.rb
浏览文件 @
6ba4c6d4
...
...
@@ -62,6 +62,23 @@ class ScrollsController < ActionController::Base
end
end
EOT
FEEDS
[
"entry_url_false_option"
]
=
<<-
EOT
atom_feed do |feed|
feed.title("My great blog!")
feed.updated((@scrolls.first.created_at))
@scrolls.each do |scroll|
feed.entry(scroll, :url => false) do |entry|
entry.title(scroll.title)
entry.content(scroll.body, :type => 'html')
entry.author do |author|
author.name("DHH")
end
end
end
end
EOT
FEEDS
[
"xml_block"
]
=
<<-
EOT
atom_feed do |feed|
feed.title("My great blog!")
...
...
@@ -337,6 +354,13 @@ def test_feed_entry_type_option_specified
end
end
def
test_feed_entry_url_false_option_adds_no_link
with_restful_routing
(
:scrolls
)
do
get
:index
,
:id
=>
'entry_url_false_option'
assert_select
"entry link"
,
false
end
end
private
def
with_restful_routing
(
resources
)
with_routing
do
|
set
|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录