Added frontend links to article management
[GitHub/WoltLab/WCF.git] / com.woltlab.wcf / templates / article.tpl
1 {capture assign='pageTitle'}{$articleContent->title}{/capture}
2
3 {capture assign='contentHeader'}
4 <header class="contentHeader articleContentHeader">
5 <div class="contentHeaderTitle">
6 <h1 class="contentTitle">{$articleContent->title}</h1>
7 <div class="contentHeaderDescription">
8 {$articleContent->getArticle()->getCategory()->getTitle()}
9 </div>
10 <ul class="inlineList contentHeaderMetaData articleMetaData">
11 <li>
12 <span class="icon icon16 fa-user"></span>
13 {if $article->userID}
14 <a href="{link controller='User' id=$article->userID title=$article->username}{/link}" class="userLink" data-user-id="{@$article->userID}">{$article->username}</a>
15 {else}
16 {$article->username}
17 {/if}
18 </li>
19
20 <li>
21 <span class="icon icon16 fa-clock-o"></span>
22 {@$article->time|time}
23 </li>
24
25 <li>
26 <span class="icon icon16 fa-comments"></span>
27 {lang}wcf.article.articleComments{/lang}
28 </li>
29
30 <li>
31 <span class="icon icon16 fa-eye"></span>
32 {lang}wcf.article.articleViews{/lang}
33 </li>
34
35 <li class="articleLikesBadge"></li>
36 </ul>
37 </div>
38
39 {hascontent}
40 <nav class="contentHeaderNavigation">
41 <ul>
42 {content}
43 {if $__wcf->getSession()->getPermission('admin.content.article.canManageArticle')}<li><a href="{link controller='ArticleEdit' id=$article->articleID isACP=true}{/link}" class="button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.acp.article.edit{/lang}</span></a></li>{/if}
44 {event name='contentHeaderNavigation'}
45 {/content}
46 </ul>
47 </nav>
48 {/hascontent}
49 </header>
50 {/capture}
51
52 {capture assign='headContent'}
53 {if $article->isMultilingual}
54 {foreach from=$article->getLanguageLinks() item='langArticleContent'}
55 {if $langArticleContent->getLanguage()}
56 <link rel="alternate" hreflang="{$langArticleContent->getLanguage()->languageCode}" href="{$langArticleContent->getLink()}" />
57 {/if}
58 {/foreach}
59 {/if}
60 {/capture}
61
62 {include file='header'}
63
64 {if $articleContent->getImage()}
65 <section class="section">
66 <figure class="articleImage">
67 <div class="articleImageWrapper">{@$articleContent->getImage()->getThumbnailTag('large')}</div>
68 {if $articleContent->getImage()->caption}
69 <figcaption>{$articleContent->getImage()->caption}</figcaption>
70 {/if}
71 </figure>
72 </section>
73 {/if}
74
75 <section class="section articleContent"
76 data-object-id="{@$article->articleID}"
77 data-object-type="com.woltlab.wcf.likeableArticle" data-like-liked="{if $articleLikeData[$article->articleID]|isset}{@$articleLikeData[$article->articleID]->liked}{/if}" data-like-likes="{if $articleLikeData[$article->articleID]|isset}{@$articleLikeData[$article->articleID]->likes}{else}0{/if}" data-like-dislikes="{if $articleLikeData[$article->articleID]|isset}{@$articleLikeData[$article->articleID]->dislikes}{else}0{/if}" data-like-users='{ {if $articleLikeData[$article->articleID]|isset}{implode from=$articleLikeData[$article->articleID]->getUsers() item=likeUser}"{@$likeUser->userID}": "{$likeUser->username|encodeJSON}"{/implode}{/if} }' data-user-id="{@$article->userID}"
78 >
79 <div class="htmlContent">
80 {if $articleContent->teaser}
81 <p class="articleTeaser">{$articleContent->teaser}</p>
82 {/if}
83
84 {@$articleContent->getFormattedContent()}
85 </div>
86
87 {if !$tags|empty}
88 <ul class="tagList articleTagList">
89 {foreach from=$tags item=tag}
90 <li><a href="{link controller='Tagged' object=$tag}objectType=com.woltlab.wcf.article{/link}" class="articleTag">{$tag->name}</a></li>
91 {/foreach}
92 </ul>
93 {/if}
94
95 <div class="articleLikesSummery"></div>
96
97 <ul class="articleLikeButtons buttonGroup"></ul>
98
99 {if $article->isMultilingual}
100 {foreach from=$article->getLanguageLinks() item='langArticleContent'}
101 {if $langArticleContent->getLanguage() && $langArticleContent->languageID != $articleContent->languageID}
102 <a href="{$langArticleContent->getLink()}">{$langArticleContent->getLanguage()->languageName}</a>
103 {/if}
104 {/foreach}
105 {/if}
106
107 {if ENABLE_SHARE_BUTTONS}
108 <section class="section jsOnly">
109 <h2 class="sectionTitle">{lang}wcf.message.share{/lang}</h2>
110
111 {include file='shareButtons'}
112 </section>
113 {/if}
114 </section>
115
116 {if ARTICLE_SHOW_ABOUT_AUTHOR}
117 <div class="section articleAboutAuthor">
118 <h2 class="sectionTitle">{lang}wcf.article.aboutAuthor{/lang}</h2>
119
120 <div class="box128">
121 <span class="articleAboutAuthorAvatar">{@$article->getUserProfile()->getAvatar()->getImageTag(128)}</span>
122
123 <div>
124 <div class="articleAboutAuthorText">{$article->getUserProfile()->aboutMe}</div>
125
126 <div class="articleAboutAuthorUsername">
127 <a href="{link controller='User' object=$article->getUserProfile()->getDecoratedObject()}{/link}" class="username userLink" data-user-id="{@$article->getUserProfile()->userID}" rel="author">{if MESSAGE_SIDEBAR_ENABLE_USER_ONLINE_MARKING}{@$article->getUserProfile()->getFormattedUsername()}{else}{$article->getUserProfile()->username}{/if}</a>
128
129 {if MODULE_USER_RANK}
130 {if $article->getUserProfile()->getUserTitle()}
131 <span class="badge userTitleBadge{if $article->getUserProfile()->getRank() && $article->getUserProfile()->getRank()->cssClassName} {@$article->getUserProfile()->getRank()->cssClassName}{/if}">{$article->getUserProfile()->getUserTitle()}</span>
132 {/if}
133 {if $article->getUserProfile()->getRank() && $article->getUserProfile()->getRank()->rankImage}
134 <span class="userRank">{@$article->getUserProfile()->getRank()->getImage()}</span>
135 {/if}
136 {/if}
137 </div>
138 </div>
139 </div>
140 </div>
141 {/if}
142
143 <footer class="contentFooter">
144 {hascontent}
145 <nav class="contentFooterNavigation">
146 <ul>
147 {content}{event name='contentFooterNavigation'}{/content}
148 </ul>
149 </nav>
150 {/hascontent}
151 </footer>
152
153 {if $previousArticle || $nextArticle}
154 <div class="section articleNavigation">
155 <nav>
156 <ul>
157 {if $previousArticle}
158 <li class="previousArticleButton">
159 <a href="{$previousArticle->getLink()}" rel="prev">
160 {if $previousArticle->getImage()}
161 <div class="box96">
162 <span class="articleNavigationArticleImage">{@$previousArticle->getImage()->getElementTag(96)}</span>
163
164 <div>
165 <span class="articleNavigationEntityName">{lang}wcf.article.previousArticle{/lang}</span>
166 <span class="articleNavigationArticleTitle">{$previousArticle->getTitle()}</span>
167 </div>
168 </div>
169 {else}
170 <div>
171 <span class="articleNavigationEntityName">{lang}wcf.article.previousArticle{/lang}</span>
172 <span class="articleNavigationArticleTitle">{$previousArticle->getTitle()}</span>
173 </div>
174 {/if}
175 </a>
176 </li>
177 {/if}
178
179 {if $nextArticle}
180 <li class="nextArticleButton">
181 <a href="{$nextArticle->getLink()}" rel="next">
182 {if $nextArticle->getImage()}
183 <div class="box96">
184 <span class="articleNavigationArticleImage">{@$nextArticle->getImage()->getElementTag(96)}</span>
185
186 <div>
187 <span class="articleNavigationEntityName">{lang}wcf.article.nextArticle{/lang}</span>
188 <span class="articleNavigationArticleTitle">{$nextArticle->getTitle()}</span>
189 </div>
190 </div>
191 {else}
192 <div>
193 <span class="articleNavigationEntityName">{lang}wcf.article.nextArticle{/lang}</span>
194 <span class="articleNavigationArticleTitle">{$nextArticle->getTitle()}</span>
195 </div>
196 {/if}
197 </a>
198 </li>
199 {/if}
200 </ul>
201 </nav>
202 </div>
203 {/if}
204
205 {if $relatedArticles|count}
206 <section class="section relatedArticles">
207 <h2 class="sectionTitle">{lang}wcf.article.relatedArticles{/lang}</h2>
208
209 <ul class="articleList">
210 {foreach from=$relatedArticles item='relatedArticle'}
211 <li>
212 <a href="{$relatedArticle->getLink()}">
213 {if $relatedArticle->getImage()}
214 <div class="box128">
215 <div class="articleListImage">{@$relatedArticle->getImage()->getThumbnailTag('tiny')}</div>
216 {/if}
217
218 <div>
219 <div class="containerHeadline">
220 <h3 class="articleListTitle">{$relatedArticle->getTitle()}</h3>
221 <ul class="inlineList articleListMetaData">
222 <li>
223 <span class="icon icon16 fa-clock-o"></span>
224 {@$relatedArticle->time|time}
225 </li>
226
227 <li>
228 <span class="icon icon16 fa-comments"></span>
229 {lang article=$relatedArticle}wcf.article.articleComments{/lang}
230 </li>
231
232 {if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike')}
233 <li>
234 {if $relatedArticle->likes || $relatedArticle->dislikes}
235 <span class="icon icon16 fa-thumbs-o-{if $relatedArticle->cumulativeLikes < 0}down{else}up{/if} jsTooltip" title="{lang likes=$relatedArticle->likes dislikes=$relatedArticle->dislikes}wcf.like.tooltip{/lang}"></span>
236 {if $relatedArticle->cumulativeLikes > 0}+{elseif $relatedArticle->cumulativeLikes == 0}&plusmn;{/if}{#$relatedArticle->cumulativeLikes}
237 {/if}
238 </li>
239 {/if}
240 </ul>
241 </div>
242
243 <div class="containerContent articleListTeaser">
244 {$relatedArticle->getTeaser()}
245 </div>
246 </div>
247
248 {if $relatedArticle->getImage()}
249 </div>
250 {/if}
251 </a>
252 </li>
253 {/foreach}
254 </ul>
255 </section>
256 {/if}
257
258 {if $article->enableComments}
259 {if $commentList|count || $commentCanAdd}
260 <section class="section sectionContainerList">
261 <h2 class="sectionTitle">{lang}wcf.article.comments{/lang}{if $article->comments} <span class="badge">{#$article->comments}</span>{/if}</h2>
262
263 {include file='__commentJavaScript' commentContainerID='articleCommentList'}
264
265 <ul id="articleCommentList" class="commentList containerList" data-can-add="{if $commentCanAdd}true{else}false{/if}" data-object-id="{@$articleContentID}" data-object-type-id="{@$commentObjectTypeID}" data-comments="{@$commentList->countObjects()}" data-last-comment-time="{@$lastCommentTime}">
266 {include file='commentList'}
267 </ul>
268 </section>
269 {/if}
270 {/if}
271
272 {if MODULE_LIKE && ARTICLE_ENABLE_LIKE}
273 <script data-relocate="true">
274 require(['WoltLab/WCF/Ui/Like/Handler'], function(UiLikeHandler) {
275 new UiLikeHandler('com.woltlab.wcf.likeableArticle', {
276 // settings
277 isSingleItem: true,
278
279 // permissions
280 canDislike: {if LIKE_ENABLE_DISLIKE}true{else}false{/if},
281 canLike: {if $__wcf->getUser()->userID}true{else}false{/if},
282 canLikeOwnContent: {if LIKE_ALLOW_FOR_OWN_CONTENT}true{else}false{/if},
283 canViewSummary: {if LIKE_SHOW_SUMMARY}true{else}false{/if},
284
285 // selectors
286 badgeContainerSelector: '.articleLikesBadge',
287 buttonAppendToSelector: '.articleLikeButtons',
288 containerSelector: '.articleContent',
289 summarySelector: '.articleLikesSummery'
290 });
291 });
292 </script>
293 {/if}
294
295 {include file='footer'}