1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<h1>Editing event</h1>
<div class="node_action_bar standalone_action_bar">
<%= link_to 'Back', safe_return_to(params[:return_to] || events_path) %>
<%= button_to event_path(@event), method: :delete,
form: { data: { confirm: 'Delete this event?' }, class: 'button_to destructive' } do %>
<%= icon("trash", library: "tabler", "aria-hidden": true) %> Destroy
<% end %>
</div>
<%= form_for(@event) do |f| %>
<%= hidden_field_tag :return_to, @return_to %>
<%= form_error_messages(f) %>
<div id="page_editor">
<div id="content">
<div class="node_description">Node</div>
<div class="node_content">
<% if @event.node %>
<%= link_to @event.node.title, node_path(@event.node) %>
<details>
<summary>Change node</summary>
<%= text_field_tag :event_node_search_term %>
<div id="event_search_results" class="search_results"></div>
<span class="field_hint">This will re-link the event to a different node — rarely needed.</span>
</details>
<% else %>
<%= text_field_tag :event_node_search_term %>
<div id="event_search_results" class="search_results"></div>
<span class="field_hint">Optional — search and pick a node to associate this event with a page.</span>
<% end %>
<%= f.hidden_field :node_id %>
</div>
<div class="node_description">Start time</div>
<div class="node_content"><%= f.datetime_select :start_time %></div>
<div class="node_description">End time</div>
<div class="node_content"><%= f.datetime_select :end_time %></div>
<div class="node_description">Recurrence</div>
<div class="node_content">
<div id="rrule_builder">
<p>
<label><%= radio_button_tag "rrule_freq", "weekly", true %> Weekly</label>
<label><%= radio_button_tag "rrule_freq", "monthly" %> Monthly</label>
</p>
<div id="rrule_weekly_options">
<p><label><%= check_box_tag "rrule_biweekly" %> Every 2 weeks</label></p>
<p>
<% %w[MO TU WE TH FR SA SU].each do |code| %>
<label><%= check_box_tag "rrule_byday_#{code}" %> <%= RruleHumanizer::WEEKDAY_NAMES_ABBR[:de][code] %></label>
<% end %>
</p>
</div>
<div id="rrule_monthly_options" style="display: none;">
<p><label><%= check_box_tag "rrule_monthly_ordinal" %> On a specific weekday each month</label></p>
<p id="rrule_ordinal_fields" style="display: none;">
<%= select_tag "rrule_ordinal", options_for_select([["1.", 1], ["2.", 2], ["3.", 3], ["4.", 4], ["letzter", -1], ["vorletzter", -2]]) %>
<%= select_tag "rrule_ordinal_day", options_for_select(%w[MO TU WE TH FR SA SU].map { |c| [RruleHumanizer::WEEKDAY_NAMES[:de][c], c] }) %>
</p>
</div>
<p>
<label><%= check_box_tag "rrule_exclude_month" %> Except in one month</label>
<%= select_tag "rrule_excluded_month", options_for_select((1..12).map { |m| [RruleHumanizer::MONTH_NAMES[:de][m-1], m] }), style: "display: none;" %>
</p>
<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>
</div>
<%= f.text_field :rrule, id: "event_rrule" %>
</div>
<div class="node_description">Title</div>
<div class="node_content">
<%= f.text_field :title %>
<span id="event_title_hint" class="field_hint">Optional — if left blank, the associated node's title is used.</span>
</div>
<div class="node_description">Tags</div>
<div class="node_content"><%= f.text_field :tag_list %></div>
<div class="node_description">Allday</div>
<div class="node_content"><%= f.check_box :allday %></div>
<div class="node_description">Url</div>
<div class="node_content"><%= f.text_field :url %></div>
<div class="node_description">Latitude</div>
<div class="node_content"><%= f.text_field :latitude %></div>
<div class="node_description">Longitude</div>
<div class="node_content"><%= f.text_field :longitude %></div>
<div class="node_description"></div>
<div class="node_content"><%= f.submit 'Update' %></div>
</div>
</div>
<% end %>
|