You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.1 KiB

4 years ago
  1. <%
  2. planning = YAML.load File.read File.join Middleman::Application.root, 'config/2018.yml'
  3. def parse_time(time)
  4. hour, min = time.split ':'
  5. 60 * hour.to_i + min.to_i
  6. end
  7. %>
  8. <div class="container-fluid">
  9. <div class="row">
  10. <table class="timetable table-bordered table-condensed col-xs-12">
  11. <thead>
  12. <tr>
  13. <th></th>
  14. <% planning.each do |day, events| %>
  15. <%=
  16. n = events.size
  17. attributes = n == 1 ? nil : { colspan: n }
  18. content_tag :th, day, attributes
  19. %>
  20. <% end %>
  21. </tr>
  22. <!--tr>
  23. <% planning.each do |day, events| %>
  24. <% events.each do |type, _| %>
  25. <td><%= type %></td>
  26. <% end %>
  27. <% end %>
  28. </tr-->
  29. </thead>
  30. <tbody>
  31. <tr>
  32. <td>
  33. <ul>
  34. <% (10..21).each do |hour| %>
  35. <li data-time="<%= hour %>:00"><%= hour %>:00</li>
  36. <% end %>
  37. </ul>
  38. </td>
  39. <% planning.each do |_, events| %>
  40. <% events.each do |_, events| %>
  41. <td>
  42. <ul>
  43. <% (events || []).each do |event| %>
  44. <%
  45. from, to = event[:from], event[:to]
  46. duration = parse_time(to) - parse_time(from)
  47. classes = [event[:place]]
  48. classes << :half if duration <= 30
  49. classes << :double if duration >= 90
  50. classes = classes.join ' '
  51. %>
  52. <% content_tag :li, class: classes, data: { from: from, to: to } do %>
  53. <div class="time">
  54. <%= from %> - <%= to %>
  55. </div>
  56. <div class="title">
  57. <%= event[:title] %>
  58. </div>
  59. <div class="author">
  60. <%= event[:author] %>
  61. </div>
  62. <div class="description">
  63. <%= event[:description] %>
  64. </div>
  65. <% end %>
  66. <% end %>
  67. </ul>
  68. </td>
  69. <% end %>
  70. <% end %>
  71. </tr>
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. <div class="modal">
  77. <header class="header">
  78. <div class="content">
  79. <span class="date"></span>
  80. <h3 class="name"></h3>
  81. </div>
  82. <div class="header-bg"></div>
  83. </header>
  84. <div class="body">
  85. <div class="event-info"></div>
  86. <div class="body-bg"></div>
  87. </div>
  88. <a href="#" class="close">Close</a>
  89. </div>