summaryrefslogtreecommitdiff
path: root/app/views/events/edit.html.erb
blob: d37c299f2c839c70867809627d5587b3a2f171ed (plain)
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
<% content_for :subnavigation do %>
  <%= link_to 'back', safe_return_to(params[:return_to] || events_path) %>
  <%= button_to 'destroy', event_path(@event), method: :delete, form: { data: { confirm: 'Delete this event?' }, class: 'button_to destructive' } %>
<% end %>

<h1>Editing event</h1>

<%= form_for(@event) do |f| %>
  <%= hidden_field_tag :return_to, @return_to %>
  <%= form_error_messages(f) %>

  <p>
    <%= f.label :start_time %><br />
    <%= f.datetime_select :start_time %>
  </p>
  <p>
    <%= f.label :end_time %><br />
    <%= f.datetime_select :end_time %>
  </p>
  <p>
    <%= f.label :rrule, "Recurrence" %>
    <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" %>
  </p>
  <p>
    <%= f.label :tag_list, "Tags" %><br />
    <%= f.text_field :tag_list %>
  </p>
  <p>
    <%= f.label :allday %><br />
    <%= f.check_box :allday %>
  </p>
  <p>
    <%= f.label :url %><br />
    <%= f.text_field :url %>
  </p>
  <p>
    <%= f.label :latitude %><br />
    <%= f.text_field :latitude %>
  </p>
  <p>
    <%= f.label :longitude %><br />
    <%= f.text_field :longitude %>
  </p>
  <p>
    <%= f.hidden_field :node_id %>
  </p>
  <p>
    <%= f.submit 'Update' %>
  </p>
<% end %>