bullet_train-themes-tailwind_css 1.3.0 → 1.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d48e006fc00a8c1378d3ecff2ec43583addd63c802b99a9ac33bfd6477aa61b4
4
- data.tar.gz: 48550a93c75322d1c37770056abc980b1fd3f31b9c01b4842bde39639ef400d0
3
+ metadata.gz: bcddcd3ebc08ff9776d4b1d9553dc1cb5f62904bf355ec4b1663f650977e0292
4
+ data.tar.gz: f5ba1d827b9e78b0688af5edd746b5a4c250fd38ac997a38a0f951bd51da6366
5
5
  SHA512:
6
- metadata.gz: 102dcf8cf3b79b18f0f844ad3747a8a3ea44e259669b44abffe91ec77452b06add0a38897f32dd3439a4a8c26ad9564fa761d746a344c6fd6567bf581ae4b969
7
- data.tar.gz: f985f35e4ee27b6e7a5b077d8027a4ec8334a1acfc177a52fbe7cf40c79d97f729ffa7a697d314ae070f6a137f214c13b795091dd994582a8c04921e2f0d5714
6
+ metadata.gz: 116a5da2d2c67b31f99ff1efe045b7731784cd6a7a21d175d840f12b94ad1f8f548e920dcda23184b2dcfbe01a3657f05e4f5660b260f1542edb7c0c926eddc7
7
+ data.tar.gz: 7adf7638c5788afef2d18f54f1630379d42d843497fb0013e27dfbb7883ef387922d475327b29908c26f7b55b55c47b1e9947125f3c904f42ef536de0d354d43
@@ -1,43 +1,73 @@
1
1
  <%
2
+ stimulus_controller = 'fields--date'
3
+
2
4
  form ||= current_fields_form
3
5
  options ||= {}
4
- options[:id] ||= form.field_id(method)
6
+ user_tz = ActiveSupport::TimeZone.find_tzinfo(current_user.time_zone).name
7
+ team_tz = ActiveSupport::TimeZone.find_tzinfo(current_user.current_team.time_zone).name
8
+
9
+ # data options
10
+ data_options ||= {}
11
+ data_options[:id] ||= form.field_id(method)
12
+ data_options[:class] = "hidden"
13
+ data_options[:value] = form.object.send(method)&.in_time_zone(current_time_zone)&.iso8601
14
+ data_options = data_options.merge({ data: {"#{stimulus_controller}-target": 'field' }})
15
+
16
+ # localized display options
17
+ options[:id] ||= "#{form.field_id(method)}_display"
5
18
  options[:class] = "form-control single-daterange w-full border-slate-300 dark:bg-slate-800 dark:border-slate-900 #{options[:class]}".strip
6
- options[:value] = form.object.send(method)&.in_time_zone(current_team.time_zone)&.strftime(t('global.formats.date_and_time'))
7
- options = options.merge({ data: {'fields--date-target': 'field' }})
19
+ raw_value = form.object.send(method)&.in_time_zone(current_user.time_zone || current_team.time_zone || "UTC")
20
+ options[:value] = raw_value && I18n.l(raw_value, format: :date_and_time_field)
21
+ options = options.merge({ data: {"#{stimulus_controller}-target": 'displayField' }})
22
+
8
23
  other_options ||= {}
9
24
  %>
10
25
 
11
26
  <%= render 'shared/fields/field', form: form, method: method, options: options, other_options: other_options do %>
12
27
  <% content_for :field do %>
13
- <div class="date-input relative" data-controller="fields--date" data-fields--date-include-time-value="true" data-fields--date-default-time-zones-value="<%= "[\"#{current_user.current_team.time_zone}\",\"#{current_user.time_zone}\"]" %>">
28
+ <div
29
+ class="date-input relative"
30
+ data-controller="<%=stimulus_controller%>"
31
+ data-<%= stimulus_controller %>-include-time-value="true"
32
+ data-<%= stimulus_controller %>-date-format-value="<%= I18n.t('date.formats.date_controller') %>"
33
+ data-<%= stimulus_controller %>-time-format-value="<%= I18n.t('time.formats.date_controller') %>"
34
+ data-<%= stimulus_controller %>-is-am-pm-value="<%= am_pm? %>"
35
+ data-<%= stimulus_controller %>-picker-locale-value="<%= I18n.t("daterangepicker").deep_transform_keys { |k| k.to_s.camelize(:lower) }.to_json %>"
36
+ data-<%= stimulus_controller %>-default-time-zones-value="<%= "[\"#{current_user.time_zone}\",\"#{current_user.current_team.time_zone}\"]" %>"
37
+ data-<%= stimulus_controller %>-current-time-zone-value="<%= current_time_zone %>"
38
+ >
14
39
  <%= form.text_field method, options %>
40
+ <%= form.text_field method, data_options %>
15
41
  <% unless options[:disabled] %>
16
42
  <button type="button" class="clear py-2 px-3 border border-transparent inline-flex items-center whitespace-nowrap absolute rounded-md top-1 md:top-0.5 right-0.5"
17
- data-fields--date-target="clearButton"
18
- data-action="fields--date#clearDate"
43
+ data-<%= stimulus_controller %>-target="clearButton"
44
+ data-action="<%=stimulus_controller%>#clearDate"
19
45
  >
20
46
  <i class="leading-4 text-lg ti ti-trash dark:text-blue-500"></i>
21
47
  </button>
22
48
  <% end %>
23
49
  <% if current_user.time_zone != current_user.current_team.time_zone %>
24
50
  <div class="mt-1.5 text-xs text-slate-500">
25
- <%= form.hidden_field "#{method}_time_zone".to_sym, value: current_user.current_team.time_zone, data: {'fields--date-target': 'timeZoneField'} %>
26
- <div data-fields--date-target="currentTimeZoneWrapper">
27
- <%= link_to current_user.current_team.time_zone, '#', class: 'button-secondary p-0', data: {action: 'fields--date#showTimeZoneButtons'} %>
51
+ <input class="hidden" data-<%=stimulus_controller%>-target="timeZoneField" value="<%= current_time_zone %>"></span>
52
+ <div data-<%= stimulus_controller %>-target="currentTimeZoneWrapper">
53
+ <%= link_to (current_user.time_zone || current_user.current_team.time_zone || "UTC"), '#', class: 'button-secondary p-0', data: {action: "#{stimulus_controller}#showTimeZoneButtons"} %>
28
54
  </div>
29
- <div class="space-x-1 hidden" data-fields--date-target="timeZoneButtons">
30
- <%= link_to '', '#', hidden: true, class: 'time-zone-button button-alternative button-smaller selected-option-time-zone-button hidden', data: {action: 'fields--date#setTimeZone', value: ''} %>
31
- <%= link_to current_user.current_team.time_zone, '#', class: 'time-zone-button button button-smaller', data: {action: 'fields--date#setTimeZone', value: current_user.current_team.time_zone} %>
32
- <%= link_to current_user.time_zone, '#', class: 'time-zone-button button-alternative button-smaller', data: {action: 'fields--date#setTimeZone', value: current_user.time_zone} %>
33
- <%= link_to t('global.buttons.other'), '#', class: 'button-alternative button-smaller', data: {action: 'fields--date#showTimeZoneSelectWrapper'} %>
34
- <%= link_to t('global.buttons.cancel'), '#', class: 'button-secondary button-smaller', data: {action: 'fields--date#resetTimeZoneUI'} %>
55
+ <div class="space-x-1 hidden" data-<%= stimulus_controller %>-target="timeZoneButtons">
56
+ <%= link_to '', '#', hidden: true, class: 'time-zone-button button-alternative button-smaller selected-option-time-zone-button hidden', data: {action: "#{stimulus_controller}#setTimeZone", value: ''} %>
57
+ <%= link_to current_user.current_team.time_zone, '#', class: 'time-zone-button button-alternative button-smaller', data: {action: "#{stimulus_controller}#setTimeZone", value: team_tz, label: current_user.current_team.time_zone } %>
58
+ <%= link_to current_user.time_zone, '#', class: 'time-zone-button button button-smaller', data: {action: "#{stimulus_controller}#setTimeZone", value: user_tz, label: current_user.time_zone } %>
59
+ <%= link_to t('global.buttons.other'), '#', class: 'button-alternative button-smaller', data: {action: "#{stimulus_controller}#showTimeZoneSelectWrapper"} %>
60
+ <%= link_to t('global.buttons.cancel'), '#', class: 'button-secondary button-smaller', data: {action: "#{stimulus_controller}#resetTimeZoneUI"} %>
35
61
  </div>
36
- <div class="hidden flex flex-row items-center mt-3 text-sm" data-fields--date-target="timeZoneSelectWrapper">
62
+ <div class="hidden flex flex-row items-center mt-3 text-sm" data-<%= stimulus_controller %>-target="timeZoneSelectWrapper">
37
63
  <div class="flex-grow">
38
- <%= select_tag :time_zone, options_from_collection_for_select(ActiveSupport::TimeZone.all, "name", "to_s", current_user.current_team.time_zone), {class: 'form-control select2'} %>
64
+ <%= select_tag :time_zone,
65
+ options_for_select(ActiveSupport::TimeZone.all.map{|tz| [tz.name.to_s, tz.tzinfo.name.to_s]}, [ user_tz || team_tz ]),
66
+ class: 'form-control select2',
67
+ data: { "#{stimulus_controller}-target": "timeZoneSelect", action: "#{stimulus_controller}#selectTimeZoneChange"}
68
+ %>
39
69
  </div>
40
- <%= link_to t('global.buttons.cancel'), '#', class: 'button-secondary ml-1.5', data: {action: 'fields--date#resetTimeZoneUI'} %>
70
+ <%= link_to t('global.buttons.cancel'), '#', class: 'button-secondary ml-1.5', data: {action: "#{stimulus_controller}#cancelSelect"} %>
41
71
  </div>
42
72
  </div>
43
73
  <% end %>
@@ -3,18 +3,36 @@ stimulus_controller = 'fields--date'
3
3
 
4
4
  form ||= current_fields_form
5
5
  options ||= {}
6
- options[:id] ||= form.field_id(method)
6
+
7
+ # data options
8
+ data_options ||= {}
9
+ data_options[:id] ||= form.field_id(method)
10
+ data_options[:class] = "hidden"
11
+ data_options[:value] = form.object.send(method)&.strftime("%Y-%m-%d")
12
+ data_options = data_options.merge({ data: {"#{stimulus_controller}-target": 'field' }})
13
+
14
+ # localized display options
15
+ options[:id] ||= "#{form.field_id(method)}_display"
7
16
  options[:class] = "form-control single-daterange w-full border-slate-300 dark:bg-slate-800 dark:border-slate-900 #{options[:class]}".strip
8
- options[:value] = form.object.send(method)&.strftime(t('global.formats.date'))
9
- options = options.merge({ data: {"#{stimulus_controller}-target": 'field' }})
17
+ options[:value] = form.object.send(method) && I18n.l(form.object.send(method), format: :date_field)
18
+ options = options.merge({ data: {"#{stimulus_controller}-target": 'displayField' }})
19
+
10
20
  other_options ||= {}
11
21
 
12
22
  %>
13
-
14
23
  <%= render 'shared/fields/field', form: form, method: method, options: options, other_options: other_options do %>
15
24
  <% content_for :field do %>
16
- <div class="date-input relative" data-controller="<%= stimulus_controller %>">
25
+ <div
26
+ class="date-input relative"
27
+ data-controller="<%= stimulus_controller %>"
28
+ data-<%= stimulus_controller %>-date-format-value="<%= I18n.t('date.formats.date_controller') %>"
29
+ data-<%= stimulus_controller %>-time-format-value="<%= I18n.t('time.formats.date_controller') %>"
30
+ data-<%= stimulus_controller %>-is-am-pm-value="<%= am_pm? %>"
31
+ data-<%= stimulus_controller %>-picker-locale-value="<%= I18n.t("daterangepicker").deep_transform_keys { |k| k.to_s.camelize(:lower) }.to_json %>"
32
+ data-<%= stimulus_controller %>-current-time-zone-value="<%= current_time_zone %>"
33
+ >
17
34
  <%= form.text_field method, options %>
35
+ <%= form.text_field method, data_options %>
18
36
  <% unless options[:disabled] %>
19
37
  <button type="button" class="clear py-2 px-3 border border-transparent inline-flex items-center whitespace-nowrap absolute rounded-md top-1 md:top-0.5 right-0.5"
20
38
  data-<%= stimulus_controller %>-target="clearButton"
@@ -1,7 +1,7 @@
1
1
  module BulletTrain
2
2
  module Themes
3
3
  module TailwindCss
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-themes-tailwind_css
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-11 00:00:00.000000000 Z
11
+ date: 2023-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -104,7 +104,7 @@ licenses:
104
104
  metadata:
105
105
  homepage_uri: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-themes-tailwind_css
106
106
  source_code_uri: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-themes-tailwind_css
107
- post_install_message:
107
+ post_install_message:
108
108
  rdoc_options: []
109
109
  require_paths:
110
110
  - lib
@@ -119,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.3.7
123
- signing_key:
122
+ rubygems_version: 3.4.10
123
+ signing_key:
124
124
  specification_version: 4
125
125
  summary: Bullet Train Themes Tailwind CSS Base
126
126
  test_files: []