sub_entry.mustache 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <%
  19. hide_entry ||= false
  20. entry_context ||= entry ? entry.context : parent_entry.context
  21. %>
  22. <div id="<%= "entry_#{entry.id}" if entry %>" style="<%= hidden unless entry %>" class="communication_sub_message <%= 'toggled_communication_sub_message' if hide_entry %> <%= 'blank' unless entry %> can_be_marked_as_read <%= entry ? entry.read_state(@current_user) : 'read' %>" data-mark-read-url="<%= entry && context_url(entry_context, :api_v1_context_discussion_topic_discussion_entry_mark_read_url, entry.discussion_topic, entry)%>">
  23. <div class="header">
  24. <div class="header_title">
  25. <a title="<%= t :authors_name, "Author's name" %>" href="<%= context_url(entry_context, :context_user_url, entry ? entry.user_id : '') %>" class="user_name">
  26. <%= context_user_name(entry ? entry.context : nil, entry ? entry.user_id : nil) %>
  27. </a>
  28. </div>
  29. <div class="link_box">
  30. <a href="<%= context_url(entry_context, :context_discussion_entry_url, entry ? entry.id : "{{ id }}") %>" class="delete_entry_link disabled_link"><%= image_tag "delete.png", :alt => t('Delete') %></a>
  31. </div>
  32. <div class="post_date time_ago_date" data-timestamp="<%= entry.try_rescue(:created_at).try_rescue(:iso8601) %>"><%= datetime_string(entry.try_rescue(:created_at)) || nbsp %></div>
  33. <div class="clear"></div>
  34. </div>
  35. <div class="content">
  36. <div style="float: left; margin: 0 5px 0 -10px;"><%= avatar(entry.try_rescue(:user_id), context_code: entry_context.asset_string, size: 30) %></div>
  37. <div class="course_id" style="display: none;"><%= entry_context.id if entry_context && entry_context.is_a?(Course) %></div>
  38. <div class="message user_content" style="<%= hidden unless entry %>"><%= user_content(entry.try_rescue(:message)) || nbsp %></div>
  39. <textarea class="message_html" style="display: none;"><%= h(entry.try_rescue(:message)) %></textarea>
  40. <% if !entry %>
  41. <%= form_for :discussion_entry, :url => context_url(entry_context, :context_discussion_entries_url), :html => {:class => "add_sub_message_form"} do |f| %>
  42. <%= f.hidden_field :discussion_topic_id, :value => parent_entry.discussion_topic_id %>
  43. <%= f.hidden_field :parent_id, :value => parent_entry.id, :class => "parent_id" %>
  44. <%= f.text_area :message, :style => "height: 200px;", :class => "rich_text" %>
  45. <div class="button-container" style="padding-bottom: 5px;">
  46. <button type="submit" class="btn btn-small submit_button"><%= t :post_message, "Post Message" %></button>
  47. <button type="button" class="btn button-secondary cancel_button"><%= t "#buttons.cancel", "Cancel" %></button>
  48. </div>
  49. <% end %>
  50. <% end %>
  51. <div class="clear"></div>
  52. </div>
  53. <div class="clear"></div>
  54. </div>