diff options
Diffstat (limited to 'app/views/events')
| -rw-r--r-- | app/views/events/edit.html.erb | 136 | ||||
| -rw-r--r-- | app/views/events/index.html.erb | 42 | ||||
| -rw-r--r-- | app/views/events/new.html.erb | 88 | ||||
| -rw-r--r-- | app/views/events/show.html.erb | 83 | ||||
| -rw-r--r-- | app/views/events/without_node.html.erb | 30 |
5 files changed, 238 insertions, 141 deletions
diff --git a/app/views/events/edit.html.erb b/app/views/events/edit.html.erb index 17457df..b6564a4 100644 --- a/app/views/events/edit.html.erb +++ b/app/views/events/edit.html.erb | |||
| @@ -1,53 +1,97 @@ | |||
| 1 | <% content_for :subnavigation do %> | ||
| 2 | <%= link_to 'back', safe_return_to(params[:return_to] || events_path) %> | ||
| 3 | <% if @event.node %> | ||
| 4 | <%= link_to 'node', edit_node_path(@event.node) %> | ||
| 5 | <% end %> | ||
| 6 | <%= link_to 'show', @event %> | ||
| 7 | <% end %> | ||
| 8 | |||
| 9 | <h1>Editing event</h1> | 1 | <h1>Editing event</h1> |
| 10 | 2 | ||
| 3 | <div class="node_action_bar standalone_action_bar"> | ||
| 4 | <%= link_to 'Back', safe_return_to(params[:return_to] || events_path) %> | ||
| 5 | <%= button_to event_path(@event), method: :delete, | ||
| 6 | form: { data: { confirm: 'Delete this event?' }, class: 'button_to destructive' } do %> | ||
| 7 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy | ||
| 8 | <% end %> | ||
| 9 | </div> | ||
| 10 | |||
| 11 | <%= form_for(@event) do |f| %> | 11 | <%= form_for(@event) do |f| %> |
| 12 | <%= hidden_field_tag :return_to, @return_to %> | 12 | <%= hidden_field_tag :return_to, @return_to %> |
| 13 | <%= form_error_messages(f) %> | 13 | <%= form_error_messages(f) %> |
| 14 | 14 | ||
| 15 | <p> | 15 | <div id="page_editor"> |
| 16 | <%= f.label :start_time %><br /> | 16 | <div id="content"> |
| 17 | <%= f.datetime_select :start_time %> | 17 | <div class="node_description">Node</div> |
| 18 | </p> | 18 | <div class="node_content"> |
| 19 | <p> | 19 | <% if @event.node %> |
| 20 | <%= f.label :end_time %><br /> | 20 | <%= link_to @event.node.title, node_path(@event.node) %> |
| 21 | <%= f.datetime_select :end_time %> | 21 | <details> |
| 22 | </p> | 22 | <summary>Change node</summary> |
| 23 | <p> | 23 | <%= text_field_tag :event_node_search_term %> |
| 24 | <%= f.label :rrule %><br /> | 24 | <div id="event_search_results" class="search_results"></div> |
| 25 | <%= f.text_field :rrule %> | 25 | <span class="field_hint">This will re-link the event to a different node — rarely needed.</span> |
| 26 | </p> | 26 | </details> |
| 27 | <p> | 27 | <% else %> |
| 28 | <%= f.label :custom_rrule %><br /> | 28 | <%= text_field_tag :event_node_search_term %> |
| 29 | <%= f.check_box :custom_rrule %> | 29 | <div id="event_search_results" class="search_results"></div> |
| 30 | </p> | 30 | <span class="field_hint">Optional — search and pick a node to associate this event with a page.</span> |
| 31 | <p> | 31 | <% end %> |
| 32 | <%= f.label :allday %><br /> | 32 | <%= f.hidden_field :node_id %> |
| 33 | <%= f.check_box :allday %> | 33 | </div> |
| 34 | </p> | 34 | |
| 35 | <p> | 35 | <div class="node_description">Start time</div> |
| 36 | <%= f.label :url %><br /> | 36 | <div class="node_content"><%= f.datetime_select :start_time %></div> |
| 37 | <%= f.text_field :url %> | 37 | |
| 38 | </p> | 38 | <div class="node_description">End time</div> |
| 39 | <p> | 39 | <div class="node_content"><%= f.datetime_select :end_time %></div> |
| 40 | <%= f.label :latitude %><br /> | 40 | |
| 41 | <%= f.text_field :latitude %> | 41 | <div class="node_description">Recurrence</div> |
| 42 | </p> | 42 | <div class="node_content"> |
| 43 | <p> | 43 | <div id="rrule_builder"> |
| 44 | <%= f.label :longitude %><br /> | 44 | <p> |
| 45 | <%= f.text_field :longitude %> | 45 | <label><%= radio_button_tag "rrule_freq", "weekly", true %> Weekly</label> |
| 46 | </p> | 46 | <label><%= radio_button_tag "rrule_freq", "monthly" %> Monthly</label> |
| 47 | <p> | 47 | </p> |
| 48 | <%= f.hidden_field :node_id %> | 48 | <div id="rrule_weekly_options"> |
| 49 | </p> | 49 | <p><label><%= check_box_tag "rrule_biweekly" %> Every 2 weeks</label></p> |
| 50 | <p> | 50 | <p> |
| 51 | <%= f.submit 'Update' %> | 51 | <% %w[MO TU WE TH FR SA SU].each do |code| %> |
| 52 | </p> | 52 | <label><%= check_box_tag "rrule_byday_#{code}" %> <%= RruleHumanizer::WEEKDAY_NAMES_ABBR[:de][code] %></label> |
| 53 | <% end %> | ||
| 54 | </p> | ||
| 55 | </div> | ||
| 56 | <div id="rrule_monthly_options" style="display: none;"> | ||
| 57 | <p><label><%= check_box_tag "rrule_monthly_ordinal" %> On a specific weekday each month</label></p> | ||
| 58 | <p id="rrule_ordinal_fields" style="display: none;"> | ||
| 59 | <%= select_tag "rrule_ordinal", options_for_select([["1.", 1], ["2.", 2], ["3.", 3], ["4.", 4], ["letzter", -1], ["vorletzter", -2]]) %> | ||
| 60 | <%= select_tag "rrule_ordinal_day", options_for_select(%w[MO TU WE TH FR SA SU].map { |c| [RruleHumanizer::WEEKDAY_NAMES[:de][c], c] }) %> | ||
| 61 | </p> | ||
| 62 | </div> | ||
| 63 | <p> | ||
| 64 | <label><%= check_box_tag "rrule_exclude_month" %> Except in one month</label> | ||
| 65 | <%= select_tag "rrule_excluded_month", options_for_select((1..12).map { |m| [RruleHumanizer::MONTH_NAMES[:de][m-1], m] }), style: "display: none;" %> | ||
| 66 | </p> | ||
| 67 | <span class="field_hint">Builds the field below automatically. If your pattern is more complex than this covers, just edit it directly below - these controls won't touch it unless you use them.</span> | ||
| 68 | </div> | ||
| 69 | <%= f.text_field :rrule, id: "event_rrule" %> | ||
| 70 | </div> | ||
| 71 | |||
| 72 | <div class="node_description">Title</div> | ||
| 73 | <div class="node_content"> | ||
| 74 | <%= f.text_field :title %> | ||
| 75 | <span id="event_title_hint" class="field_hint">Optional — if left blank, the associated node's title is used.</span> | ||
| 76 | </div> | ||
| 77 | |||
| 78 | <div class="node_description">Tags</div> | ||
| 79 | <div class="node_content"><%= f.text_field :tag_list %></div> | ||
| 80 | |||
| 81 | <div class="node_description">Allday</div> | ||
| 82 | <div class="node_content"><%= f.check_box :allday %></div> | ||
| 83 | |||
| 84 | <div class="node_description">Url</div> | ||
| 85 | <div class="node_content"><%= f.text_field :url %></div> | ||
| 86 | |||
| 87 | <div class="node_description">Latitude</div> | ||
| 88 | <div class="node_content"><%= f.text_field :latitude %></div> | ||
| 89 | |||
| 90 | <div class="node_description">Longitude</div> | ||
| 91 | <div class="node_content"><%= f.text_field :longitude %></div> | ||
| 92 | |||
| 93 | <div class="node_description"></div> | ||
| 94 | <div class="node_content"><%= f.submit 'Update' %></div> | ||
| 95 | </div> | ||
| 96 | </div> | ||
| 53 | <% end %> | 97 | <% end %> |
diff --git a/app/views/events/index.html.erb b/app/views/events/index.html.erb index 19b21ce..dde897e 100644 --- a/app/views/events/index.html.erb +++ b/app/views/events/index.html.erb | |||
| @@ -1,36 +1,40 @@ | |||
| 1 | <h1>Listing events</h1> | 1 | <h1>Events</h1> |
| 2 | 2 | ||
| 3 | <table> | 3 | <div class="button_row"> |
| 4 | <tr> | 4 | <%= link_to new_event_path, class: 'action_button' do %> |
| 5 | <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create event | ||
| 6 | <% end %> | ||
| 7 | <%= link_to 'View events without a page →', without_node_events_path %> | ||
| 8 | </div> | ||
| 9 | |||
| 10 | <%= will_paginate @events %> | ||
| 11 | |||
| 12 | <table class="events_table"> | ||
| 13 | <tr class="header"> | ||
| 14 | <th>Title</th> | ||
| 5 | <th>Start time</th> | 15 | <th>Start time</th> |
| 6 | <th>End time</th> | 16 | <th>End time</th> |
| 7 | <th>Rrule</th> | 17 | <th>Rrule</th> |
| 8 | <th>Custom rrule</th> | ||
| 9 | <th>Allday</th> | 18 | <th>Allday</th> |
| 10 | <th>Url</th> | 19 | <th>Url</th> |
| 11 | <th>Latitude</th> | ||
| 12 | <th>Longitude</th> | ||
| 13 | <th>Node</th> | 20 | <th>Node</th> |
| 21 | <th></th> | ||
| 14 | </tr> | 22 | </tr> |
| 15 | 23 | ||
| 16 | <% @events.each do |event| %> | 24 | <% @events.each do |event| %> |
| 17 | <tr> | 25 | <tr> |
| 26 | <td><%= link_to event.display_title, event %></td> | ||
| 18 | <td><%=h event.start_time %></td> | 27 | <td><%=h event.start_time %></td> |
| 19 | <td><%=h event.end_time %></td> | 28 | <td><%=h event.end_time %></td> |
| 20 | <td><%=h event.rrule %></td> | 29 | <td class="rrule_cell"><span class="rrule_text"><%= rrule_with_break_opportunities(event.rrule) %></span></td> |
| 21 | <td><%=h event.custom_rrule %></td> | ||
| 22 | <td><%=h event.allday %></td> | 30 | <td><%=h event.allday %></td> |
| 23 | <td><%=h event.url %></td> | 31 | <td class="url_cell"> |
| 24 | <td><%=h event.latitude %></td> | 32 | <% if event.url.present? %> |
| 25 | <td><%=h event.longitude %></td> | 33 | <span class="truncate"><%= link_to event.url, event.url %></span> |
| 26 | <td><%=h event.node_id %></td> | 34 | <% end %> |
| 27 | <td><%= link_to 'Show', event %></td> | 35 | </td> |
| 28 | <td><%= link_to 'Edit', edit_event_path(event) %></td> | 36 | <td><%= event.node ? link_to(event.node_id, node_path(event.node)) : '' %></td> |
| 29 | <td><%= button_to 'Destroy', event, method: :delete, form: { data: { confirm: 'Are you sure?' } } %></td> | 37 | <td><%= link_to 'edit', edit_event_path(event) %></td> |
| 30 | </tr> | 38 | </tr> |
| 31 | <% end %> | 39 | <% end %> |
| 32 | </table> | 40 | </table> |
| 33 | |||
| 34 | <br /> | ||
| 35 | |||
| 36 | <%= link_to 'New event', new_event_path %> | ||
diff --git a/app/views/events/new.html.erb b/app/views/events/new.html.erb index cd892c5..7a1ee7a 100644 --- a/app/views/events/new.html.erb +++ b/app/views/events/new.html.erb | |||
| @@ -1,46 +1,56 @@ | |||
| 1 | <h1>New event</h1> | 1 | <h1>New event</h1> |
| 2 | 2 | ||
| 3 | <%= link_to 'Back', safe_return_to(params[:return_to] || events_path) %> | ||
| 4 | |||
| 3 | <%= form_for(@event) do |f| %> | 5 | <%= form_for(@event) do |f| %> |
| 4 | <%= form_error_messages(f) %> | 6 | <%= form_error_messages(f) %> |
| 5 | 7 | ||
| 6 | <p> | 8 | <div id="page_editor"> |
| 7 | <%= f.label :start_time %><br /> | 9 | <div id="content"> |
| 8 | <%= f.datetime_select :start_time %> | 10 | <div class="node_description">Node</div> |
| 9 | </p> | 11 | <div class="node_content"> |
| 10 | <p> | 12 | <%= text_field_tag :event_node_search_term %> |
| 11 | <%= f.label :end_time %><br /> | 13 | <div id="event_search_results" class="search_results"></div> |
| 12 | <%= f.datetime_select :end_time %> | 14 | <%= f.hidden_field :node_id %> |
| 13 | </p> | 15 | <span class="field_hint">Optional — search and pick a node to associate this event with a page.</span> |
| 14 | <p> | 16 | </div> |
| 15 | <%= f.label :rrule %><br /> | 17 | |
| 16 | <%= f.text_field :rrule %> | 18 | <div class="node_description">Start time</div> |
| 17 | </p> | 19 | <div class="node_content"><%= f.datetime_select :start_time %></div> |
| 18 | <p> | 20 | |
| 19 | <%= f.label :custom_rrule %><br /> | 21 | <div class="node_description">End time</div> |
| 20 | <%= f.check_box :custom_rrule %> | 22 | <div class="node_content"><%= f.datetime_select :end_time %></div> |
| 21 | </p> | 23 | |
| 22 | <p> | 24 | <div class="node_description">Rrule</div> |
| 23 | <%= f.label :allday %><br /> | 25 | <div class="node_content"><%= f.text_field :rrule %></div> |
| 24 | <%= f.check_box :allday %> | 26 | |
| 25 | </p> | 27 | <div class="node_description">Title</div> |
| 26 | <p> | 28 | <div class="node_content"> |
| 27 | <%= f.label :url %><br /> | 29 | <%= f.text_field :title %> |
| 28 | <%= f.text_field :url %> | 30 | <span id="event_title_hint" class="field_hint">Optional — if left blank, the associated node's title is used.</span> |
| 29 | </p> | 31 | </div> |
| 30 | <p> | 32 | |
| 31 | <%= f.label :latitude %><br /> | 33 | <div class="node_description">Tags</div> |
| 32 | <%= f.text_field :latitude %> | 34 | <div class="node_content"><%= f.text_field :tag_list %></div> |
| 33 | </p> | 35 | |
| 34 | <p> | 36 | <div class="node_description">Allday</div> |
| 35 | <%= f.label :longitude %><br /> | 37 | <div class="node_content"><%= f.check_box :allday %></div> |
| 36 | <%= f.text_field :longitude %> | 38 | |
| 37 | </p> | 39 | <div class="node_description">Url</div> |
| 38 | <p> | 40 | <div class="node_content"><%= f.text_field :url %></div> |
| 39 | <%= f.hidden_field :node_id %> | 41 | |
| 40 | </p> | 42 | <div class="node_description">Latitude</div> |
| 41 | <p> | 43 | <div class="node_content"><%= f.text_field :latitude %></div> |
| 42 | <%= f.submit 'Create' %> | 44 | |
| 43 | </p> | 45 | <div class="node_description">Longitude</div> |
| 46 | <div class="node_content"><%= f.text_field :longitude %></div> | ||
| 47 | |||
| 48 | <div class="node_description"></div> | ||
| 49 | <div class="node_content"><%= hidden_field_tag :return_to, params[:return_to] %></div> | ||
| 50 | |||
| 51 | <div class="node_description"></div> | ||
| 52 | <div class="node_content"><%= f.submit 'Create' %></div> | ||
| 53 | </div> | ||
| 54 | </div> | ||
| 44 | <% end %> | 55 | <% end %> |
| 45 | 56 | ||
| 46 | <%= link_to 'Back', events_path %> | ||
diff --git a/app/views/events/show.html.erb b/app/views/events/show.html.erb index ba14a7d..ac084c9 100644 --- a/app/views/events/show.html.erb +++ b/app/views/events/show.html.erb | |||
| @@ -1,46 +1,55 @@ | |||
| 1 | <% content_for :subnavigation do %> | 1 | <div id="page_editor" class="show_node"> |
| 2 | <%= link_to 'back', edit_node_path(@event.node) %> | 2 | <h1><%= @event.node ? "Event for node #{@event.node.unique_name}" : "Event" %></h1> |
| 3 | <%= link_to 'edit', edit_event_path(@event) %> | ||
| 4 | <% end %> | ||
| 5 | 3 | ||
| 6 | <h2>Event for node <%= @event.node.unique_name %></h2> | 4 | <div id="content"> |
| 5 | <div class="node_description">Actions</div> | ||
| 6 | <div class="node_content node_info_group"> | ||
| 7 | <div class="node_info_group_items"> | ||
| 8 | <% if @event.node %> | ||
| 9 | <div class="node_info_item"> | ||
| 10 | <%= link_to 'Node', node_path(@event.node) %> | ||
| 11 | </div> | ||
| 12 | <% end %> | ||
| 13 | <div class="node_info_item"> | ||
| 14 | <%= link_to edit_event_path(@event, return_to: request.path), class: 'action_button' do %> | ||
| 15 | <%= icon("edit", library: "tabler", "aria-hidden": true) %> Edit | ||
| 16 | <% end %> | ||
| 17 | </div> | ||
| 18 | <div class="node_info_item"> | ||
| 19 | <%= button_to event_path(@event), method: :delete, form: { data: { confirm: 'Delete this event?' }, class: 'button_to destructive' } do %> | ||
| 20 | <%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy | ||
| 21 | <% end %> | ||
| 22 | </div> | ||
| 23 | </div> | ||
| 24 | </div> | ||
| 7 | 25 | ||
| 8 | <p> | 26 | <div class="node_description">Start time</div> |
| 9 | <b>Start time:</b> | 27 | <div class="node_content"><%=h @event.start_time %></div> |
| 10 | <%=h @event.start_time %> | ||
| 11 | </p> | ||
| 12 | 28 | ||
| 13 | <p> | 29 | <div class="node_description">End time</div> |
| 14 | <b>End time:</b> | 30 | <div class="node_content"><%=h @event.end_time %></div> |
| 15 | <%=h @event.end_time %> | ||
| 16 | </p> | ||
| 17 | 31 | ||
| 18 | <p> | 32 | <div class="node_description">Rrule</div> |
| 19 | <b>Rrule:</b> | 33 | <div class="node_content"><%=h @event.rrule %></div> |
| 20 | <%=h @event.rrule %> | ||
| 21 | </p> | ||
| 22 | 34 | ||
| 23 | <p> | 35 | <% if (human = @event.humanize_rrule(I18n.locale)) %> |
| 24 | <b>Custom rrule:</b> | 36 | <div class="node_description">Recurrence</div> |
| 25 | <%=h @event.custom_rrule %> | 37 | <div class="node_content"><em><%= human %></em></div> |
| 26 | </p> | 38 | <% end %> |
| 27 | 39 | ||
| 28 | <p> | 40 | <div class="node_description">Tags</div> |
| 29 | <b>Allday:</b> | 41 | <div class="node_content"><%=h @event.tag_list %></div> |
| 30 | <%=h @event.allday %> | ||
| 31 | </p> | ||
| 32 | 42 | ||
| 33 | <p> | 43 | <div class="node_description">Allday</div> |
| 34 | <b>Url:</b> | 44 | <div class="node_content"><%=h @event.allday %></div> |
| 35 | <%=h @event.url %> | ||
| 36 | </p> | ||
| 37 | 45 | ||
| 38 | <p> | 46 | <div class="node_description">Url</div> |
| 39 | <b>Latitude:</b> | 47 | <div class="node_content"><%=h @event.url %></div> |
| 40 | <%=h @event.latitude %> | ||
| 41 | </p> | ||
| 42 | 48 | ||
| 43 | <p> | 49 | <div class="node_description">Latitude</div> |
| 44 | <b>Longitude:</b> | 50 | <div class="node_content"><%=h @event.latitude %></div> |
| 45 | <%=h @event.longitude %> | 51 | |
| 46 | </p> \ No newline at end of file | 52 | <div class="node_description">Longitude</div> |
| 53 | <div class="node_content"><%=h @event.longitude %></div> | ||
| 54 | </div> | ||
| 55 | </div> | ||
diff --git a/app/views/events/without_node.html.erb b/app/views/events/without_node.html.erb new file mode 100644 index 0000000..bb27173 --- /dev/null +++ b/app/views/events/without_node.html.erb | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | <h1>Events without a node</h1> | ||
| 2 | |||
| 3 | <%= link_to '← All events', events_path %> | ||
| 4 | <%= link_to new_event_path, class: 'action_button' do %> | ||
| 5 | <%= icon("plus", library: "tabler", "aria-hidden": true) %> Create event | ||
| 6 | <% end %> | ||
| 7 | |||
| 8 | <%= will_paginate @events %> | ||
| 9 | |||
| 10 | <table class="events_table"> | ||
| 11 | <tr class="header"> | ||
| 12 | <th>Title</th> | ||
| 13 | <th>Start time</th> | ||
| 14 | <th>End time</th> | ||
| 15 | <th>Allday</th> | ||
| 16 | <th>Url</th> | ||
| 17 | <th></th> | ||
| 18 | </tr> | ||
| 19 | |||
| 20 | <% @events.each do |event| %> | ||
| 21 | <tr> | ||
| 22 | <td><%= link_to event.display_title, event %></td> | ||
| 23 | <td><%=h event.start_time %></td> | ||
| 24 | <td><%=h event.end_time %></td> | ||
| 25 | <td><%=h event.allday %></td> | ||
| 26 | <td><%=h event.url %></td> | ||
| 27 | <td><%= link_to 'edit', edit_event_path(event) %></td> | ||
| 28 | </tr> | ||
| 29 | <% end %> | ||
| 30 | </table> | ||
