コミットメタ情報

リビジョン7ffafa650935c0521553c6a816ac7142fcd2a7ab (tree)
日時2017-12-04 22:12:17
作者hylom <hylom@user...>
コミッターhylom

ログメッセージ

fix conditions for article template

変更サマリ

差分

--- a/src/newslash_web/templates/common/article/article.html.tt2
+++ b/src/newslash_web/templates/common/article/article.html.tt2
@@ -1,16 +1,44 @@
11 [%-
22 USE dtf = DateTimeFormatter;
3-IF item.content_type == 'story'; content_id = item.sid; END;
4-IF item.content_type == 'journal'; content_id = item.id; END;
5-IF item.content_type == 'submission'; content_id = item.subid; END;
6-IF item.content_type == 'poll'; content_id = item.qid; END;
7-IF item.content_type == 'vote'; content_id = item.qid; END;
8-
9-IF item.content_type == 'story'; url = "/story/" _ item.sid _ "/"; END;
10-IF item.content_type == 'journal'; url = "/journal/" _ item.id _ "/"; END;
11-IF item.content_type == 'submission'; url = "/submission/" _ item.id _ "/"; END;
12-IF item.content_type == 'comment'; url = "/comment/" _ item.id _ "/"; END;
13-IF item.content_type == 'poll'; url = "/poll/" _ item.id _ "/"; END;
3+IF item.content_type == 'story';
4+content_id = item.sid;
5+url = "/story/" _ item.sid _ "/";
6+content_type_text = "記事";
7+END;
8+
9+IF item.content_type == 'journal';
10+content_id = item.id;
11+url = "/journal/" _ item.id _ "/";
12+content_type_text = "日記";
13+END;
14+
15+IF item.content_type == 'submission';
16+content_id = item.subid;
17+url = "/submission/" _ item.id _ "/";
18+content_type_text = "タレコミ";
19+END;
20+
21+IF item.content_type == 'comment';
22+url = "/comment/" _ item.id _ "/";
23+content_type_text = "コメント";
24+END;
25+
26+IF item.content_type == 'poll';
27+content_id = item.qid;
28+url = "/poll/" _ item.id _ "/";
29+content_type_text = "投票";
30+END;
31+
32+IF item.content_type == 'vote';
33+content_id = item.qid;
34+content_type_text = "国民投票";
35+END;
36+
37+IF item.content_type == 'feed';
38+content_id = item.feed_id;
39+content_type_text = "フィード";
40+END;
41+
1442 -%]
1543
1644 <article id="[% item.id %]" type="[% item.content_type %]" item-id="[% content_id %]"
@@ -29,14 +57,7 @@ IF item.content_type == 'poll'; url = "/poll/" _ item.id _ "/"; END;
2957 </h1>
3058
3159 <div class="property">
32- <span class="content-type">
33- [%- IF item.content_type == 'story' -%]ストーリー[%- END -%]
34- [%- IF item.content_type == 'feed' -%]フィード[%- END -%]
35- [%- IF item.content_type == 'journal' -%]日記[%- END -%]
36- [%- IF item.content_type == 'submission' -%]タレコミ[%- END -%]
37- [%- IF item.content_type == 'comment' -%]コメント[%- END -%]
38- [%- IF item.content_type == 'poll' -%]国民投票[%- END -%]
39- </span>
60+ <span class="content-type">[% content_type_text %]</span>
4061 <span class="author">
4162 by <span v-text="item.author"><a href="/~[% item.author %]/">[% item.author %]</a></span>
4263 </span>
@@ -75,14 +96,24 @@ IF item.content_type == 'poll'; url = "/poll/" _ item.id _ "/"; END;
7596 [%# TODO: fix intro_text, body_text, full_text process %]
7697
7798 [%- IF hide_bodytext %]
78- [%- IF item.intro_text || x_template -%]
99+
100+ [%- IF item.intro_text || x_template -%]
79101 <div class="body contents-text" v-html="item.intro_text">[% item.intro_text %]</div>
80- [%- END -%]
102+ [%- END -%]
103+
81104 [%- ELSE %]
105+
106+ [%- IF item.body_text || x_template -%]
107+ <div class="body contents-text" v-html="item.intro_text">[% item.intro_text %]</div>
108+ <div class="body contents-text" v-html="item.body_text">[% item.body_text %]</div>
109+ [%- ELSE %]
82110 <div class="body contents-text" v-html="item.full_text">[% item.full_text %]</div>
83- [%- IF item.media || x_template %]
111+ [%- END -%]
112+
113+ [%- IF item.media || x_template %]
84114 <div class="body contents-text" v-html="item.media">[% item.media %]</div>
85- [%- END %]
115+ [%- END %]
116+
86117 [%- END %]
87118
88119 [%- IF x_template -%]
@@ -92,30 +123,32 @@ IF item.content_type == 'poll'; url = "/poll/" _ item.id _ "/"; END;
92123 [%- END -%]
93124
94125 <footer>
95- [%- IF !hide_more_link -%]
96- [%- IF item.content_type != "feed" -%]
126+ [%- IF item.content_type == "feed" -%]
127+ [%- # show nothing -%]
128+ [%- ELSIF !hide_more_link-%]
129+ [%- IF item.body_text && item.body_text.length > 0; next_text = "の続き"; ELSE; next_text = ""; END; -%]
97130 <div class="link-to-story" v-if="mode == ''"><a href="[% url %]" :href="url">
98131 [%- IF item.content_type == "poll" -%]
99- [%- IF item.comment_count || x_template -%]
132+ [%- IF item.comment_count || x_template -%]
100133 <span v-if="item.comment_count > 0"><span v-text="item.comment_count">[% item.comment_count %]</span>件のコメントを見る</span>
101- [%- END -%]
102- [%- IF !item.comment_count || x_template -%]<span v-if="item.comment_count == 0">投票結果を見る</span>[%- END -%]
134+ [%- END -%]
135+
136+ [%- IF !item.comment_count || x_template -%]<span v-if="item.comment_count == 0">投票結果を見る</span>[%- END -%]
103137 [%- ELSE -%]
104- [%- link_target = "記事" -%]
105- [%- IF item.comment_count || x_template -%]
106- <span v-if="item.comment_count > 0">[% link_target %]と<span v-text="item.comment_count">[% item.comment_count %]</span>件のコメントを読む</span>
107- [%- END -%]
108- [%- IF !item.comment_count || x_template -%]
109- <span v-if="item.comment_count == 0">[% link_target %]を読む</span>
110- [%- END -%]
138+ [%- IF item.comment_count || x_template -%]
139+ <span v-if="item.comment_count > 0">[% content_type_text %][% next_text %]と<span v-text="item.comment_count">[% item.comment_count %]</span>件のコメントを読む</span>
140+ [%- END -%]
141+
142+ [%- IF !item.comment_count || x_template -%]
143+ <span v-if="item.comment_count == 0">[% content_type_text %][% next_text %]を読む</span>
144+ [%- END -%]
111145 [%- END -%]
112146 </a></div>
113- [%- END -%]
114147 [%- ELSE -%]
115148 <div class="comment-counter">
116- [%- IF item.discussion_id -%]
149+ [%- IF item.discussion_id -%]
117150 <a href="#comments"><span class="counter" v-text="item.comment_count">[% item.comment_count %]</span>コメント</a>
118- [%- END -%]
151+ [%- END -%]
119152 </div>
120153 [%- END -%]
121154
旧リポジトリブラウザで表示