glib-web 4.35.5 → 4.36.1

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: bd64c82e1baa6874b8791fdc0a330916a9463e92145a5e7c8ac3a6b64ef271dd
4
- data.tar.gz: 85ea472517490fd0d2fc572531869964240111df12d2e93b9fc35a569ece071d
3
+ metadata.gz: e4fa3a5bc80fc1354db7030f213da3db807b948797c729500015f8f1d9e11ba1
4
+ data.tar.gz: b9174c228c32924fdbc7ecb87214bfce37d4c63ce0a5d3b905be0e4ac0c2143f
5
5
  SHA512:
6
- metadata.gz: 4cfd05eee3620fc4177e75f7e5f43904e1560084979aad3bc522beb837afc45e86b47f766feb2ada4b69d4f20a14b236907f04e4072968316d7b2b99100fdebe
7
- data.tar.gz: 1afe10ae33a3688b85be1cd1f966ff8bd01d60eaca51fb3602d4d1c8d52b6276701371f455758d488248c1ea344c8e019e6c2b61878dcd5ea88be52725c15dd2
6
+ metadata.gz: 9609485c6c0339b27600efbfd1fbea22f8b676c16b792c69cdb2a1c6a44f75ad3d2632d9868ed142bdfef70dd8fc22b876c1946c4d5de208d0a4d4ee0225d595
7
+ data.tar.gz: e2e758483ccba38788bd0e06139aef0ad4acd2c0c9a71d85cd017aa92ac1320abb51b45613d46480a798f31e851da480b2e8f93929d0ee6c8b3f2ad6540c0fc9
@@ -162,6 +162,9 @@ module Glib
162
162
  # hash :actionCable
163
163
  # string :format
164
164
  action :onClick
165
+
166
+ # Whether the label is focusable using the Tab key.
167
+ bool :disableKeyboardFocus
165
168
  end
166
169
 
167
170
  class Image < View
@@ -0,0 +1,22 @@
1
+ class MutuallyExclusiveWithValidator < ActiveModel::EachValidator
2
+ include ActiveSupport::Inflector
3
+
4
+ def validate_each(record, attribute, _value)
5
+ other_attribute = options[:with]
6
+
7
+ validate_mutual_exclusivity(record, attribute, other_attribute)
8
+ validate_mutual_exclusivity(record, other_attribute, attribute)
9
+ end
10
+
11
+ private
12
+ def validate_mutual_exclusivity(record, attribute, other_attribute)
13
+ attribute_value = record.send(attribute)
14
+ other_attribute_value = record.send(other_attribute)
15
+
16
+ if attribute_value.present? && other_attribute_value.present?
17
+ record.errors.add(attribute, :present, **options)
18
+ elsif attribute_value.nil? && other_attribute_value.nil?
19
+ record.errors.add(attribute, :blank, **options)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ class PresenceOnlyIfValidator < ActiveModel::EachValidator
2
+ include ActiveSupport::Inflector
3
+
4
+ def validate_each(record, attribute, _value)
5
+ condition = options[:with]
6
+
7
+ if condition.is_a?(Symbol)
8
+ evaluate_condition(record, attribute, ->(record) { record.send(condition) })
9
+ elsif condition.respond_to?(:call)
10
+ evaluate_condition(record, attribute, condition)
11
+ else
12
+ raise 'Invalid option'
13
+ end
14
+ end
15
+
16
+ private
17
+ def evaluate_condition(record, attribute, condition)
18
+ if condition.call(record) && record.send(attribute).nil?
19
+ record.errors.add(attribute, :blank, **options)
20
+ end
21
+ end
22
+ end
@@ -13,7 +13,54 @@ section.rows builder: ->(row) do
13
13
  if local_assigns[:reorder]
14
14
  row.thumbnail title: "Item #{index}"
15
15
  else
16
- row.thumbnail title: "Item #{index}", subtitle: "Sub Item #{index}", subsubtitle: "Sub Sub Item #{index}"
16
+ row.thumbnail \
17
+ title: "Item #{index}",
18
+ subtitle: "Sub Item #{index}",
19
+ subsubtitle: "Sub Sub Item #{index}"
20
+ # onClick: ->(action) do
21
+ # action.windows_openWeb url: 'https://www.google.com'
22
+ # end,
23
+ # content: ->(content) do
24
+ # content.footer \
25
+ # childViews: ->(footer) do
26
+ # footer.panels_horizontal \
27
+ # padding: { x: 10, y: 5 },
28
+ # childViews: ->(horizontal) do
29
+ # horizontal.label \
30
+ # text: 'View',
31
+ # onClick: ->(action) do
32
+ # # TODO: For some reason this causes the auto-scrolling issue
33
+ # # action.windows_openWeb url: frontend_place_url(place)
34
+
35
+ # # action.windows_openWeb url: frontend_place_url(place)
36
+ # end
37
+
38
+ # horizontal.spacer styleClass: 'width-sm'
39
+
40
+ # horizontal.label \
41
+ # text: symbol_horizontal_separator,
42
+ # styleClasses: ['text-muted']
43
+
44
+ # horizontal.spacer styleClass: 'width-sm'
45
+
46
+ # horizontal.label \
47
+ # text: 'Delete',
48
+ # onClick: ->(action) do
49
+ # action.windows_openWeb url: 'https://www.google.com'
50
+ # # action.windows_openWeb url: frontend_place_url(place)
51
+
52
+ # # render \
53
+ # # 'shared/confirmation_sheet',
54
+ # # panel: action,
55
+ # # message: 'Are you sure you want to delete this favorite?',
56
+ # # confirmation_text: 'Yes, delete the favorite',
57
+ # # confirmation_action: ->(subsubaction) do
58
+ # # subsubaction.http_delete url: favorite_list_favorite_url(@favorite_list, favorite)
59
+ # # end
60
+ # end
61
+ # end
62
+ # end
63
+ # end
17
64
  end
18
65
  end
19
66
  end
@@ -13,6 +13,16 @@ end
13
13
 
14
14
  page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
15
15
  (1..100).each do |index|
16
- scroll.label text: 'Content'
16
+ scroll.panels_vertical \
17
+ width: 'matchParent',
18
+ backgroundColor: '#b3bac2',
19
+ height: 'matchParent',
20
+ childViews: ->(panels) do
21
+ panels.label text: 'Content'
22
+ panels.spacer height: 4
23
+ panels.label text: 'view', onClick: ->(action) do
24
+ action.windows_openWeb url: 'https://www.google.com'
25
+ end
26
+ end
17
27
  end
18
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.35.5
4
+ version: 4.36.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -217,6 +217,8 @@ files:
217
217
  - app/policies/glib/application_policy.rb
218
218
  - app/validators/email_typo_validator.rb
219
219
  - app/validators/email_validator.rb
220
+ - app/validators/mutually_exclusive_with_validator.rb
221
+ - app/validators/presence_only_if_validator.rb
220
222
  - app/validators/url_validator.rb
221
223
  - app/views/json_ui/garage/_nav_menu.json.jbuilder
222
224
  - app/views/json_ui/garage/actions/_commands.json.jbuilder