- scroll_class = (message == view_from) ? 'thread-view-from-here' : nil
%article.message{ id: dom_id(message), class: scroll_class }
  .details
    .author
      %span.thumbnail
        - if message.created_by.profile.picture
          = image_tag message.created_by.profile.picture_thumbnail.url, alt: ""
      = link_to_profile message.created_by
      = time_tag_with_title(message.created_at) do
        - t ".posted_date", time_ago: time_ago_in_words(message.created_at)
  .body
    - if message.censored?
      .censored
        %p= t ".censored"
    - else
      - if message.component
        = render "message/#{message_controller_map(message.component)}/show", message: message
      = auto_link simple_format message.body
  - if permitted_to?([:censor], message) || library_type_for(message)
    %menu.tools
      %ul
        - if permitted_to?(:censor, message)
          %li= link_to t(".censor"), censor_thread_message_path(message.thread, message), method: :put
        - case library_type_for(message)
        - when "note"
          %li= link_to t(".create_note"), new_thread_message_note_path(message.thread, message)
        - when "document"
          %li= link_to t(".create_document"), new_thread_message_document_path(message.thread, message)

- scroll_class = (message == view_from) ? 'thread-view-from-here' : nil
%article.message{ id: dom_id(message), class: scroll_class }
  .details
    .author
      %span.thumbnail
        - if message.created_by.profile.picture
          = image_tag message.created_by.profile.picture_thumbnail.url, alt: ""
      = link_to_profile message.created_by
      = link_to thread_path(anchor: dom_id(message)), class: "permalink" do
        - time_tag_with_title(message.created_at) do
          - t ".posted_date", time_ago: time_ago_in_words(message.created_at)
  .body
    - if message.censored?
      .censored
        %p= t ".censored"
    - else
      - if message.component
        = render "message/#{message_controller_map(message.component)}/show", message: message
      = auto_link simple_format message.body
  - if permitted_to?([:censor], message) || library_type_for(message)
    %menu.tools
      %ul
        - if permitted_to?(:censor, message)
          %li= link_to t(".censor"), censor_thread_message_path(message.thread, message), method: :put
        - case library_type_for(message)
        - when "note"
          %li= link_to t(".create_note"), new_thread_message_note_path(message.thread, message)
        - when "document"
          %li= link_to t(".create_document"), new_thread_message_document_path(message.thread, message)

Make the time of a message in the thread a permalink so that you can link to a specific message easily.
Make the time of a message in the thread a permalink so that you can link to a specific message easily.
