summaryrefslogtreecommitdiff
path: root/app/views/events/_rrule_builder.html.erb
blob: 1ffec0a2f097356eb3680f9851d9a93e83030db1 (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
<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], ["Selected weeks", "custom"]]) %>
      <%= 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>
    <p id="rrule_custom_ordinal_fields" style="display: none;">
      Weeks of the month:
      <% (1..5).each do |ordinal| %>
        <label><%= check_box_tag "rrule_custom_ordinal_#{ordinal}" %> <%= ordinal %>.</label>
      <% end %>
    </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" %>