PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/app/views/rubrics/user_index.html.erb

https://github.com/thinkwell/canvas-lms
Ruby HTML | 113 lines | 111 code | 2 blank | 0 comment | 5 complexity | 0062146fe87d84c1706ab039ce0fe95f MD5 | raw file
  1. <% content_for :page_title, t(:page_title, "Rubrics") %>
  2. <% add_crumb t('#crumbs.rubrics', "Rubrics") %>
  3. <% content_for :right_side do %>
  4. <div class="rs-margin-all">
  5. <a href="<%= context_url(@context, :context_rubrics_url) %>" class="button button-sidebar-wide add_rubric_link"><%= image_tag "add.png" %> <%= t('buttons.add_rubric', 'Add Rubric') %></a>
  6. </div>
  7. <% end %>
  8. <% js_bundle :edit_rubric %>
  9. <% content_for :stylesheets do %>
  10. <style>
  11. #rubrics .find_rubric_link {
  12. display: none;
  13. }
  14. #rubrics ul {
  15. list-style-type: none;
  16. padding-left: 0px;
  17. }
  18. #rubrics ul li {
  19. padding: 3px 5px;
  20. margin-bottom: 5px;
  21. }
  22. #rubrics ul li .title {
  23. font-size: 1.2em;
  24. font-weight: bold;
  25. float: left;
  26. }
  27. #rubrics ul li .links {
  28. float: right;
  29. opacity: 0.5;
  30. }
  31. #rubrics ul li .details {
  32. clear: left;
  33. display: block;
  34. font-size: 0.7em;
  35. margin-left: 20px;
  36. }
  37. #rubrics ul li:hover {
  38. background-color: #eee;
  39. -moz-border-radius: 5px;
  40. }
  41. #rubrics ul li:hover .links {
  42. opacity: 1.0;
  43. }
  44. </style>
  45. <% end %>
  46. <% js_block do %>
  47. <script>
  48. require([
  49. 'i18nObj' /* I18n.t */,
  50. 'jquery' /* $ */,
  51. 'find_outcome',
  52. 'jquery.instructure_misc_plugins' /* confirmDelete */
  53. ], function(I18n, $) {
  54. $(document).ready(function() {
  55. $("#rubrics ul .delete_rubric_link").click(function(event) {
  56. event.preventDefault();
  57. var $rubric = $(this).parents("li");
  58. var message = <%= jt('prompts.are_you_sure_delete', "Are you sure you want to delete this rubric? Any course currently associated with this rubric will still have access to it, but, no new courses will be able to use it.") %>;
  59. if($(this).hasClass('remove_link')) {
  60. message = <%= jt('prompts.are_you_sure_remove', "Are you sure you want to remove this rubric from your list?") %>;
  61. }
  62. $rubric.confirmDelete({
  63. url: $(this).attr('href'),
  64. message: message,
  65. success: function() {
  66. $(this).slideUp(function() {
  67. $(this).remove();
  68. });
  69. }
  70. });
  71. });
  72. });
  73. });
  74. </script>
  75. <% end %>
  76. <h2><%= t 'headings.user_rubrics', 'User Rubrics' %></h2>
  77. <a href="<%= context_url(@context, :context_rubrics_url) %>" id="add_rubric_url" style="display: none;">&nbsp;</a>
  78. <div id="rubrics" class="raw_listing">
  79. <ul>
  80. <% @rubrics.each do |rubric| %>
  81. <li>
  82. <a href="<%= context_url(rubric.context, :context_rubric_url, rubric.id) %>" class="title"><%= rubric.title %></a>
  83. <span class="links">
  84. <% if can_do(rubric, @current_user, :update) %>
  85. <a href="<%= context_url(rubric.context, :context_rubric_url, rubric.id) %>#edit" class="no-hover"><%= image_tag "edit.png" %></a>
  86. <% end %>
  87. <% if rubric.context == @context %>
  88. <a href="<%= context_url(@context, :context_rubric_url, rubric.id) %>" class="delete_rubric_link no-hover" title="<%= t('delete_rubric', 'Delete Rubric') %>"><%= image_tag "delete.png" %></a>
  89. <% elsif can_do(rubric, @current_user, :delete) %>
  90. <a href="<%= context_url(@context, :context_rubric_url, rubric.id) %>" class="delete_rubric_link no-hover remove_link" title="<%= t('remove_rubric', 'Remove this Rubric from my list') %>"><%= image_tag "delete_circle.png" %></a>
  91. <% end %>
  92. </span>
  93. <span class="details">
  94. <%= rubric.criteria.length %> <%= rubric.criteria.length == 1 ? 'criterion' : 'criteria' %><br/>
  95. <%= t('points_possible', {:one => "point possible", :other => "points possible"}, :count => rubric.points_possible) %>
  96. </span>
  97. </li>
  98. <% end %>
  99. </ul>
  100. <div style="display: none;" id="rubric_parameters">
  101. <input type="hidden" name="rubric_association[association_type]" value="<%= @context.class.to_s %>"/>
  102. <input type="hidden" name="rubric_association[association_id]" value="<%= @context.id %>"/>
  103. <input type="hidden" name="rubric_association[purpose]" value="bookmark"/>
  104. </div>
  105. <span class="current_user_id" style="display: none;"><%= @current_user.id %></span>
  106. <a href="<%= context_url(@context, :context_rubrics_url) %>" class="add_rubric_association_url" style="display: none;">&nbsp;</a>
  107. </div>
  108. <%= render :partial => "shared/find_outcome", :locals => {:context => @domain_root_account} %>
  109. <%= render :partial => "shared/rubric", :object => nil %>
  110. <%= render :partial => "shared/rubric_forms" %>
  111. <%= render :partial => "shared/rubric_criterion_dialog" %>