bullet_train-themes 1.2.27 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/themes/base/attributes/_belongs_to.html.erb +3 -3
  3. data/app/views/themes/base/attributes/_block.html.erb +2 -2
  4. data/app/views/themes/base/attributes/_boolean.html.erb +1 -1
  5. data/app/views/themes/base/attributes/_code.html.erb +1 -1
  6. data/app/views/themes/base/attributes/_date.html.erb +2 -2
  7. data/app/views/themes/base/attributes/_date_and_time.html.erb +2 -2
  8. data/app/views/themes/base/attributes/_days_ago.html.erb +2 -2
  9. data/app/views/themes/base/attributes/_email.html.erb +2 -2
  10. data/app/views/themes/base/attributes/_has_many.html.erb +2 -2
  11. data/app/views/themes/base/attributes/_html.html.erb +8 -3
  12. data/app/views/themes/base/attributes/_image.html.erb +1 -1
  13. data/app/views/themes/base/attributes/_number.html.erb +7 -2
  14. data/app/views/themes/base/attributes/_option.html.erb +2 -2
  15. data/app/views/themes/base/attributes/_options.html.erb +2 -2
  16. data/app/views/themes/base/attributes/_phone_number.html.erb +2 -2
  17. data/app/views/themes/base/attributes/_text.html.erb +2 -2
  18. data/app/views/themes/base/fields/_ckeditor.html.erb +0 -2
  19. data/app/views/themes/base/fields/_email_field.html.erb +0 -2
  20. data/app/views/themes/base/fields/_emoji_field.html.erb +1 -3
  21. data/app/views/themes/base/fields/_number_field.html.erb +0 -2
  22. data/app/views/themes/base/fields/_password_field.html.erb +3 -5
  23. data/app/views/themes/base/fields/_phone_field.html.erb +0 -2
  24. data/app/views/themes/base/fields/_super_select.html.erb +2 -2
  25. data/app/views/themes/base/fields/_text_area.html.erb +0 -2
  26. data/app/views/themes/base/fields/_text_field.html.erb +0 -2
  27. data/config/locales/en/fields.en.yml +3 -0
  28. data/lib/bullet_train/themes/version.rb +1 -1
  29. data/lib/bullet_train/themes.rb +0 -1
  30. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bf2706c89639b26c56d8fcd2f3a72159258d42210f703bec648889d5aa6f1af
4
- data.tar.gz: 5612b93198d71c0df48486ba01d7a3b5a7592137a2a071262d768e4c4684a44d
3
+ metadata.gz: 8dd0a191651334aa62d766d42e872a70b47bf0003a82500925e9e5e68a57aaad
4
+ data.tar.gz: 5091e0954cbce846b121f1b4396d505b98b838813167f1ce96346db0fa5257e9
5
5
  SHA512:
6
- metadata.gz: 43c3a328caefc7a6eac35ea46eefc689b3f16ed8b1a2fc21017b420e8190f52db63ad480b37433723c27d64bf15b7be4f815d5b189366cb2907a4e27357609ea
7
- data.tar.gz: 2757e3d2c1f4928ad3f3056a53612e0cd04a97494147cc32fccf7575abb93a251c9cef411f344599a989a63016e19c24f321b6bc6e8ed05deabc819b2b642539
6
+ metadata.gz: 16f4a6f09b6d9d674f829082a4a250a1c1a8905c1638aeba68ace53cec78db9e985c697670be74c889e7112b89949cf9980acb6764c98a4c51dc5511fbd6acba
7
+ data.tar.gz: aaa27a63708ec55dc3fbe5c30f82c9f6cbd622ee80609d37510dbdf40da61db0aa63cc2a0500ffd9bdf1fc9017efedc486ac03a96019355170d7f55cfddf4f2b
@@ -3,12 +3,12 @@
3
3
  <% disable_link ||= false %>
4
4
  <% url ||= nil %>
5
5
 
6
- <% if object.send(attribute).present? %>
6
+ <% if object.public_send(attribute).present? %>
7
7
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
8
8
  <% if disable_link %>
9
- <%= object.send(attribute).label_string %>
9
+ <%= object.public_send(attribute).label_string %>
10
10
  <% else %>
11
- <%= link_to object.send(attribute).label_string, url || [:account, object.send(attribute)] %>
11
+ <%= link_to object.public_send(attribute).label_string, url || [:account, object.public_send(attribute)] %>
12
12
  <% end %>
13
13
  <% end %>
14
14
  <% end %>
@@ -2,8 +2,8 @@
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
4
 
5
- <% if object.send(attribute).present? %>
5
+ <% if object.public_send(attribute).present? %>
6
6
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
7
- <pre><%= object.send(attribute) %></pre>
7
+ <pre><%= object.public_send(attribute) %></pre>
8
8
  <% end %>
9
9
  <% end %>
@@ -4,6 +4,6 @@
4
4
 
5
5
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
6
6
  <% unless object[attribute].nil? %>
7
- <%= t("#{object.class.name.underscore.pluralize}.fields.#{attribute}.options.#{object.send(attribute)}") %>
7
+ <%= t("#{object.class.name.underscore.pluralize}.fields.#{attribute}.options.#{object.public_send(attribute)}") %>
8
8
  <% end %>
9
9
  <% end %>
@@ -3,7 +3,7 @@
3
3
  <% source ||= nil %>
4
4
  <% url ||= nil %>
5
5
 
6
- <% if object.send(attribute).present? %>
6
+ <% if object.public_send(attribute).present? %>
7
7
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
8
8
  <code class="text-pink-600 font-light"><%= object.send(source || attribute) %></code>
9
9
  <% end %>
@@ -3,9 +3,9 @@
3
3
  <% url ||= nil %>
4
4
  <% default_message = local_assigns[:default_message] || t('global.formats.timestamp_unavailable') %>
5
5
 
6
- <% if object.send(attribute).present? %>
6
+ <% if object.public_send(attribute).present? %>
7
7
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
8
- <%= display_date(object.send(attribute), local_assigns[:date_format]) %>
8
+ <%= display_date(object.public_send(attribute), **local_assigns.slice(:format), **local_assigns.slice(:date_format)) %>
9
9
  <% end %>
10
10
  <% else %>
11
11
  <%= default_message %>
@@ -3,9 +3,9 @@
3
3
  <% url ||= nil %>
4
4
  <% default_message = local_assigns[:default_message] || t('global.formats.timestamp_unavailable') %>
5
5
 
6
- <% if object.send(attribute).present? %>
6
+ <% if object.public_send(attribute).present? %>
7
7
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
8
- <%= display_date_and_time(object.send(attribute), local_assigns[:date_format], local_assigns[:time_format]) %>
8
+ <%= display_date_and_time(object.public_send(attribute), **local_assigns.slice(:format), **local_assigns.slice(:date_format), **local_assigns.slice(:time_format)) %>
9
9
  <% end %>
10
10
  <% else %>
11
11
  <%= default_message %>
@@ -4,8 +4,8 @@
4
4
 
5
5
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
6
6
  <% if object.send(attribute) %>
7
- <%= time_ago_in_words(object.send(attribute)) %> ago
7
+ <%= t("global.time_ago", time: time_ago_in_words(object.send(attribute))) %>
8
8
  <% else %>
9
- Never
9
+ <%= t("global.never") %>
10
10
  <% end %>
11
11
  <% end %>
@@ -2,8 +2,8 @@
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
4
 
5
- <% if object.send(attribute).present? %>
5
+ <% if object.public_send(attribute).present? %>
6
6
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
7
- <%= link_to object.send(attribute), "mailto:#{object.send(attribute)}" %>
7
+ <%= link_to object.public_send(attribute), "mailto:#{object.public_send(attribute)}" %>
8
8
  <% end %>
9
9
  <% end %>
@@ -4,9 +4,9 @@
4
4
  <% disable_links ||= false %>
5
5
  <% link_options ||= {} %>
6
6
 
7
- <% if object.send(attribute).any? %>
7
+ <% if object.public_send(attribute).any? %>
8
8
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy do %>
9
- <%= object.send(attribute).map do |child_object| %>
9
+ <%= object.public_send(attribute).map do |child_object| %>
10
10
  <% capture do %>
11
11
  <% if disable_links %>
12
12
  <%= child_object.label_string %>
@@ -2,9 +2,14 @@
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
4
 
5
- <% if object.send(attribute).present? %>
5
+ <% if object.public_send(attribute).present? %>
6
6
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
7
- <% # `.to_s` is for action text. %>
8
- <%= html_sanitize(object.send(attribute).to_s).html_safe %>
7
+ <% # Here we manually add a trix-content class since sanitizing the body removes the Rails default. %>
8
+ <% if object.send(attribute).is_a?(ActionText::RichText) %>
9
+ <%= tag.div(html_sanitize(object.public_send(attribute).body.to_trix_html).html_safe, class:"trix-content") %>
10
+ <% else %>
11
+ <% # `.to_s` is for action text. %>
12
+ <%= html_sanitize(object.public_send(attribute).to_s).html_safe %>
13
+ <% end %>
9
14
  <% end %>
10
15
  <% end %>
@@ -4,4 +4,4 @@
4
4
  <% options ||= {} %>
5
5
  <% options[:height] ||= 200 %>
6
6
 
7
- <%= cloudinary_image_tag object.send(attribute), options %>
7
+ <%= cloudinary_image_tag object.public_send(attribute), options %>
@@ -1,10 +1,15 @@
1
1
  <% object ||= current_attributes_object %>
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
+ <% format ||= nil %>
4
5
  <% options ||= {} %>
5
6
 
6
- <% if object.send(attribute).present? %>
7
+ <% if object.public_send(attribute).present? %>
7
8
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy do %>
8
- <%= object.send(attribute) %>
9
+ <% if format %>
10
+ <%= sprintf(format, object.public_send(attribute)) %>
11
+ <% else %>
12
+ <%= object.public_send(attribute) %>
13
+ <% end %>
9
14
  <% end %>
10
15
  <% end %>
@@ -2,8 +2,8 @@
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
4
 
5
- <% if object.send(attribute).present? %>
5
+ <% if object.public_send(attribute).present? %>
6
6
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
7
- <%= t("#{object.class.name.underscore.pluralize}.fields.#{attribute}.options.#{object.send(attribute)}") %>
7
+ <%= t("#{object.class.name.underscore.pluralize}.fields.#{attribute}.options.#{object.public_send(attribute)}") %>
8
8
  <% end %>
9
9
  <% end %>
@@ -2,10 +2,10 @@
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
4
 
5
- <% if object.send(attribute).any? %>
5
+ <% if object.public_send(attribute).any? %>
6
6
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
7
7
  <%# TODO: Multiple option partials return arrays with blank characters in them. Is this expected? %>
8
- <%= object.send(attribute).reject(&:blank?).map do |value| %>
8
+ <%= object.public_send(attribute).reject(&:blank?).map do |value| %>
9
9
  <% t("#{object.class.name.underscore.pluralize}.fields.#{attribute}.options.#{value}") %>
10
10
  <% end.map(&:strip).to_sentence %>
11
11
  <% end %>
@@ -2,8 +2,8 @@
2
2
  <% strategy ||= current_attributes_strategy || :none %>
3
3
  <% url ||= nil %>
4
4
 
5
- <% if object.send(attribute).present? %>
5
+ <% if object.public_send(attribute).present? %>
6
6
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
7
- <%= display_phone_number(object.send(attribute)) %>
7
+ <%= display_phone_number(object.public_send(attribute)) %>
8
8
  <% end %>
9
9
  <% end %>
@@ -3,8 +3,8 @@
3
3
  <% url ||= nil %>
4
4
  <% options ||= {} %>
5
5
 
6
- <% if object.send(attribute).present? %>
6
+ <% if object.public_send(attribute).present? %>
7
7
  <%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %>
8
- <%= options[:password] ? "●" * object.send(attribute).length : object.send(attribute) %>
8
+ <%= options[:password] ? "●" * object.public_send(attribute).length : object.public_send(attribute) %>
9
9
  <% end %>
10
10
  <% end %>
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  # ⚠️ CKEditor 5 is distributed under a GPL 2+ copyleft license.
5
3
  # You need a commercial license to utilize it in closed-source SaaS products.
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  form ||= current_fields_form
5
3
  options ||= {}
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  stimulus_controller = 'fields--emoji-picker'
5
3
 
@@ -21,7 +19,7 @@ value = form.object.send(method)
21
19
  <% end %>
22
20
  </span>
23
21
  &nbsp;
24
- Choose an Emoji
22
+ <%= t('fields.choose_emoji') %>
25
23
  <% end %>
26
24
  <%= form.hidden_field method, data: {"#{stimulus_controller}-target": "input"} %>
27
25
  </div>
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  form ||= current_fields_form
5
3
  options ||= {}
@@ -1,12 +1,10 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  stimulus_controller = 'fields--password'
5
3
 
6
4
  form ||= current_fields_form
7
5
  options ||= {}
8
6
 
9
- if options[:show_strength_indicator]
7
+ if options[:show_strength_indicator] && BulletTrain::Configuration.strong_passwords
10
8
  options = options.merge({ data: {"action": "keyup->fields--password#estimateStrength" }})
11
9
  end
12
10
 
@@ -17,6 +15,6 @@ other_options ||= {}
17
15
  <%= render 'shared/fields/field', form: form, method: method, helper: :password_field, options: options, other_options: other_options %>
18
16
  <% if options[:show_strength_indicator] %>
19
17
  <% # TODO This is the wrong place to define this kind of style, but I couldn't make this work in the `:help` content buffer. %>
20
- <div data-<%= stimulus_controller %>-target="strengthIndicator" class="hidden mt-1.5 text-xs text-red-600"></div>
18
+ <div data-<%= stimulus_controller %>-target="strengthIndicator" class="hidden mt-1.5 text-xs text-red-500"></div>
21
19
  <% end %>
22
- </div>
20
+ </div>
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  stimulus_controller = 'fields--phone'
5
3
 
@@ -1,11 +1,10 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  stimulus_controller = 'fields--super-select'
5
3
 
6
4
  form ||= current_fields_form
7
5
  options ||= {}
8
6
  other_options ||= {}
7
+ select2_options ||= nil
9
8
  html_options ||= {}
10
9
  html_options[:id] ||= form.field_id(method)
11
10
  html_options[:class] = "form-control select2 #{html_options[:class]}".strip
@@ -26,6 +25,7 @@ wrapper_options = { data: { controller: stimulus_controller }}
26
25
  wrapper_options[:data]["#{stimulus_controller}-enable-search-value"] = true if other_options[:search]
27
26
  wrapper_options[:data]["#{stimulus_controller}-accepts-new-value"] = true if other_options[:accepts_new]
28
27
  wrapper_options[:data]["#{stimulus_controller}-search-url-value"] = choices_url if choices_url.present?
28
+ wrapper_options[:data]["#{stimulus_controller}-select2-options-value"] = select2_options.to_json if select2_options.present?
29
29
 
30
30
  unless options[:multiple]
31
31
  wrapper_options[:data]["action"] ||= ""
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  form ||= current_fields_form
5
3
  options ||= {}
@@ -1,5 +1,3 @@
1
- <% yield %>
2
-
3
1
  <%
4
2
  form ||= current_fields_form
5
3
  options ||= {}
@@ -0,0 +1,3 @@
1
+ en:
2
+ fields:
3
+ choose_emoji: Choose an Emoji
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Themes
3
- VERSION = "1.2.27"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -9,7 +9,6 @@ module BulletTrain
9
9
 
10
10
  mattr_reader :partial_paths, default: {}
11
11
 
12
- # TODO Do we want this to be configurable by downstream applications?
13
12
  INVOCATION_PATTERNS = [
14
13
  # ❌ This path is included for legacy purposes, but you shouldn't reference partials like this in new code.
15
14
  /^account\/shared\//,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-themes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.27
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-27 00:00:00.000000000 Z
11
+ date: 2023-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -78,18 +78,19 @@ files:
78
78
  - app/views/themes/base/fields/_text_area.html.erb
79
79
  - app/views/themes/base/fields/_text_field.html.erb
80
80
  - app/views/themes/base/fields/_trix_editor.html.erb
81
+ - config/locales/en/fields.en.yml
81
82
  - config/routes.rb
82
83
  - lib/bullet_train/themes.rb
83
84
  - lib/bullet_train/themes/engine.rb
84
85
  - lib/bullet_train/themes/version.rb
85
86
  - lib/tasks/application.rb
86
87
  - lib/tasks/bullet_train/themes_tasks.rake
87
- homepage: https://github.com/bullet-train-co/bullet_train-themes
88
+ homepage: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-themes
88
89
  licenses:
89
90
  - MIT
90
91
  metadata:
91
- homepage_uri: https://github.com/bullet-train-co/bullet_train-themes
92
- source_code_uri: https://github.com/bullet-train-co/bullet_train-themes
92
+ homepage_uri: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-themes
93
+ source_code_uri: https://github.com/bullet-train-co/bullet_train-core/tree/main/bullet_train-themes
93
94
  post_install_message:
94
95
  rdoc_options: []
95
96
  require_paths:
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  - !ruby/object:Gem::Version
106
107
  version: '0'
107
108
  requirements: []
108
- rubygems_version: 3.4.10
109
+ rubygems_version: 3.3.7
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: Bullet Train Themes