merge_results.mustache 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. <table class="merge_results">
  19. <thead>
  20. <tr class="result">
  21. <th>{{#t}}User{{/t}}</th>
  22. <td><%= user.name %></td>
  23. <td><%= other_user.name %></td>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. <tr class="result">
  28. <th>{{#t}}Action{{/t}}</th>
  29. <td>{{#t}}will be deleted{{/t}}</td>
  30. <td>{{#t}}will be kept{{/t}}</td>
  31. </tr>
  32. <tr class="result">
  33. <th>{{#t}}Emails{{/t}}</th>
  34. <td>{{#t}}no emails{{/t}}</td>
  35. <td>
  36. <% emails = Canvas::ICU.collate((user.communication_channels.unretired.email + other_user.communication_channels.unretired.email).map(&:path).uniq) %>
  37. <% if emails.empty? %>
  38. {{#t}}no emails{{/t}}
  39. <% else %>
  40. <ul class="unstyled_list">
  41. <% emails.each do |email| %>
  42. <li><%= email %></li>
  43. <% end %>
  44. </ul>
  45. <% end %>
  46. </td>
  47. </tr>
  48. <tr class="result">
  49. <th>{{#t}}Logins{{/t}}</th>
  50. <td>{{#t}}no logins{{/t}}</td>
  51. <td>
  52. <% pseudonyms = Canvas::ICU.collate_by(user.pseudonyms.active + other_user.pseudonyms.active, &:unique_id) %>
  53. <% if pseudonyms.empty? %>
  54. {{#t}}no logins{{/t}}
  55. <% else %>
  56. <table>
  57. <% pseudonyms.each do |pseudonym| %>
  58. <tr>
  59. <td><%= pseudonym.unique_id %></td>
  60. <td><%= pseudonym.account.name %></td>
  61. </tr>
  62. <% end %>
  63. </table>
  64. <% end %>
  65. </td>
  66. </tr>
  67. <tr class="result">
  68. <th>{{#t}}Enrollments{{/t}}</th>
  69. <td>{{#t}}no enrollments{{/t}}</td>
  70. <td>
  71. <% enrollments = (user.enrollments.current + other_user.enrollments.current).sort_by{|e| [e.state_sortable, e.rank_sortable, Canvas::ICU.collation_key(e.course.name)] } %>
  72. <% if enrollments.empty? %>
  73. {{#t}}no enrollments{{/t}}
  74. <% else %>
  75. <table>
  76. <% enrollments.each do |enrollment| %>
  77. <tr>
  78. <td><%= enrollment.course.name %></td>
  79. <td><%= enrollment.readable_type %></td>
  80. </tr>
  81. <% end %>
  82. </table>
  83. <% end %>
  84. </td>
  85. </tr>
  86. </tbody>
  87. </table>