timespan.mustache 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. <% date_class_prefix ||= "" %>
  19. <% ot(:timespan, "%{start_at} *to* %{end_at}", :start_at => capture { %>
  20. <td class="start_date">
  21. <div class="show_term">
  22. <span class="<%= date_class_prefix %>start_at"><%= datetime_string(object.try(:start_at), :full) || (whenever[0] ? t('date.unspecified', "whenever") : t('date.term_start', "term start")) %></span>
  23. </div>
  24. <div class="edit_term">
  25. <div class="date_field_container">
  26. <label class="screenreader-only" id="<%= key %>_start_at_label">
  27. <%= start_tooltip %> <%= datepicker_screenreader_prompt %>
  28. </label>
  29. <input type="text"
  30. name="enrollment_term<%= key %>[start_at]"
  31. value="<%= datetime_string(object.try(:start_at), :long) %>"
  32. title="<%= accessible_date_format %>"
  33. class="date_field"
  34. style="width: 120px;"
  35. aria-labelledby="<%= key %>_start_at_label"
  36. data-tooltip />
  37. </div>
  38. </div>
  39. </td>
  40. <% }, :wrapper => capture { %>
  41. <td>
  42. &nbsp;\1&nbsp;
  43. </td>
  44. <% }, :end_at => capture { %>
  45. <td class="end_date">
  46. <div class="show_term">
  47. <span class="<%= date_class_prefix %>end_at"><%= datetime_string(object.try(:end_at), :full) || (whenever[1] ? t('date.unspecified', "whenever") : t('date.term_end', "term end")) %></span>
  48. </div>
  49. <div class="edit_term">
  50. <div class="date_field_container">
  51. <label class="screenreader-only" id="<%= key %>_end_at_label">
  52. <%= end_tooltip %> <%= datepicker_screenreader_prompt %>
  53. </label>
  54. <input
  55. type="text"
  56. name="enrollment_term<%= key %>[end_at]"
  57. value="<%= datetime_string(object.try(:end_at), :long) %>"
  58. title="<%= accessible_date_format %>"
  59. class="date_field"
  60. style="width: 120px;"
  61. aria-labelledby="<%= key %>_end_at_label"
  62. data-tooltip />
  63. </div>
  64. </div>
  65. </td>
  66. <% }) %>