account_notification.mustache 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <%
  2. # Copyright (C) 2012 - 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. account_notification ||= nil
  20. notification = account_notification
  21. %>
  22. <div class="ic-notification ic-notification--admin-created ic-notification--<%= notification_container_classname(notification) %> account_notification">
  23. <div class="ic-notification__icon" role="presentation">
  24. <i class="<%= notification_icon_classname(notification) %>"></i>
  25. <span class="screenreader-only">
  26. <%= accessible_message_icon_text(notification_icon_type(notification)) %>
  27. </span>
  28. </div>
  29. <div class="notification_account_content">
  30. <div class="ic-notification__content">
  31. <div class="ic-notification__message">
  32. <h4 class="ic-notification__title">
  33. <%= notification.subject %>
  34. </h4>
  35. <% # I don't see a problem with using gsub given that there are only potential substitutions %>
  36. <% # but if you found this comment while looking to add a third, it might be time to consider being smarter about this :p %>
  37. <span class="notification_message">
  38. <%= user_content(notification.message.gsub(/(({{)|(%7B%7B))ACCOUNT_DOMAIN((}})|(%7D%7D))/,request.host_with_port).gsub(/(({{)|(%7B%7B))CANVAS_USER_ID((}})|(%7D%7D))/,@current_user.global_id.to_s)) unless notification.message.nil? %>
  39. </span>
  40. </div>
  41. <div class="ic-notification__actions">
  42. <a href="#" class="Button Button--icon-action" data-url="<%= dashboard_close_notification_path(notification.id) %>" data-remove=".ic-notification" title="<%= t :close, 'close' %>" role="button">
  43. <i class="icon-x"></i>
  44. </a>
  45. </div>
  46. </div>
  47. <span class="notification_account_content_text">
  48. <%= t("This is a message for *%{name}*", name: notification.account.name, wrapper: '<b>\1</b>') %>
  49. </span>
  50. </div>
  51. </div>