deleted_item.mustache 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. item = deleted_item
  20. url_asset_string = item.asset_string
  21. # This is pretty hacky, but the controller expects an asset string that it
  22. # can split into a scope and an id, and it expects the scope to be a method
  23. # it can call on the context (in this case a course). I'm fixing it here so
  24. # we don't have a colon in the url. See ContextController#undelete
  25. url_asset_string = url_asset_string.gsub('quizzes:', '')
  26. %>
  27. <li class="item">
  28. <div class="links">
  29. <a class="restore_link btn" href="<%= context_url(@context, :context_undelete_item_url, url_asset_string) %>">{{#t}}restore{{/t}}</a>
  30. </div>
  31. <div class="name">
  32. <% if item.is_a?(Enrollment) %>
  33. <%= item.short_name %> - <%= item.user.name %>
  34. <% elsif item.respond_to?(:name) %>
  35. <%= item.name %>
  36. <% elsif item.respond_to?(:title) %>
  37. <%= item.title %>
  38. <% else %>
  39. <%= item.class.to_s %>:<%= item.id %>
  40. <% end %>
  41. </div>
  42. <div class="type">
  43. <%= item.class.to_s %>
  44. </div>
  45. <div class="details">
  46. <% if item.respond_to?(:description) %>
  47. <%= HtmlTextHelper.strip_and_truncate(item.description, :max_length => 200) %>
  48. <% elsif item.respond_to?(:message) %>
  49. <%= HtmlTextHelper.strip_and_truncate(item.message, :max_length => 200) %>
  50. <% end %>
  51. </div>
  52. <table class="dates">
  53. <tr>
  54. <td>{{#t}}created{{/t}}</td>
  55. <td><%= datetime_string(item.created_at) %></td>
  56. </tr><tr>
  57. <td>{{#t}}last updated{{/t}}</td>
  58. <td><%= datetime_string(item.updated_at) %></td>
  59. </tr>
  60. </table>
  61. </li>