- @page_title = t('workarea.admin.comments.index.title', name: @commentable.name ) .comments.view .view__header .grid.grid--middle.grid--right .grid__cell.grid__cell--50 .view__heading = link_to_index_for(@commentable) %h1= link_to @commentable.name, url_for(@commentable) .grid__cell.grid__cell--25 = render_aux_navigation_for(@commentable) .view__container = render_cards_for(@commentable, :comments) .view__container.view__container--narrow .section %ul.comments__comment-group - @comments.each do |comment| %li.comments__comment .comments__comment-header - if comment.author.present? .comments__comment-avatar = link_to user_path(comment.author) do = avatar_for comment.author, additional_css_class: 'avatar' %h3.comments__comment-author= link_to comment.author_name, user_path(comment.author) %p.comments__comment-time #{time_ago_in_words(comment.created_at)} ago .comments__comment-actions - if comment.author == current_user .grid.grid--auto %p.grid__cell = link_to edit_commentable_comment_path(@commentable.to_global_id, comment), class: 'text-button' do = t('workarea.admin.actions.edit') = inline_svg('workarea/admin/icons/edit.svg', class: 'text-button__icon') = form_tag commentable_comment_path(@commentable.to_global_id, comment), method: 'delete', class: 'grid__cell' do %p = button_tag t('workarea.admin.actions.delete'), value: 'delete_comment', class: 'text-button text-button--destroy' do = t('workarea.admin.actions.delete') = inline_svg('workarea/admin/icons/delete.svg', class: 'text-button__icon') .comments__comment-body %p= comment.body .section .comments__new-comment %h2= t('workarea.admin.comments.index.new') - if @comment.errors.present? - @comment.errors.full_messages.each do |message| = render_message 'error', message = form_tag commentable_comments_path(@commentable.to_global_id), method: 'post', id: 'comment_form', data: { unsaved_changes: '' } do .property.property--required = label_tag 'comment[body]', t('workarea.admin.fields.body'), class: 'property__name' = text_area_tag 'comment[body]', @comment.body, class: 'text-box text-box--multi-line', required: true, data: { tribute_area: users_path(exclude_current_user: true, format: :json) } %span.property__note= t('workarea.admin.comments.index.mention_note') .workflow-bar .grid.grid--middle .grid__cell.grid__cell--80 - if @commentable.subscribed_user_ids.include?(current_user.id.to_s) = link_to t('workarea.admin.comments.index.unsubscribe'), unsubscribe_commentable_comments_path(@commentable.to_global_id), data: { method: 'put', tooltip: { content_id: '#unsubscribe-info' } }, class: 'workflow-bar__button' #unsubscribe-info.tooltip-content %p= t('workarea.admin.comments.index.unsubscribe_message') - else = link_to t('workarea.admin.comments.index.subscribe'), subscribe_commentable_comments_path(@commentable.to_global_id), data: { method: 'put', tooltip: { content_id: '#subscribe-info' } }, class: 'workflow-bar__button' #subscribe-info.tooltip-content %p= t('workarea.admin.comments.index.subscribe_message') .grid__cell.grid__cell--20 .align-right= button_tag t('workarea.admin.comments.index.create'), value: 'create_comment', class: 'workflow-bar__button workflow-bar__button--create'