recurrence_ui 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -12
  3. data/app/assets/stylesheets/recurrence_ui/application.css +962 -12
  4. data/app/components/recurrence_ui/recurrence_picker_component.html.erb +85 -83
  5. data/app/javascript/recurrence_ui/recurrence_ui_controller.js +53 -42
  6. data/app/views/recurrence_ui/_daily.html.erb +3 -3
  7. data/app/views/recurrence_ui/_duration.html.erb +33 -36
  8. data/app/views/recurrence_ui/_end_at.html.erb +5 -4
  9. data/app/views/recurrence_ui/_exceptions.html.erb +22 -22
  10. data/app/views/recurrence_ui/_footer_actions.html.erb +1 -1
  11. data/app/views/recurrence_ui/_monthly_by_day_of_month.html.erb +5 -5
  12. data/app/views/recurrence_ui/_monthly_by_weekday.html.erb +12 -12
  13. data/app/views/recurrence_ui/_rdates.html.erb +22 -22
  14. data/app/views/recurrence_ui/_rule_card.html.erb +9 -9
  15. data/app/views/recurrence_ui/_single_rule.html.erb +13 -11
  16. data/app/views/recurrence_ui/_start_at.html.erb +17 -21
  17. data/app/views/recurrence_ui/_summary_link.html.erb +4 -4
  18. data/app/views/recurrence_ui/_termination.html.erb +13 -12
  19. data/app/views/recurrence_ui/_time_zone.html.erb +11 -9
  20. data/app/views/recurrence_ui/_weekly.html.erb +19 -24
  21. data/app/views/recurrence_ui/_yearly_by_day_of_month.html.erb +9 -10
  22. data/app/views/recurrence_ui/_yearly_by_weekday.html.erb +11 -12
  23. data/config/locales/recurrence_ui.ru.yml +2 -2
  24. data/config/routes.rb +0 -3
  25. data/lib/generators/recurrence_ui/install/install_generator.rb +29 -23
  26. data/lib/generators/recurrence_ui/install/templates/recurrence_ui.rb +40 -0
  27. data/lib/recurrence_ui/engine.rb +1 -0
  28. data/lib/recurrence_ui/version.rb +1 -1
  29. metadata +3 -4
  30. data/app/assets/stylesheets/recurrence_ui/components.css +0 -295
  31. data/app/assets/stylesheets/recurrence_ui/tokens.css +0 -102
@@ -2,9 +2,9 @@
2
2
  <%# Monthly Recurrence Rule Options (By Day of Month) %>
3
3
  <% selected_days_for_monthly = local_assigns.fetch(:selected_days_for_monthly, {}) %>
4
4
 
5
- <div class="space-y-3" data-item="specificFields" data-rule="monthly_by_day_of_month">
5
+ <div class="rui-monthly-container" data-item="specificFields" data-rule="monthly_by_day_of_month">
6
6
  <%# Interval Input Header %>
7
- <div class="flex items-center space-x-2">
7
+ <div class="rui-monthly-interval-row">
8
8
  <span class="rui-inline-label">
9
9
  <%= t("recurrence_ui.labels.every", default: "Every") %>
10
10
  </span>
@@ -12,7 +12,7 @@
12
12
  <%= number_field_tag nil, rec_ui.initial_interval,
13
13
  value: 1,
14
14
  min: 1,
15
- class: "rui-input w-16 text-center",
15
+ class: "rui-input rui-monthly-interval-input",
16
16
  data: {
17
17
  item: "interval",
18
18
  action: "input->#{identifier}#onCardInputChanged"
@@ -25,11 +25,11 @@
25
25
 
26
26
  <%# Month Days Selection Section %>
27
27
  <div data-<%= identifier %>-target="monthlyDays">
28
- <label class="rui-label mb-2">
28
+ <label class="rui-label rui-monthly-days-label">
29
29
  <%= t("recurrence_ui.labels.select_dates", default: "Select dates") %>:
30
30
  </label>
31
31
 
32
- <div class="grid grid-cols-7 gap-1">
32
+ <div class="rui-monthly-grid">
33
33
  <% (1..31).each do |day| %>
34
34
  <% is_selected = selected_days_for_monthly.to_a.include?(day) %>
35
35
 
@@ -2,21 +2,20 @@
2
2
  <%# Monthly Recurrence Rule Options (By Weekday / Nth Day) %>
3
3
  <% selected_nth_days = local_assigns.fetch(:selected_nth_days, {}) %>
4
4
 
5
- <div class="space-y-3" data-item="specificFields" data-rule="monthly_by_weekday">
5
+ <div class="rui-monthly-container" data-item="specificFields" data-rule="monthly_by_weekday">
6
6
  <%# Interval Input Header %>
7
- <div class="flex items-center space-x-2">
7
+ <div class="rui-monthly-interval-row">
8
8
  <span class="rui-inline-label">
9
9
  <%= t("recurrence_ui.labels.every", default: "Every") %>
10
10
  </span>
11
11
 
12
- <%= number_field_tag nil, rec_ui.initial_interval,
13
- value: 1,
14
- min: 1,
15
- class: "rui-input w-16 text-center",
12
+ <%= number_field_tag nil, rec_ui.initial_interval,
13
+ min: 1,
14
+ class: "rui-input rui-monthly-interval-input",
16
15
  data: {
17
16
  item: "interval",
18
17
  action: "input->#{identifier}#onCardInputChanged"
19
- } %>
18
+ } %>
20
19
 
21
20
  <span class="rui-inline-label">
22
21
  <%= t("recurrence_ui.labels.month", count: rec_ui.initial_interval, default: "month(s)") %>
@@ -24,18 +23,18 @@
24
23
  </div>
25
24
 
26
25
  <%# Grid of Nth Days (1st, 2nd, 3rd, 4th, 5th, Last) %>
27
- <div class="space-y-1">
26
+ <div class="rui-nth-container">
28
27
  <% %w[1 2 3 4 5 -1].each do |val| %>
29
- <div class="grid grid-cols-8 gap-1 items-center">
28
+ <div class="rui-nth-row">
30
29
  <%# Row Label (Ordinal Name) %>
31
- <div class="col-span-1 text-[10px] text-right pr-1">
32
- <span class="rui-label mb-0 text-[10px] font-bold">
30
+ <div class="rui-nth-label-col">
31
+ <span class="rui-label rui-nth-label">
33
32
  <%= t("recurrence_ui.nth_names.#{val}") %>
34
33
  </span>
35
34
  </div>
36
35
 
37
36
  <%# Day Buttons Grid %>
38
- <div class="col-span-7 grid grid-cols-7 gap-1">
37
+ <div class="rui-nth-grid">
39
38
  <% days_for_ui.each do |day_idx| %>
40
39
  <% is_selected = selected_nth_days[val.to_s]&.include?(day_idx) %>
41
40
  <button type="button"
@@ -45,6 +44,7 @@
45
44
  data-<%= identifier %>-target="nthDayBtn"
46
45
  data-selected="<%= !!is_selected %>"
47
46
  data-action="click-><%= identifier %>#toggleDay">
47
+ <%# Important: always specify the scope for weekdays to avoid dependency on the default locale %>
48
48
  <%= t('recurrence_ui.date.abbr_day_names', locale: I18n.locale)[day_idx] %>
49
49
  </button>
50
50
  <% end %>
@@ -1,41 +1,41 @@
1
1
  <%# app/views/recurrence_ui/_rdates.html.erb %>
2
2
  <%# Additional Dates (RDATES) Section %>
3
- <div class="space-y-1.5">
3
+ <div class="rui-rdates-container rui-divider ">
4
4
  <%# 1. Section Label %>
5
- <label class="rui-label flex items-center gap-1">
6
- <%= t("recurrence_ui.labels.rdates", locale: locale, default: "Additional Dates") %>
5
+ <label class="rui-label rui-rdates-label">
6
+ <%= t("recurrence_ui.labels.rdates", locale: locale, default: "Additional Dates") %>
7
7
  </label>
8
8
 
9
- <%# 2. Container for RDATE Chips %>
10
- <div data-<%= identifier %>-target="rdatesContainer" class="flex flex-wrap gap-1">
11
- <% rdates.each do |rdate| %>
12
- <% date_str = rdate.is_a?(Date) || rdate.is_a?(Time) ? rdate.strftime("%Y-%m-%d") : rdate.to_s %>
13
- <span class="rui-chip rui-chip--rdate" data-rdate-value="<%= date_str %>">
14
- <button type="button"
15
- data-action="click-><%= identifier %>#removeRdate"
16
- class="rui-chip__remove-btn"
17
- title="<%= t('recurrence_ui.actions.remove', default: 'Delete') %>">✕</button>
18
- <span><%= rec_ui._formatDate(date_str) rescue date_str %></span>
19
- </span>
20
- <% end %>
21
- </div>
22
-
23
- <%# 3. Date Input and Add Button %>
24
- <div class="flex items-center gap-1.5 pt-1">
9
+ <%# 2. Date Input and Add Button (теперь первыми) %>
10
+ <div class="rui-rdates-input-group">
25
11
  <input type="date"
26
12
  data-<%= identifier %>-target="rdateInput"
27
- data-action="input-><%= identifier %>#onDateInputChange"
28
- class="rui-input w-full text-xs py-1 px-2">
13
+ data-action="input-><%= identifier %>#onDateInputChange change-><%= identifier %>#onDateInputChange"
14
+ class="rui-input rui-input-date rui-rdates-date-input">
29
15
 
30
16
  <button type="button"
31
17
  data-<%= identifier %>-target="addRdateBtn"
32
18
  data-action="click-><%= identifier %>#addRdate"
33
19
  disabled
34
20
  title="<%= t('recurrence_ui.actions.add_rdate', default: 'Add date') %>"
35
- class="rui-btn rui-btn-primary px-2 py-1 text-xs font-bold">
21
+ class="rui-btn rui-btn-primary rui-rdates-add-btn">
36
22
  +
37
23
  </button>
38
24
  </div>
25
+
26
+ <%# 3. Container for RDATE Chips (теперь под инпутом) %>
27
+ <div data-<%= identifier %>-target="rdatesContainer" class="rui-chip-container">
28
+ <% rdates.each do |rdate| %>
29
+ <% date_str = rdate.is_a?(Date) || rdate.is_a?(Time) ? rdate.strftime("%Y-%m-%d") : rdate.to_s %>
30
+ <span class="rui-chip rui-chip--rdate" data-rdate-value="<%= date_str %>">
31
+ <button type="button"
32
+ data-action="click-><%= identifier %>#removeRdate"
33
+ class="rui-chip__remove-btn"
34
+ title="<%= t('recurrence_ui.actions.remove', default: 'Delete') %>">✕</button>
35
+ <span><%= rec_ui._formatDate(date_str) rescue date_str %></span>
36
+ </span>
37
+ <% end %>
38
+ </div>
39
39
  </div>
40
40
 
41
41
  <%# 4. Template for Dynamically Generated RDATE Chips via JS %>
@@ -1,5 +1,5 @@
1
1
  <%# app/views/recurrence_ui/_rule_card.html.erb %>
2
- <div data-<%= identifier %>-target="ruleCard" class="group rui-card-container w-full">
2
+ <div data-<%= identifier %>-target="ruleCard" class="rui-card-group rui-card-container">
3
3
 
4
4
  <%# 1. Rule Header: Card border & Clickable Area %>
5
5
  <div class="rui-card-header" data-action="click-><%= identifier %>#toggleCardAccordion">
@@ -20,16 +20,16 @@
20
20
  </div>
21
21
 
22
22
  <%# 2. Rule Accordion Body %>
23
- <div data-<%= identifier %>-target="cardBody" class="hidden rui-card-body">
23
+ <div data-<%= identifier %>-target="cardBody" class="rui-hidden rui-card-body">
24
24
 
25
25
  <%# Frequency Selector Block %>
26
- <div>
26
+ <div class="rui-frequency-block">
27
27
  <label class="rui-label">
28
- <%= t('recurrence_ui.labels.frequency', default: 'Частота') %>
28
+ <%= t('recurrence_ui.labels.frequency', default: 'Frequency') %>
29
29
  </label>
30
30
  <select data-item="ruleType"
31
31
  data-action="change-><%= identifier %>#toggleCardFields"
32
- class="rui-select w-full">
32
+ class="rui-select rui-w-full">
33
33
  <% rule_options.each do |label, value| %>
34
34
  <option value="<%= value %>"><%= label %></option>
35
35
  <% end %>
@@ -38,18 +38,18 @@
38
38
 
39
39
  <%# Dynamic Specific Rule Fields %>
40
40
  <% rule_options.map(&:last).each do |rule| %>
41
- <div data-item="specificFields" data-rule="<%= rule %>" class="hidden">
41
+ <div data-item="specificFields" data-rule="<%= rule %>" class="rui-hidden">
42
42
  <%= render "recurrence_ui/#{rule}", form: form, identifier: identifier, days_for_ui: days_for_ui, rec_ui: rec_ui %>
43
43
  </div>
44
44
  <% end %>
45
-
45
+ <% if rec_ui.show_termination %>
46
46
  <%# Termination Settings Section %>
47
47
  <div data-item="terminationBlock">
48
48
  <%= render "recurrence_ui/termination", form: form, identifier: identifier, rec_ui: rec_ui %>
49
49
  </div>
50
-
50
+ <% end %>
51
51
  <%# Accordion Close Action (Positioned on the Right) %>
52
- <div class="pt-1 text-right">
52
+ <div class="rui-card-footer">
53
53
  <button type="button"
54
54
  data-action="click-><%= identifier %>#toggleCardAccordion"
55
55
  class="rui-btn-secondary">
@@ -1,35 +1,37 @@
1
1
  <%# app/views/recurrence_ui/_single_rule.html.erb %>
2
- <div class="space-y-4" data-<%= identifier %>-target="ruleCard">
2
+ <div class="rui-single-rule-block" data-<%= identifier %>-target="ruleCard">
3
3
 
4
4
  <%# Frequency Selector Block %>
5
- <div>
6
-
7
- <%# Живое превью правила сверху селекта %>
8
- <div class="mb-2">
9
- <span data-item="cardSummary" class="rui-inline-label">
5
+ <div class="rui-single-rule-block">
6
+ <div class="rui-single-rule-header">
7
+ <span class="rui-label rui-single-rule-label">
8
+ <%= t('recurrence_ui.labels.frequency', default: 'Frequency') %>
9
+ </span>
10
+ <span data-item="cardSummary" class="rui-rule-preview-badge">
10
11
  <%= t('recurrence_ui.labels.new_rule', default: 'New rule') %>
11
12
  </span>
12
13
  </div>
13
14
 
14
15
  <select data-item="ruleType"
15
16
  data-action="change-><%= identifier %>#toggleCardFields change-><%= identifier %>#onCardInputChanged"
16
- class="rui-select w-full">
17
+ class="rui-select">
18
+ <option value="never" <%= "selected" if rec_ui.current_rule_type == 'never' || rec_ui.current_rule_type.blank? %>>
19
+ <%= t("recurrence_ui.types.never", default: "No recurrence") %>
20
+ </option>
17
21
  <% rec_ui.rule_options.each do |label, value| %>
18
22
  <option value="<%= value %>" <%= "selected" if rec_ui.current_rule_type == value %>><%= label %></option>
19
23
  <% end %>
20
24
  </select>
21
25
  </div>
22
26
 
23
- <%# Dynamic Specific Rule Fields (используем data-item="specificFields", как в мультиправилах) %>
24
27
  <% rec_ui.rule_options.map(&:last).each do |rule| %>
25
- <div data-item="specificFields" data-rule="<%= rule %>" class="hidden space-y-3">
28
+ <div data-item="specificFields" data-rule="<%= rule %>" class="rui-hidden" style="display: flex; flex-direction: column; gap: 0.75rem;">
26
29
  <%= render "recurrence_ui/#{rule}", form: form, identifier: identifier, days_for_ui: rec_ui.days_for_ui, rec_ui: rec_ui %>
27
30
  </div>
28
31
  <% end %>
29
32
 
30
- <%# Termination Settings Section %>
31
33
  <% if rec_ui.show_termination %>
32
- <div class="pt-2 border-t border-[var(--rui-border-color)]">
34
+ <div data-item="terminationBlock" class="<%= 'rui-hidden' if rec_ui.current_rule_type == 'never' || rec_ui.current_rule_type.blank? %>" style="padding-top: 0.5rem; border-top: 1px solid var(--rui-border-color);">
33
35
  <%= render "recurrence_ui/termination", form: form, identifier: identifier, rec_ui: rec_ui %>
34
36
  </div>
35
37
  <% end %>
@@ -1,22 +1,18 @@
1
- <%# app/views/recurrence_ui/_start_at.html.erb %>
2
- <% default_start_time = rec_ui.start_time || RecurrenceUi.config.resolved_start_time %>
3
- <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
4
-
5
- <!-- 1. Дата и время начала (всегда на одной строке, не тянутся) -->
6
- <div>
7
- <%= form.label :start_at, t('recurrence_ui.labels.start_at'), class: "rui-label block" %>
8
- <div class="flex items-center space-x-2 mt-1">
9
- <%= form.date_field :form_start_date,
10
- value: form.object.start_time_in_zone(:event)&.to_date || Date.current,
11
- class: "rui-input w-36 shrink-0",
12
- data: { "#{identifier}_target": "startDate",
13
- action: "change->#{identifier}#calculateEndDateFromDuration" } %>
14
- <%= form.time_field :form_start_time,
15
- value: form.object.start_time_in_zone(:event)&.strftime('%H:%M') || default_start_time,
16
- class: "rui-input w-24 shrink-0",
17
- data: { "#{identifier}_target": "startTime",
18
- action: "change->#{identifier}#calculateEndDateFromDuration" }
19
- %>
20
- </div>
21
- </div>
1
+ <%# app/views/recurrence_ui/_start_at.html.erb %>
2
+ <% default_start_time = rec_ui.start_time || RecurrenceUi.config.resolved_start_time %>
3
+ <div class="rui-field-group">
4
+ <%= form.label :start_at, t('recurrence_ui.labels.start_at'), class: "rui-label" %>
5
+ <div class="rui-start-at-row">
6
+ <%= form.date_field :form_start_date,
7
+ value: form.object.start_time_in_zone(:event)&.to_date || Date.current,
8
+ class: "rui-input rui-input-date",
9
+ data: { "#{identifier}_target": "startDate",
10
+ action: "change->#{identifier}#calculateEndDateFromDuration" } %>
11
+ <%= form.time_field :form_start_time,
12
+ value: form.object.start_time_in_zone(:event)&.strftime('%H:%M') || default_start_time,
13
+ class: "rui-input rui-input-time",
14
+ data: { "#{identifier}_target": "startTime",
15
+ action: "change->#{identifier}#calculateEndDateFromDuration" }
16
+ %>
17
+ </div>
22
18
  </div>
@@ -1,10 +1,10 @@
1
1
  <%# app/views/recurrence_ui/_summary_link.html.erb %>
2
2
  <%# Summary Link (Display Mode) %>
3
- <div data-<%= identifier %>-target="displayMode" class="group cursor-pointer py-0.5">
4
- <div class="flex items-center gap-2">
3
+ <div data-<%= identifier %>-target="displayMode" class="rui-summary-wrapper">
4
+ <div class="rui-summary-row">
5
5
 
6
6
  <%# Interactive Summary Text with full dotted/dashed underline %>
7
- <div class="flex-1 min-w-0">
7
+ <div class="rui-summary-text-container">
8
8
  <span
9
9
  data-<%= identifier %>-target="summaryText"
10
10
  data-action="click-><%= identifier %>#editRule"
@@ -16,7 +16,7 @@
16
16
 
17
17
  <%# Pencil Icon - visible on hover %>
18
18
  <div class="rui-summary-icon">
19
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
19
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 1rem; height: 1rem;">
20
20
  <path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
21
21
  </svg>
22
22
  </div>
@@ -1,19 +1,20 @@
1
1
  <%# app/views/recurrence_ui/_termination.html.erb %>
2
2
  <%# Termination / End Condition Section for Recurrence Rules %>
3
- <div data-item="termination">
4
- <label class="rui-label mb-2">
3
+ <div data-item="termination" class="rui-termination-container">
4
+ <label class="rui-label rui-termination-label">
5
5
  <%= t("recurrence_ui.labels.termination", default: "Ends") %>
6
6
  </label>
7
7
 
8
- <div class="flex flex-wrap items-center gap-2">
9
- <%# Termination Type Selector %>
8
+ <div class="rui-termination-row">
9
+ <%# 1. Селект фиксированной ширины %>
10
+ <%# Добавили класс rui-input-date или можно задать ширину через инлайн-стиль / спец.класс, если нужно точное значение %>
10
11
  <%= select_tag :end_type,
11
12
  options_for_select([
12
13
  [t("recurrence_ui.termination_types.never", default: "Never"), 'never'],
13
14
  [t("recurrence_ui.termination_types.until", default: "On date"), 'until'],
14
15
  [t("recurrence_ui.termination_types.count", default: "After number of times"), 'count']
15
16
  ]),
16
- class: "rui-select",
17
+ class: "rui-select rui-termination-select",
17
18
  data: {
18
19
  item: "endType",
19
20
  "#{identifier}_target": "endType",
@@ -21,22 +22,22 @@
21
22
  }
22
23
  %>
23
24
 
24
- <%# Specific End Date Input %>
25
+ <%# 2. Поле для даты (появляется напротив селекта благодаря .rui-termination-row) %>
25
26
  <input type="date"
26
- class="rui-input hidden text-xs"
27
+ class="rui-input rui-hidden rui-termination-date rui-input-date"
27
28
  data-item="endDateInput"
28
29
  data-<%= identifier %>-target="endDate"
29
- data-action="change-><%= identifier %>#onCardInputChanged">
30
+ data-action="change->#{identifier}#onCardInputChanged">
30
31
 
31
- <%# Count Input Field %>
32
- <div data-item="endCount" data-<%= identifier %>-target="endCount" class="hidden flex items-center gap-2">
32
+ <%# 2. Поле для количества (появляется напротив селекта) %>
33
+ <div data-item="endCount" data-<%= identifier %>-target="endCount" class="rui-hidden rui-termination-count-group">
33
34
  <input type="number" min="1" placeholder="10"
34
- class="rui-input w-20 text-xs"
35
+ class="rui-input rui-termination-count-input"
35
36
  data-item="endCountInput"
36
37
  data-<%= identifier %>-target="endCountInput"
37
38
  data-action="input-><%= identifier %>#onCardInputChanged">
38
39
 
39
- <span class="rui-inline-label text-xs uppercase font-semibold">
40
+ <span class="rui-termination-times-label">
40
41
  <%= t("recurrence_ui.labels.times", default: "times") %>
41
42
  </span>
42
43
  </div>
@@ -1,9 +1,11 @@
1
- <%# Time zone #%>
2
- <div>
3
- <%= form.label :time_zone, t('recurrence_ui.labels.time_zone'), class: "rui-label block" %>
4
- <%= form.time_zone_select :time_zone,
5
- ActiveSupport::TimeZone.all,
6
- { default: rec_ui.record.public_send(rec_ui.time_zone_field).presence || Time.zone.name },
7
- { class: "rui-input rui-select cursor-pointer w-full mt-1" }
8
- %>
9
- </div>
1
+ <%# Time zone %>
2
+ <div class="rui-field-group rui-timezone-container">
3
+ <%= form.label :time_zone, t('recurrence_ui.labels.time_zone'), class: "rui-label" %>
4
+ <div class="rui-timezone-at-row">
5
+ <%= form.time_zone_select :time_zone,
6
+ ActiveSupport::TimeZone.all,
7
+ { default: rec_ui.record.public_send(rec_ui.time_zone_field).presence || Time.zone.name },
8
+ { class: "rui-input rui-select rui-timezone-select" }
9
+ %>
10
+ </div>
11
+ </div>
@@ -2,17 +2,14 @@
2
2
  <%# Weekly Recurrence Rule Options %>
3
3
  <% selected_days = local_assigns[:selected_weekly_days] || rec_ui.selected_weekly_days %>
4
4
 
5
- <div class="space-y-3" data-item="specificFields" data-rule="weekly">
5
+ <div class="rui-weekly-container" data-item="specificFields" data-rule="weekly">
6
6
  <%# Interval Input Header %>
7
- <div class="flex items-center space-x-2">
8
- <span class="rui-inline-label">
9
- <%= t("recurrence_ui.every_week", default: "Every") %>
10
- </span>
7
+ <div class="rui-weekly-interval-row">
8
+ <span class="rui-inline-label"><%= t("recurrence_ui.every_week", default: "Every") %></span>
11
9
 
12
- <%= number_field_tag nil, rec_ui.initial_interval,
13
- value: 1,
10
+ <%= number_field_tag nil, rec_ui.initial_interval,
14
11
  min: 1,
15
- class: "rui-input w-16 text-center",
12
+ class: "rui-input rui-weekly-interval-input",
16
13
  data: {
17
14
  item: "interval",
18
15
  action: "input->#{identifier}#onCardInputChanged"
@@ -24,21 +21,19 @@
24
21
  </div>
25
22
 
26
23
  <%# Days of Week Selection Grid %>
27
- <div>
28
- <div class="grid grid-cols-7 gap-1">
29
- <% days_for_ui.each do |day_idx| %>
30
- <%# Abbreviated day name based on current locale %>
31
- <% day_name = t('recurrence_ui.date.abbr_day_names', locale: I18n.locale)[day_idx] %>
32
-
33
- <button type="button"
34
- class="rui-day-btn"
35
- data-value="<%= day_idx %>"
36
- data-selected="<%= selected_days.include?(day_idx) %>"
37
- data-action="click-><%= identifier %>#toggleDay"
38
- data-<%= identifier %>-target="dayButton">
39
- <%= day_name %>
40
- </button>
41
- <% end %>
42
- </div>
24
+ <div class="rui-weekly-grid">
25
+ <% days_for_ui.each do |day_idx| %>
26
+ <%# Abbreviated day name based on current locale %>
27
+ <% day_name = t('recurrence_ui.date.abbr_day_names', locale: I18n.locale)[day_idx] %>
28
+
29
+ <button type="button"
30
+ class="rui-day-btn"
31
+ data-value="<%= day_idx %>"
32
+ data-selected="<%= selected_days.include?(day_idx) %>"
33
+ data-action="click-><%= identifier %>#toggleDay"
34
+ data-<%= identifier %>-target="dayButton">
35
+ <%= day_name %>
36
+ </button>
37
+ <% end %>
43
38
  </div>
44
39
  </div>
@@ -2,17 +2,16 @@
2
2
  <%# Yearly Recurrence Rule Options (By Day of Month) %>
3
3
  <% selected_days_for_yearly = local_assigns.fetch(:selected_days_for_yearly, {}) %>
4
4
 
5
- <div class="space-y-3" data-item="specificFields" data-rule="yearly_by_day_of_month">
5
+ <div class="rui-monthly-container" data-item="specificFields" data-rule="yearly_by_day_of_month">
6
6
  <%# Interval Input Header %>
7
- <div class="flex items-center space-x-2">
7
+ <div class="rui-monthly-interval-row">
8
8
  <span class="rui-inline-label">
9
9
  <%= t("recurrence_ui.labels.every", default: "Every") %>
10
10
  </span>
11
11
 
12
- <%= number_field_tag nil, rec_ui.initial_interval,
13
- value: 1,
12
+ <%= number_field_tag nil, rec_ui.initial_interval,
14
13
  min: 1,
15
- class: "rui-input w-16 text-center",
14
+ class: "rui-input rui-monthly-interval-input",
16
15
  data: {
17
16
  item: "interval",
18
17
  action: "input->#{identifier}#onCardInputChanged"
@@ -24,15 +23,15 @@
24
23
  </div>
25
24
 
26
25
  <%# Month Selector %>
27
- <div data-<%= identifier %>-target="monthSelector" class="flex items-center gap-3">
28
- <label class="rui-inline-label whitespace-nowrap">
26
+ <div data-<%= identifier %>-target="monthSelector" class="rui-month-selector-row">
27
+ <label class="rui-inline-label rui-nowrap">
29
28
  <%= t("recurrence_ui.labels.choose_month", default: "Choose month") %>:
30
29
  </label>
31
30
 
32
31
  <select data-<%= identifier %>-target="monthInput"
33
32
  data-item="month"
34
33
  data-action="change-><%= identifier %>#onCardInputChanged"
35
- class="rui-select w-full sm:w-auto">
34
+ class="rui-select rui-month-select">
36
35
  <% (1..12).each do |m| %>
37
36
  <% month_name = I18n.t("recurrence_ui.date.standalone_month_names", default: I18n.t("recurrence_ui.date.month_names"))[m] %>
38
37
  <option value="<%= m %>"><%= month_name %></option>
@@ -42,11 +41,11 @@
42
41
 
43
42
  <%# Month Days Selection Section %>
44
43
  <div data-<%= identifier %>-target="monthlyDays">
45
- <label class="rui-label mb-2">
44
+ <label class="rui-label rui-monthly-days-label">
46
45
  <%= t("recurrence_ui.labels.select_dates", default: "Select dates") %>:
47
46
  </label>
48
47
 
49
- <div class="grid grid-cols-7 gap-1">
48
+ <div class="rui-monthly-grid">
50
49
  <% (1..31).each do |day| %>
51
50
  <% is_selected = selected_days_for_yearly.to_a.include?(day) %>
52
51
  <button type="button"
@@ -2,17 +2,16 @@
2
2
  <%# Yearly Recurrence Rule Options (By Weekday / Nth Day) %>
3
3
  <% selected_nth_days = local_assigns.fetch(:selected_nth_days, {}) %>
4
4
 
5
- <div class="space-y-3" data-item="specificFields" data-rule="yearly_by_weekday">
5
+ <div class="rui-monthly-container" data-item="specificFields" data-rule="yearly_by_weekday">
6
6
  <%# Interval Input Header %>
7
- <div class="flex items-center space-x-2">
7
+ <div class="rui-monthly-interval-row">
8
8
  <span class="rui-inline-label">
9
9
  <%= t("recurrence_ui.labels.every", default: "Every") %>
10
10
  </span>
11
11
 
12
12
  <%= number_field_tag nil, rec_ui.initial_interval,
13
- value: 1,
14
13
  min: 1,
15
- class: "rui-input w-16 text-center",
14
+ class: "rui-input rui-monthly-interval-input",
16
15
  data: {
17
16
  item: "interval",
18
17
  action: "input->#{identifier}#onCardInputChanged"
@@ -24,15 +23,15 @@
24
23
  </div>
25
24
 
26
25
  <%# Month Selector %>
27
- <div data-<%= identifier %>-target="monthSelector" class="flex items-center gap-3">
28
- <label class="rui-inline-label whitespace-nowrap">
26
+ <div data-<%= identifier %>-target="monthSelector" class="rui-month-selector-row">
27
+ <label class="rui-inline-label rui-nowrap">
29
28
  <%= t("recurrence_ui.labels.choose_month", default: "Choose month") %>:
30
29
  </label>
31
30
 
32
31
  <select data-<%= identifier %>-target="monthInput"
33
32
  data-item="month"
34
33
  data-action="change-><%= identifier %>#onCardInputChanged"
35
- class="rui-select w-full sm:w-auto">
34
+ class="rui-select rui-month-select">
36
35
  <% (1..12).each do |m| %>
37
36
  <% month_name = I18n.t("recurrence_ui.date.standalone_month_names", default: t("recurrence_ui.date.month_names"))[m] %>
38
37
  <option value="<%= m %>"><%= month_name %></option>
@@ -41,18 +40,18 @@
41
40
  </div>
42
41
 
43
42
  <%# Grid of Nth Days (1st, 2nd, 3rd, 4th, 5th, Last) %>
44
- <div class="space-y-1">
43
+ <div class="rui-nth-container">
45
44
  <% %w[1 2 3 4 5 -1].each do |val| %>
46
- <div class="grid grid-cols-8 gap-1 items-center">
45
+ <div class="rui-nth-row">
47
46
  <%# Row Label (Ordinal Name) %>
48
- <div class="col-span-1 text-[10px] text-right pr-1">
49
- <span class="rui-label mb-0 text-[10px] font-bold">
47
+ <div class="rui-nth-label-col">
48
+ <span class="rui-label rui-nth-label">
50
49
  <%= t("recurrence_ui.nth_names.#{val}") %>
51
50
  </span>
52
51
  </div>
53
52
 
54
53
  <%# Day Buttons Grid %>
55
- <div class="col-span-7 grid grid-cols-7 gap-1">
54
+ <div class="rui-nth-grid">
56
55
  <% days_for_ui.each do |day_idx| %>
57
56
  <% is_selected = selected_nth_days[val.to_s]&.include?(day_idx) %>
58
57
  <button type="button"
@@ -188,7 +188,7 @@ ru:
188
188
  other: Каждый %{count_f} день %{until}
189
189
  monthly_by_day_of_month:
190
190
  one: 'Каждый месяц: %{days_of_month} %{until}'
191
- other: 'Каждые %{count_f} месяц: %{days_of_month} %{until}'
191
+ other: 'Каждый %{count_f} месяц: %{days_of_month} %{until}'
192
192
  monthly_by_weekday:
193
193
  one: 'Каждый месяц: %{weekdays} %{until}'
194
194
  other: 'Каждый %{count_f} месяц: %{weekdays} %{until}'
@@ -209,7 +209,7 @@ ru:
209
209
  daily: Ежедневно
210
210
  monthly_by_day_of_month: Ежемесячно (по дню месяца)
211
211
  monthly_by_weekday: Ежемесячно (по дню недели)
212
- never: Без повторения
212
+ never: Без регулярного повторения
213
213
  weekly: Еженедельно
214
214
  yearly_by_day_of_month: Ежегодно (по дню месяца)
215
215
  yearly_by_weekday: Ежегодно (по дню недели)
data/config/routes.rb CHANGED
@@ -1,5 +1,2 @@
1
1
  RecurrenceUi::Engine.routes.draw do
2
- if Rails.env.development?
3
- get '/dev/recurrence_previews', to: 'dev/recurrence_previews#index'
4
- end
5
2
  end