element.html.twig 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. {% if display_edit_actions is not defined %}
  2. {% set display_edit_actions = true %}
  3. {% endif %}
  4. {% if display_social_buttons is not defined %}
  5. {% set display_social_buttons = true %}
  6. {% endif %}
  7. {% if display_player is not defined %}
  8. {% set display_player = true %}
  9. {% endif %}
  10. {% if display_comments is not defined %}
  11. {% set display_comments = true %}
  12. {% endif %}
  13. {% if his_group is not defined %}
  14. {% set his_group = false %}
  15. {% endif %}
  16. {% if display_autoplay is not defined %}
  17. {% set display_autoplay = false %}
  18. {% endif %}
  19. {% if tag_ids_json is not defined %}
  20. {% set tag_ids_json = '[]' %}
  21. {% endif %}
  22. {% if display_tags_proposition is not defined %}
  23. {% set display_tags_proposition = false %}
  24. {% endif %}
  25. <table>
  26. <tr>
  27. <td class="element_thumbnail">
  28. {% if element.embed %}
  29. <a href="#" class="a_thumbnail {% if display_player %}element_open element_embed_open_link{% endif %} {% if element.embed and display_player %}embed{% else %}noembed{% endif %}">
  30. <img class="play" style="display: none;" src="{{ asset('bundles/muzichcore/img/1328283150_media-playback-start.png') }}" alt="" />
  31. <img
  32. class="element_thumbnail"
  33. {% if element.thumbnailUrl %}
  34. src="{{ element.thumbnailUrl }}"
  35. {% else %}
  36. src="{{ asset('bundles/muzichcore/img/nothumb.png') }}"
  37. {% endif %}
  38. title="{{ 'element.show.open_embed'|trans({}, 'elements') }}"
  39. alt=""
  40. />
  41. </a>
  42. {% else %}
  43. <a href="{{ element.url }}" class="a_thumbnail element_open {% if element.embed %}embed{% else %}noembed{% endif %}" target="_blank">
  44. <img class="open" style="display: none;" src="{{ asset('bundles/muzichcore/img/1328283201_emblem-symbolic-link.png') }}" alt="" />
  45. <img
  46. class="element_thumbnail"
  47. {% if element.thumbnailUrl %}
  48. src="{{ element.thumbnailUrl }}"
  49. {% else %}
  50. src="{{ asset('bundles/muzichcore/img/nothumb.png') }}"
  51. {% endif %}
  52. title="{{ 'element.show.open_embed'|trans({}, 'elements') }}"
  53. alt=""
  54. />
  55. </a>
  56. {% endif %}
  57. <ul class="element_thumb_actions">
  58. <li class="score">
  59. {{ element.points|format_score }}
  60. </li>
  61. <li class="vote thumb">
  62. {% if app.user %}
  63. {% if element.owner.id != app.user.id %}
  64. {% if element.hasVoteGood(app.user.id) %}
  65. <a class="vote" href="{{ path('ajax_element_remove_vote_good', {
  66. 'element_id' : element.id,
  67. 'token' : app.user.getPersonalHash(element.id)
  68. }) }}" title="{{ 'element.vote.good'|trans({}, 'elements') }}">
  69. <img src="{{ asset('img/icon_thumb_red.png') }}" alt="vote" />
  70. </a>
  71. {% else %}
  72. <a class="vote" href="{{ path('ajax_element_add_vote_good', {
  73. 'element_id' : element.id,
  74. 'token' : app.user.getPersonalHash(element.id)
  75. }) }}" title="{{ 'element.vote.good'|trans({}, 'elements') }}">
  76. <img src="{{ asset('img/icon_thumb.png') }}" alt="vote" />
  77. </a>
  78. {% endif %}
  79. {% else %}
  80. <img src="{{ asset('img/icon_thumb_gray.png') }}" alt="vote" />
  81. {% endif %}
  82. {% else %}
  83. <a href="#" class="mustbeconnected">
  84. <img src="{{ asset('img/icon_thumb.png') }}" alt="vote" />
  85. </a>
  86. {% endif %}
  87. </li>
  88. <li class="star">
  89. {% if not element.private %}
  90. {% if app.user %}
  91. {% if element.hasFavoriteUser(app.user.id) %}
  92. <a class="favorite_link" href="{{ path('favorite_remove', { 'id': element.id, 'token': app.user.personalHash(element.id) }) }}" >
  93. <img id="favorite_{{ element.id }}_is" src="{{ asset('img/icon_star_2_red.png') }}" title="{{ 'element.favorite.remove'|trans({}, 'elements') }}" alt="{{ 'element.favorite.remove'|trans({}, 'elements') }}"/>
  94. </a>
  95. {% else %}
  96. <a class="favorite_link" href="{{ path('favorite_add', { 'id': element.id, 'token': app.user.personalHash(element.id) }) }}" >
  97. <img id="favorite_{{ element.id }}_isnot" src="{{ asset('img/icon_star_2.png') }}" title="{{ 'element.favorite.add'|trans({}, 'elements') }}" alt="{{ 'element.favorite.add'|trans({}, 'elements') }}" />
  98. </a>
  99. {% endif %}
  100. {% else %}
  101. <a class="mustbeconnected" href="#" >
  102. <img src="{{ asset('img/icon_star_2.png') }}" title="{{ 'element.favorite.add'|trans({}, 'elements') }}" alt="{{ 'element.favorite.add'|trans({}, 'elements') }}" />
  103. </a>
  104. {% endif %}
  105. {% else %}
  106. <img src="{{ asset('img/icon_star_2_gray.png') }}" alt="favorite" />
  107. {% endif %}
  108. </li>
  109. </ul>
  110. </td>
  111. <td class="element_content">
  112. <ul class="element_links_actions" class="gradient">
  113. <li class="element_link">
  114. <a title="{{ 'element.link'|trans({}, 'elements') }}" class="element_link" href="{{ element.url }}" target="_blank">
  115. <img src="{{ asset('/img/icon_link.png') }}" alt="link" />
  116. </a>
  117. </li>
  118. {% if display_autoplay and element|can_autoplay %}
  119. <li class="element_autoplay">
  120. <a title="{{ 'element.autoplay.title'|trans({}, 'elements') }}"
  121. data-element_id="{{ element.id }}"
  122. class="autoplay_link"
  123. {% if autoplay_context == 'home' %}
  124. href="{{ path('elements_get_filter_data_autoplay', {
  125. 'element_id' : element.id,
  126. 'type' : 'filter'
  127. }) }}"
  128. {% endif %}
  129. {% if autoplay_context == 'show_user' %}
  130. href="{{ path('elements_get_filter_data_autoplay_show', {
  131. 'element_id' : element.id,
  132. 'show_type' : 'user',
  133. 'show_id' : viewed_user.id,
  134. 'data' : tag_ids_json
  135. }) }}"
  136. {% endif %}
  137. {% if autoplay_context == 'show_group' %}
  138. href="{{ path('elements_get_filter_data_autoplay_show', {
  139. 'element_id' : element.id,
  140. 'show_type' : 'group',
  141. 'show_id' : group.id,
  142. 'data' : tag_ids_json
  143. }) }}"
  144. {% endif %}
  145. {% if autoplay_context == 'favorite_my' %}
  146. href="{{ path('elements_get_filter_data_autoplay_favorite', {
  147. 'element_id' : element.id,
  148. 'show_type' : 'user',
  149. 'show_id' : app.user.id,
  150. 'data' : tag_ids_json
  151. }) }}"
  152. {% endif %}
  153. {% if autoplay_context == 'favorite_user' %}
  154. href="{{ path('elements_get_filter_data_autoplay_favorite', {
  155. 'element_id' : element.id,
  156. 'show_type' : 'user',
  157. 'show_id' : viewed_user.id,
  158. 'data' : tag_ids_json
  159. }) }}"
  160. {% endif %}
  161. target="_blank"
  162. >
  163. <img src="{{ asset('/img/1361037350_control_play.png') }}" alt="playlist" />
  164. </a>
  165. </li>
  166. {% endif %}
  167. {% if app.user %}
  168. {% if app.user.id != element.owner.id %}
  169. {% if display_edit_actions %}
  170. <li class="element_propose_tags">
  171. <a title="{{ 'element.proposition_tags.link_title'|trans({}, 'userui') }}"
  172. class="element_propose_tags"
  173. href="{{ path('ajax_element_propose_tags_open', {'element_id' : element.id}) }}">
  174. <img src="{{ asset('img/tag.png') }}" alt="tags_proposition" />
  175. </a>
  176. </li>
  177. <li class="element_reshare">
  178. <a title="{{ 'element.reshare.link_title'|trans({}, 'userui') }}"
  179. class="element_reshare"
  180. href="{{ path('ajax_reshare_element', {'element_id':element.id, 'token':app.user.getPersonalHash('reshare_'~element.id)}) }}">
  181. <img src="{{ asset('/img/icon_reload.png') }}" alt="re" />
  182. </a>
  183. </li>
  184. <li class="element_report">
  185. <a title="{{ 'element.report.link_title'|trans({}, 'userui') }}"
  186. class="element_report"
  187. href="{{ path('ajax_report_element', {'element_id':element.id, 'token':app.user.getPersonalHash(element.id)}) }}">
  188. <img src="{{ asset('/img/icon_alert.png') }}" alt="report" />
  189. </a>
  190. </li>
  191. {% endif %}
  192. {% endif %}
  193. {% if app.user.id == element.owner.id %}
  194. {% if display_edit_actions %}
  195. {% if element.hasTagProposition %}
  196. <li class="element_view_propositions_link">
  197. <a title="{{ 'element.view_propositions.link'|trans({}, 'elements') }}" class="element_view_propositions_link"
  198. href="{{ path('ajax_element_proposed_tags_view', {'element_id' : element.id}) }}"
  199. >
  200. <img src="{{ asset('img/tag_color.png') }}" alt="tags proposition" />
  201. </a>
  202. </li>
  203. {% endif %}
  204. <li class="element_edit_link">
  205. <a title="{{ 'element.edit.link'|trans({}, 'elements') }}" class="element_edit_link"
  206. href="{{ path('element_edit', {'element_id' : element.id}) }}"
  207. >
  208. <img src="{{ asset('/img/icon_pen.png') }}" alt="edit" />
  209. </a>
  210. </li>
  211. <li class="element_remove_link">
  212. <a title="{{ 'element.remove.link'|trans({}, 'elements') }}" class="element_remove_link"
  213. href="{{ path('element_remove', {'element_id' : element.id, 'token':app.user.getPersonalHash(element.id)}) }}"
  214. >
  215. <img src="{{ asset('/img/icon_close_2.png') }}" alt="delete" />
  216. </a>
  217. </li>
  218. {% endif %}
  219. {% endif %}
  220. {% else %}
  221. <li class="element_propose_tags">
  222. <a title="{{ 'element.proposition_tags.link_title'|trans({}, 'userui') }}"
  223. class="mustbeconnected"
  224. href="#">
  225. <img src="{{ asset('bundles/muzichcore/img/1333484018_rss-tag.png') }}" alt="tags_proposition" />
  226. </a>
  227. </li>
  228. <li class="element_reshare">
  229. <a title="{{ 'element.reshare.link_title'|trans({}, 'userui') }}"
  230. class="mustbeconnected"
  231. href="#">
  232. <img src="{{ asset('/img/icon_reload.png') }}" alt="re" />
  233. </a>
  234. </li>
  235. <li class="element_report">
  236. <a title="{{ 'element.report.link_title'|trans({}, 'userui') }}"
  237. class="mustbeconnected"
  238. href="#">
  239. <img src="{{ asset('/img/icon_alert.png') }}" alt="report" />
  240. </a>
  241. </li>
  242. {% endif %}
  243. {% if his_group %}
  244. <li class="remove_from_group">
  245. <a title="{{ 'element.group.remove_from.title'|trans({'%group_name%':group.name}, 'elements') }}"
  246. class="element_remove_from_group_link"
  247. href="{{ path('element_remove_from_group', {
  248. 'element_id' : element.id,
  249. 'group_id' : group.id,
  250. 'token' : app.user.getPersonalHash('remove_from_group_'~element.id)
  251. }) }}">
  252. <img src="{{ asset('/img/1360779431_Remove_gray.png') }}" alt="remove from group" />
  253. </a>
  254. </li>
  255. {% endif %}
  256. {% if not element.private %}
  257. <li>
  258. <a
  259. class="add_to_playlist"
  260. href="{{ path('playlists_add_element_prompt', { 'element_id' : element.id }) }}"
  261. title="{{ 'playlist.add_this_element'|trans({}, 'elements') }}"
  262. >
  263. <img src="{{ asset('/img/playlist_add_gray.png') }}" alt="add to playlist" />
  264. </a>
  265. </li>
  266. {% endif %}
  267. </ul>
  268. <span class="element_name">
  269. {% if element.embed %}
  270. <a href="{{ path('element_show_one', {
  271. 'element_id' : element.id,
  272. 'element_slug' : element.slug
  273. }) }}" class="element_open element_name_embed_open_link">
  274. {{ element.name }}
  275. </a>
  276. {% else %}
  277. <a href="{{ path('element_show_one', {
  278. 'element_id' : element.id,
  279. 'element_slug' : element.slug
  280. }) }}" class="element_open" target="_blank">
  281. {{ element.name }}
  282. </a>
  283. {% endif %}
  284. </span>
  285. <br />
  286. {% autoescape false %}
  287. {% if element.group and no_group_name is not defined%}
  288. {{ 'element.name.whoandgroup'|trans({
  289. '%owner_url%' : path('show_user', {'slug': element.owner.slug}),
  290. '%owner_name%' : element.owner.name,
  291. '%group_url%' : path('show_group', {'slug': element.group.slug}),
  292. '%group_name%' : element.group.name
  293. }, 'elements') }}
  294. {% else %}
  295. {{ 'element.name.who'|trans({
  296. '%owner_url%' : path('show_user', {'slug': element.owner.slug}),
  297. '%owner_name%' : element.owner.name
  298. }, 'elements') }}
  299. {% endif %}
  300. {{ element.created.date|date_or_relative_date }}
  301. {% if element.parent %}
  302. {{ 'element.name.reshare'|trans({
  303. '%owner_url%' : path('show_user', {'slug': element.parent.owner.slug}),
  304. '%owner_name%' : element.parent.owner.name
  305. }, 'elements') }}
  306. {% endif %}
  307. {% endautoescape %}
  308. <div class="loader">
  309. <img class="element_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
  310. </div>
  311. {% if element.tags|length %}
  312. <ul class="element_tags">
  313. {% for tag in element.tags %}
  314. <li class="element_tag">
  315. <a id="element_tag_{{ tag.id }}" href="#"
  316. class="element_tag button {% if app.user %}{% if app.user.haveTagsFavorite(tag.id) %}element_tag_large_for_fav_still{% endif %}{% endif %}"
  317. >
  318. {{ tag.name }}
  319. </a>
  320. {% if app.user %}
  321. {% if app.user.haveTagsFavorite(tag.id) %}
  322. <img class="tag_to_favorites" src="{{ asset('/img/icon_heart.png') }}"
  323. alt="add-to-favorites"
  324. title="{{ 'element.tag.isfav.title'|trans({'%tagname%':tag.name}, 'elements') }}"
  325. />
  326. {% else %}
  327. <a
  328. href="{{ path('ajax_tag_add_to_favorites', {
  329. 'tag_id' : tag.id,
  330. 'token' : app.user.getPersonalHash(tag.id)
  331. }) }}"
  332. class="tag_to_favorites out button"
  333. style="display: none;"
  334. title="{{ 'element.tag.addtofav.title'|trans({}, 'elements') }}"
  335. >
  336. <img class="tag_add_to_favorites" src="{{ asset('/img/icon_heart_add.png') }}" alt="add-to-favorites"/>
  337. </a>
  338. {% endif %}
  339. {% else %}
  340. <a
  341. href="#"
  342. class="tag_to_favorites mustbeconnected"
  343. style="display: none;"
  344. title="{{ 'element.tag.addtofav.title'|trans({}, 'elements') }}"
  345. >
  346. <img class="tag_add_to_favorites" src="{{ asset('/img/icon_heart.png') }}" alt="add-to-favorites"/>
  347. </a>
  348. {% endif %}
  349. </li>
  350. {% endfor %}
  351. </ul>
  352. {% endif %}
  353. <a href="#" class="button element_open element_embed_close_link" style="display: none;">
  354. {{ 'element.show.close_embed'|trans({}, 'elements') }}
  355. </a>
  356. {% if display_comments %}
  357. {% autoescape false %}
  358. {% if element.comments|length > 1 %}
  359. <a href="#hide_comments_{{ element.id }}" class="hide_comments" style="display: none;">
  360. {{ 'element.comments.hideare'|trans({}, 'elements') }}
  361. </a>
  362. <a href="#comments_{{ element.id }}" class="display_comments">
  363. {{ 'element.comments.thereare'|trans({'%count%':element.comments|length}, 'elements') }}
  364. </a>
  365. {% elseif element.comments|length == 1 %}
  366. <a href="#hide_comments_{{ element.id }}" class="hide_comments" style="display: none;">
  367. {{ 'element.comments.hideis'|trans({}, 'elements') }}
  368. </a>
  369. <a href="#comments_{{ element.id }}" class="display_comments">
  370. {{ 'element.comments.thereis'|trans({}, 'elements') }}
  371. </a>
  372. {%endif %}
  373. {% endautoescape %}
  374. <a href="#add_comment_{{ element.id }}" class="add_comment">
  375. {{ 'element.comments.add'|trans({}, 'elements') }}
  376. </a>
  377. {% endif %}
  378. {% if display_social_buttons %}
  379. {% set permalink = 'https:' ~ url('element_show_one', {
  380. 'element_id' : element.id,
  381. 'element_slug' : element.slug
  382. }, true) %}
  383. {% set element_title = 'Muzich - ' ~ element.name %}
  384. <div class="social_buttons">
  385. <ul>
  386. <li class="facebook">
  387. <a target="_blank" title="Facebook" href="https://www.facebook.com/sharer.php?u={{ permalink }}&t={{ element_title }}" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;"><img src="{{ asset('/img/1387489343_facebook_square.png') }}" alt="Facebook" /></a>
  388. </li>
  389. <li class="twitter">
  390. <a target="_blank" title="Twitter" href="https://twitter.com/share?url={{ permalink }}&text={{ element_title }}&via=korben" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;"><img src="{{ asset('/img/1387489330_twitter_square.png') }}" alt="Twitter" /></a>
  391. </li>
  392. <li class="googleplus">
  393. <a target="_blank" title="Google +" href="https://plus.google.com/share?url={{ permalink }}&hl=fr" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"><img src="{{ asset('/img/1387489316_google_square.png') }}" alt="Google Plus" /></a>
  394. </li>
  395. <li class="mail">
  396. <a target="_blank" title="Envoyer par mail" href="mailto:?subject={{ element_title }}&body={{ permalink }}" rel="nofollow"><img src="{{ asset('/img/1387489139_aiga_mail.png') }}" alt="email" /></a>
  397. </li>
  398. </ul>
  399. </div>
  400. {% endif %}
  401. </td>
  402. </tr>
  403. </table>
  404. {% if ids_display is defined %}
  405. {% if ids_display == event_const('TYPE_TAGS_PROPOSED') %}
  406. {% include 'MuzichCoreBundle:Element:tag.propositions.html.twig' with {
  407. 'propositions' : element.getTagsProposition,
  408. 'element_id' : element.id
  409. } %}
  410. {% endif %}
  411. {% endif %}
  412. {% if display_tags_proposition %}
  413. {% include 'MuzichCoreBundle:Element:tag.propositions.html.twig' with {
  414. 'propositions' : element.tagsProposition,
  415. 'element_id' : element.id
  416. } %}
  417. {% endif %}
  418. {% if display_player %}
  419. <div id="embed_{{ element.id }}" class="element_embed" style="display: none;"></div>
  420. {% endif %}
  421. {% if display_comments %}
  422. <div class="comments" style="display: none;">
  423. <ul class="comments">
  424. {% if element.comments|length %}
  425. {% for comment in element.comments %}
  426. {% include "MuzichCommentBundle:Comment:li.comment.html.twig" with {'element_id' : element.id} %}
  427. {% endfor %}
  428. {% endif %}
  429. </ul>
  430. <div class="comments_loader">
  431. <img class="comments_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading"/>
  432. </div>
  433. <form
  434. action="{{ path('ajax_add_comment', {'element_id':element.id, 'token' : token_or_unknow(app.user)}) }}"
  435. method="post"
  436. name="add_comment"
  437. style="display: none;"
  438. class="add_comment"
  439. >
  440. {% include "MuzichCommentBundle:Comment:form.html.twig" with {
  441. 'submit_value' : 'element.comments.add_submit'|trans({}, 'elements'),
  442. 'cancel_value' : 'element.comments.add_cancel'|trans({}, 'elements'),
  443. 'following' : element.userFollowComments(app.user|userId),
  444. 'own' : (app.user|userId == element.owner.id)
  445. } %}
  446. </form>
  447. <a href="#add_comment_{{ element.id }}" class="add_comment">
  448. {{ 'element.comments.add'|trans({}, 'elements') }}
  449. </a>
  450. </div>
  451. {% endif %}