element.html.twig 19KB

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