コミットメタ情報

リビジョンf688fbf028567834e7da934455c4fcb8df6a5ac8 (tree)
日時2017-11-28 00:16:25
作者hylom <hylom@user...>
コミッターhylom

ログメッセージ

  • fix parent page's link in comment single page

変更サマリ

差分

--- a/src/newslash_web/lib/Newslash/Web/Controller/Comment.pm
+++ b/src/newslash_web/lib/Newslash/Web/Controller/Comment.pm
@@ -27,13 +27,23 @@ sub single {
2727 $parent = $comments->select(cid => $comment->{pid});
2828 }
2929
30- #my $story;
31- #my $source_url;
32- #if ($discuss) {
33- # if ($discuss->{kind} == "story") {
34- # $story = $c->model('stories')->select(stoid => $discuss->{stoid});
35- # }
36- #}
30+ my $parent_item;
31+ if ($discuss) {
32+ my $d_id = $discuss->{discussion_id};
33+ if ($discuss->{kind} eq "story"
34+ || $discuss->{kind} eq "journal-story") {
35+ $parent_item = $c->model('stories')->select(stoid => $discuss->{stoid});
36+ }
37+ elsif ($discuss->{kind} eq "journal") {
38+ $parent_item = $c->model('journals')->select(discussion_id => $d_id);
39+ }
40+ elsif ($discuss->{kind} eq "poll") {
41+ $parent_item = $c->model('polls')->select(discussion_id => $d_id);
42+ }
43+ elsif ($discuss->{kind} eq "submission") {
44+ $parent_item = $c->model('submissions')->select(discussion_id => $d_id);
45+ }
46+ }
3747
3848 my $page = { content_type => "comment",
3949 type => "single" };
@@ -41,6 +51,7 @@ sub single {
4151 $c->render(item => $comment,
4252 parent => $parent,
4353 discussion => $discuss,
54+ parent_item => $parent_item,
4455 page => $page,
4556 );
4657 }
--- a/src/newslash_web/templates/common/single.html.tt2
+++ b/src/newslash_web/templates/common/single.html.tt2
@@ -13,11 +13,20 @@
1313 <p>このコンテンツは、
1414 [%- IF discussion.kind == "story" -%]
1515 「<span><a href="/story/[% discussion.sid %]">[% discussion.title %]</a></span>」記事
16+ [%- ELSIF discussion.kind == "journal-story" -%]
17+ 「<span><a href="/story/[% discussion.sid %]">[% discussion.title %]</a></span>」記事
18+ [%- ELSIF discussion.kind == "journal" -%]
19+ 日記「<span><a href="/journal/[% parent_item.id %]">[% discussion.title %]</a></span>」
20+ [%- ELSIF discussion.kind == "poll" -%]
21+ 国民投票「<span><a href="/journal/[% parent_item.id %]">[% discussion.title %]</a></span>」
22+ [%- ELSIF discussion.kind == "submission" -%]
23+ タレコミ「<span><a href="/journal/[% parent_item.id %]">[% discussion.title %]</a></span>」
1624 [%- ELSE -%]
1725 「<span>[% discussion.title %]</span>」記事
18- [%- END -%]に対するコメントです。</p>
26+ [%- END -%]に対するコメントです。
27+ </p>
1928
20- [%- IF comment.parent_id -%]
29+ [%- IF parent -%]
2130 <p>親コメントは「<span><a href="/comment/[% parent.cid %]">[% parent.title %]</a></span>」です。</p>
2231 [%- END -%]
2332 </div>
旧リポジトリブラウザで表示