OSDN Git Service

87d2f7f2b77ffc6070af2dc3a50db37cd76ce113
[newslash/newslash.git] / src / newslash_web / templates / common / article / article.html.tt2
1 [%-
2 USE dtf = DateTimeFormatter;
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
42 -%]
43
44 <article id="[% item.id %]" type="[% item.content_type %]" item-id="[% content_id %]"
45          [% IF !x_template %]v-if="0"[% ELSE %]v-if="mode != 'editing' || enableAutoPreview"[% END %]>
46   <header>
47     <h1>
48       [%- IF item.primary_topic.image.length || x_template -%]
49       <img [% IF item.primary_topic.image %]src="[% Site.topic_icon_base_url %]/[% item.primary_topic.image %]"[% END %]
50            :src="primaryTopicIconURL" v-if="primaryTopicIconURL" />
51       [%- END -%]
52       [%- IF url -%]
53       <a href="[% url %]" v-html="item.title">[% item.title %]</a>
54       [%- ELSE -%]
55       <span v-html="item.title">[% item.title %]</span>
56       [%- END -%]
57     </h1>
58
59     <div class="property">
60       <span class="content-type">[% content_type_text %]</span>
61       <span class="author">
62         by <span v-text="item.author"><a href="/~[% item.author %]/">[% item.author %]</a></span>
63       </span>
64       <span class="create-time" v-text="item.create_time">[% dtf.mysql_to_user(item.create_time, user.config.ui.offset_sec, user.config.ui.time_format) %]</span>
65       [%- IF x_template || user.is_admin %]
66       <span class="score">
67         pop: [% item.popularity %]
68         epop: [% item.editorpop %]
69         need: [% item.neediness %]
70         act: [% item.activity %]
71       </span>
72       [%- END %]
73       
74       [%- IF x_template || item.content_type == 'story' %]
75       <span class="dept" v-if="item.content_type == 'story'">
76         <span class="dept-name" v-text="item.dept" v-if="item.dept">[% item.dept %]</span> 部門より
77       </span>
78       [%- END %]
79     </div>
80
81     <div class="toolbar" v-if="mode == ''">
82       [%- IF x_template || page.type == 'single' && item.content_type == 'journal' && item.uid == user.uid -%]
83       <button type="button" class="btn btn-default btn-sm" id="activate-journal-editor"
84               title="編集" area-label="編集" v-show="editable" v-on:click="startEdit(item)">
85         <span class="glyphicon glyphicon-pencil"></span>
86       </button>
87       [%- END -%]
88       [%- IF x_template || item.content_type == 'story' && user.is_admin || user.editor  -%]
89       <button type="button" class="btn btn-default btn-sm" id="activate-story-editor"
90               area-label="編集" title="編集" v-on:click="startEdit(item)"
91               v-if="0">
92         <span class="glyphicon glyphicon-cog"></span>
93       </button>
94       [%- END -%]
95       [%- IF item.content_type == 'submission' && (user.author || x_template) -%]
96       [<a href="/admin/story/edit?subid=[% item.submission_id %]">accept</a>]
97       [%- END -%]
98     </div>
99
100     [% IF user.author && item.public != "yes" %]
101     <div class="alert alert-info">この記事は非公開に設定されています</div>
102     [% END %]
103
104   </header>
105
106   <div class="body contents-text">
107     [%- IF item.content_type == 'poll' -%]
108       [% INCLUDE common/poll/poll_body %]
109     [%- ELSIF item.content_type == 'vote' -%]
110       [% INCLUDE common/poll/vote_body %]
111     [%- END -%]
112   </div>
113
114   [%# TODO: fix intro_text, body_text, full_text process %]
115
116   [%- IF hide_bodytext %]
117
118   [%-   IF item.intro_text || x_template -%]
119   <div class="body contents-text" v-html="item.intro_text">[% item.intro_text %]</div>
120   [%-   END -%]
121
122   [%- ELSE %]
123
124   [%-   IF item.body_text || x_template -%]
125   <div class="body contents-text" v-html="item.intro_text">[% item.intro_text %]</div>
126   <div class="body contents-text" v-html="item.body_text">[% item.body_text %]</div>
127   [%-   ELSE %]
128   <div class="body contents-text" v-html="item.full_text">[% item.full_text %]</div>
129   [%-   END -%]
130
131   [%-   IF item.media || x_template %]
132   <div class="body contents-text" v-html="item.media">[% item.media %]</div>
133   [%-   END %]
134
135   [%- END %]
136
137   [%- IF x_template -%]
138   <div class="body contents-text" v-if="item.url"><p><a :href="item.url">情報元へのリンク</a></p></div>
139   [%- ELSIF item.url -%]
140   <div class="body contents-text"><p><a href="[% item.url %]">情報元へのリンク</a></p></div>
141   [%- END -%]
142
143   <footer>
144     [%- IF item.content_type == "feed" -%]
145     [%- # show nothing -%]
146     [%- ELSIF !hide_more_link-%]
147     [%- IF item.body_text && item.body_text.length > 0; next_text = "の続き"; ELSE; next_text = ""; END; -%]
148     <div class="link-to-story" v-if="mode == ''"><a href="[% url %]" :href="url">
149         [%- IF item.content_type == "poll" -%]
150         [%-   IF item.comment_count || x_template -%]
151         <span v-if='item.comment_count > 0'><span v-text="item.comment_count">[% item.comment_count %]</span>件のコメントを見る</span>
152         [%-   END -%]
153
154         [%-   IF !item.comment_count || x_template -%]<span v-if="item.comment_count == 0">投票結果を見る</span>[%- END -%]
155         [%- ELSE -%]
156         [%-   IF item.comment_count || x_template -%]
157         <span v-if="item.comment_count > 0">[% content_type_text %][% next_text %]と<span v-text="item.comment_count">[% item.comment_count %]</span>件のコメントを読む</span>
158         [%-   END -%]
159
160         [%-   IF !item.comment_count || x_template -%]
161         <span v-if="item.comment_count == 0">[% content_type_text %][% next_text %]を読む</span>
162         [%-   END -%]
163         [%- END -%]
164     </a></div>
165     [%- ELSE -%]
166     <div class="comment-counter">
167       [%-   IF item.discussion_id -%]
168       <a href="#comments"><span class="counter" v-text="item.comment_count">[% item.comment_count %]</span>コメント</a>
169       [%-   END -%]
170     </div>
171     [%- END -%]
172
173     <div class="tag-bar">
174       <ul class="tags">
175         [%- FOREACH tag IN item.tags -%]
176         [%- IF tag.private == "no" && tag.tagname != "mainpage" && tag.uid == item.uid -%]
177         <li><a href="/tag/[% tag.tagname %]">[% tag.tagname %]</a></li>
178         [%- END -%]
179         [%- END -%]
180       </ul>
181     </div>
182
183   </footer>
184 </article>