OSDN Git Service

template: fix timestamp formatting
[newslash/newslash.git] / src / newslash_web / templates / common / article / article.html.tt2
1 [%-
2 IF story.content_type == 'story'; content_id = story.sid; END;
3 IF story.content_type == 'journal'; content_id = story.id; END;
4 IF story.content_type == 'submission'; content_id = story.subid; END;
5 -%]
6 <article type="[% story.content_type %]" item-id="[% content_id %]" [% IF !x_template %]v-if="0"[% END %]>
7   <header>
8     <h1>
9       [%- IF story.primary_topic.image.length || x_template -%]
10       <img [% IF story.primary_topic.image %]src="[% Site.topic_icon_base_url %]/[% story.primary_topic.image %]"[% END %]
11            :src="topicIconURL" v-if="topicIconURL" />
12       [%- END -%]
13       [%- IF story.content_type == 'story'; url = "/story/" _ story.sid _ "/"; END -%]
14       [%- IF story.content_type == 'journal'; url = "/journal/" _ story.id _ "/"; END -%]
15       [%- IF story.content_type == 'submission'; url = "/submission/" _ story.subid _ "/"; END -%]
16       [%- IF story.preview; url = "#"; END -%]
17       <a href="[% url %]" v-html="item.title">[% story.title %]</a>
18     </h1>
19     <div class="property">
20       <span class="content-type">
21         [%- IF story.content_type == 'story' -%]ストーリー[%- END -%]
22         [%- IF story.content_type == 'journal' -%]日記[%- END -%]
23         [%- IF story.content_type == 'submission' -%]タレコミ[%- END -%]
24       </span>
25       by <span v-text="item.author">[% story.author %]</span>
26       <span v-text="formatDateTime(item.time)">[% story.time_string %]</span>
27       [% IF story.content_type == 'story' %]<span v-text="item.dept">[% story.dept %]</span> 部門より[% END %]
28     </div>
29     <div class="toolbar" v-show="!editing">
30       [%- IF story.content_type == 'journal' && story.uid == user.uid || x_template -%]
31       <button type="button" class="btn btn-default btn-sm"
32               area-label="編集" v-show="editable" v-on:click="editItem(item)">
33         <span class="glyphicon glyphicon-pencil"></span>
34       </button>
35       [%- END -%]
36       [%- IF story.content_type == 'submission' && user.author || x_template -%]
37       [<a href="/admin/story/edit?subid=[% story.submission_id %]">accept</a>]
38       [%- END -%]
39     </div>
40   </header>
41   <div class="body contents-text" v-html="item.introtext">[% story.introtext %]</div>
42   [% IF !hide_bodytext %]<div class="body contents-text" v-html="item.bodytext">[% story.bodytext %]</div>[% END %]
43   <footer>
44     [%- IF !hide_more_link -%]
45     <div class="link-to-story"><a href="[% url %]" :href="url">
46         [%- IF story.commentcount || x_template -%]
47         <span v-if="item.commentcount > 0">記事と<span v-text="item.commentcount">[% story.commentcount %]</span>件のコメントを読む</span>
48         [%- END -%]
49         [%- IF !story.commentcount || x_template -%]
50         <span v-if="item.commentcount == 0">記事を読む</span>
51         [%- END -%]
52     </a></div>
53     [%- ELSE -%]
54     <div class="comment-counter">
55       <a href="#comments"><span class="counter" v-text="item.commentcount">[% story.commentcount %]</span>コメント</a>
56     </div>
57     [%- END -%]
58     <div class="tag-bar">
59       <ul class="tags">
60         [%- FOREACH topic IN story.topics -%]
61         <li>[% topic.textname %]</li>
62         [%- END -%]
63       </ul>
64     </div>
65   </footer>
66 </article>