user_note.mustache 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. id = user_note.new_record? ? 'user_note_blank' : "user_note_#{user_note.id}"
  20. style = user_note.new_record? ? 'display: none;' : ''
  21. creator = user_note.creator.try_rescue(:name) || nil
  22. title = user_note.try_rescue(:title) || '{{ title }}'
  23. %>
  24. <div id="<%= id %>" class="user_note communication_message" style="<%= style %>">
  25. <div class="header clearfix">
  26. <div class="header_title">
  27. <div class="title subject">
  28. <%= title %>
  29. </div>
  30. <% if creator || user_note.created_at %>
  31. <div class="sub_title creator_name">
  32. <% if creator && user_note.created_at %>
  33. <%= t 'subheader', "%{creator} on %{created_at}", :creator => creator, :created_at => datetime_string(user_note.created_at) %>
  34. <% elsif creator %>
  35. <%= creator %>
  36. <% elsif user_note.created_at %>
  37. <span class="created_at time_ago_date" data-timestamp="<%= user_note.created_at.iso8601 %>"><%= datetime_string user_note.created_at %></span>
  38. <% end %>
  39. </div>
  40. <% end %>
  41. </div>
  42. <div class="post_actions pull-right">
  43. <% if user_note.new_record? %>
  44. <a href="#" class="delete_user_note_link delete_link no-hover icon-trash" title="<%= t "Delete entry %{title}", :title => title %>"></a>
  45. <% else %>
  46. <% if can_do(user_note, @current_user, :delete) %>
  47. <a href="<%= user_user_note_path(user_note.user, user_note) %>" class="delete_user_note_link delete_link no-hover icon-trash" title="<%= t "Delete entry %{title}", :title => title %>"></a>
  48. <% else %>
  49. &nbsp;
  50. <% end %>
  51. <% end %>
  52. </div>
  53. </div>
  54. <div class="content user_note_content">
  55. <div class="inner_content user_content formatted_note">
  56. <%= user_content(user_note.try_rescue(:formatted_note)) || nbsp %>
  57. </div>
  58. </div>
  59. </div>