OSDN Git Service

now supporting url only submission
[newslash/newslash.git] / src / newslash_web / templates / common / article / article.html.tt2
1 [%-
2 USE dtf = DateTimeFormatter;
3 IF story.content_type == 'story'; content_id = story.sid; END;
4 IF story.content_type == 'journal'; content_id = story.id; END;
5 IF story.content_type == 'submission'; content_id = story.subid; END;
6 IF story.content_type == 'poll'; content_id = story.qid; END;
7 IF story.content_type == 'vote'; content_id = story.qid; END;
8
9 IF story.content_type == 'story'; url = "/story/" _ story.sid _ "/"; END;
10 IF story.content_type == 'journal'; url = "/journal/" _ story.id _ "/"; END;
11 IF story.content_type == 'submission'; url = "/submission/" _ story.id _ "/"; END;
12 IF story.content_type == 'comment'; url = "/comment/" _ story.id _ "/"; END;
13 IF story.content_type == 'poll'; url = "/poll/" _ story.id _ "/"; END;
14 -%]
15
16 <article id="[% story.id %]" type="[% story.content_type %]" item-id="[% content_id %]" [% IF !x_template %]v-if="0"[% END %]>
17   <header>
18     <h1>
19       [%- IF story.primary_topic.image.length || x_template -%]
20       <img [% IF story.primary_topic.image %]src="[% Site.topic_icon_base_url %]/[% story.primary_topic.image %]"[% END %]
21            :src="primaryTopicIconURL" v-if="primaryTopicIconURL" />
22       [%- END -%]
23       <a href="[% url %]" v-html="item.title">[% story.title %]</a>
24     </h1>
25
26     <div class="property">
27       <span class="content-type">
28         [%- IF story.content_type == 'story' -%]ストーリー[%- END -%]
29         [%- IF story.content_type == 'journal' -%]日記[%- END -%]
30         [%- IF story.content_type == 'submission' -%]タレコミ[%- END -%]
31         [%- IF story.content_type == 'comment' -%]コメント[%- END -%]
32         [%- IF story.content_type == 'poll' -%]国民投票[%- END -%]
33       </span>
34       <span class="author">
35         by <span v-text="item.author">[% story.author %]</span>
36       </span>
37       <span class="create-time" v-text="item.create_time">[% dtf.mysql_to_user(story.create_time, user.config.offset_sec, user.config.time_format) %]</span>
38       [% IF story.content_type == 'story' %]<span class="dept"><span v-text="item.dept" v-if="item.dept">[% story.dept %]</span> 部門より</span>[% END %]
39     </div>
40
41     <div class="toolbar" v-show="!editing">
42       [%- IF story.content_type == 'journal' && story.uid == user.uid || x_template -%]
43       <button type="button" class="btn btn-default btn-sm"
44               area-label="編集" v-show="editable" v-on:click="editItem(item)">
45         <span class="glyphicon glyphicon-pencil"></span>
46       </button>
47       [%- END -%]
48       [%- IF story.content_type == 'story' && user.is_admin || user.editor || x_template -%]
49       <button type="button" class="btn btn-default btn-sm" id="activate-editor"
50               area-label="編集" title="編集" v-on:click="editItem(item)"
51               v-if="editable">
52         <span class="glyphicon glyphicon-cog"></span>
53       </button>
54       [%- END -%]
55       [%- IF story.content_type == 'submission' && (user.author || x_template) -%]
56       [<a href="/admin/story/edit?subid=[% story.submission_id %]">accept</a>]
57       [%- END -%]
58     </div>
59   </header>
60
61   <div class="body contents-text">
62     [%- IF story.content_type == 'poll' -%]
63       [% INCLUDE common/poll/poll_body %]
64     [%- ELSIF story.content_type == 'vote' -%]
65       [% INCLUDE common/poll/vote_body %]
66     [%- END -%]
67   </div>
68
69   [%- IF story.introtext || x_template -%]
70   <div class="body contents-text" v-html="item.introtext">[% story.introtext %]</div>
71   [%- END -%]
72
73   [% IF story.bodytext && !hide_bodytext %]
74   <div class="body contents-text" v-html="item.bodytext">[% story.bodytext %]</div>
75   [% END %]
76
77   [%- IF x_template -%]
78   <div class="body contents-text" v-if="item.url"><p><a :href="item.url">情報元へのリンク</a></p></div>
79   [%- ELSIF story.url -%]
80   <div class="body contents-text"><p><a href="[% story.url %]">情報元へのリンク</a></p></div>
81   [%- END -%]
82
83   <footer>
84     [%- IF !hide_more_link -%]
85     <div class="link-to-story" v-if="!editing"><a href="[% url %]" :href="url">
86         [%- IF story.content_type == "poll" -%]
87         [%- IF story.commentcount || x_template -%]
88         <span v-if="item.commentcount > 0">投票結果と<span v-text="item.commentcount">[% story.commentcount %]</span>件のコメントを見る</span>
89         [%- END -%]
90         [%- IF !story.commentcount || x_template -%]<span v-if="item.commentcount == 0">投票結果を見る</span>[%- END -%]
91         [%- ELSE -%]
92         [%- link_target = "記事" -%]
93         [%- IF story.commentcount || x_template -%]
94         <span v-if="item.commentcount > 0">[% link_target %]と<span v-text="item.commentcount">[% story.commentcount %]</span>件のコメントを読む</span>
95         [%- END -%]
96         [%- IF !story.commentcount || x_template -%]
97         <span v-if="item.commentcount == 0">[% link_target %]を読む</span>
98         [%- END -%]
99         [%- END -%]
100     </a></div>
101     [%- ELSE -%]
102     <div class="comment-counter">
103       <a href="#comments"><span class="counter" v-text="item.commentcount">[% story.commentcount %]</span>コメント</a>
104     </div>
105     [%- END -%]
106
107     <div class="tag-bar">
108       <ul class="tags">
109         [%- FOREACH tag IN story.tags -%]
110         [%- IF tag.private == "no" && tag.tagname != "mainpage" && tag.uid == story.uid -%]
111         <li>[% tag.tagname %]</li>
112         [%- END -%]
113         [%- END -%]
114       </ul>
115     </div>
116
117   </footer>
118 </article>