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