keystone_ui 0.68.0 → 0.69.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3adbe1de494b0337aa1e5334b0511552b7f7e1540c7ce124983c869a664a93e
4
- data.tar.gz: 213811db56e2a2d88ffbe08a318fc1def8a6742f603c3ad2139a18a3e611594c
3
+ metadata.gz: 242ba3582b1b737bc9ed499a24fb27d75a7c8df5dd59f341d603ba2a9d99dea3
4
+ data.tar.gz: 020b9c44d78a728488c8033ad8b602df920707c910bc77c60496722a30802e80
5
5
  SHA512:
6
- metadata.gz: 959c1ba6f2c0cf5687f05607010d5224378aa7a2c6109670783a61d245b21711614f2c812d432de6e380a134fb9a21cdbe93c14c8d051da726e7284485f8a577
7
- data.tar.gz: 60ad1964614d17a15c267512d1404ff9245fb897ba35d66d128b5c04b33a9f7757eceb527a02066b4537fdcb52192b36c673309cebcb18db1676a7017df3dce9
6
+ metadata.gz: e760beb28f6a1cc0fe374e0b61c248f3451948315dfa85fa96e6cfb39003b8bc8688a4a1cde74a1d11e51189cc88711ca9c8b067dc96c4d22c4085f1f4e70341
7
+ data.tar.gz: 5a7ed82c290d4e3e93756c7bf0ce6cf44c7d4b04abb6c36692f057df249e36b0a28b885c7e4a42f21f59865096279d7082effdc84cb8f77e8aa078c54afc26e5
@@ -16,7 +16,19 @@ module Keystone
16
16
  end
17
17
 
18
18
  def call
19
- link_to(PLUS_ICON.html_safe, content_for(:mobile_action_url), class: LINK_CLASSES, aria: { label: content_for(:mobile_action_label) })
19
+ return link_to(PLUS_ICON.html_safe, url, **options) unless content_for?(:mobile_action_method)
20
+
21
+ button_to(url, method: content_for(:mobile_action_method), **options) { PLUS_ICON.html_safe }
22
+ end
23
+
24
+ private
25
+
26
+ def url
27
+ content_for(:mobile_action_url)
28
+ end
29
+
30
+ def options
31
+ { class: LINK_CLASSES, aria: { label: content_for(:mobile_action_label) } }
20
32
  end
21
33
  end
22
34
  end
@@ -2,6 +2,7 @@
2
2
  <% if action_url %>
3
3
  <% content_for :mobile_action_url, action_url %>
4
4
  <% content_for :mobile_action_label, action_label %>
5
+ <% content_for :mobile_action_method, action_method.to_s if action_method %>
5
6
  <% end %>
6
7
  <div class="<%= wrapper_classes %>">
7
8
  <div>
@@ -16,7 +17,7 @@
16
17
  </div>
17
18
  <% elsif action_url %>
18
19
  <div class="<%= ACTIONS_CLASSES %>">
19
- <%= render Keystone::Ui::ButtonComponent.new(label: action_label, href: action_url) %>
20
+ <%= render Keystone::Ui::ButtonComponent.new(label: action_label, href: action_url, method: action_method || :get) %>
20
21
  </div>
21
22
  <% end %>
22
23
  </div>
@@ -8,13 +8,14 @@ module Keystone
8
8
  SUBTITLE_CLASSES = "ks-page-header-subtitle"
9
9
  ACTIONS_CLASSES = "page-header-actions ks-page-header-actions"
10
10
 
11
- attr_reader :title, :action_url, :action_label
11
+ attr_reader :title, :action_url, :action_label, :action_method
12
12
 
13
- def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", class: nil)
13
+ def initialize(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, class: nil)
14
14
  @title = title
15
15
  @subtitle = subtitle
16
16
  @action_url = action_url
17
17
  @action_label = action_label
18
+ @action_method = action_method
18
19
  @action_block = nil
19
20
  @extra_classes = binding.local_variable_get(:class)
20
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.68.0"
4
+ VERSION = "0.69.0"
5
5
  end
@@ -168,13 +168,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
168
168
  - Ask the developer whether a screen shows breadcrumbs and which parent
169
169
  screens its trail names. Ask which screens a navigation tab opens
170
170
  directly, since those pass `trail: []`.
171
- - `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", class: nil)`
171
+ - `ui_page_header(title:, subtitle: nil, action_url: nil, action_label: "Add new", action_method: nil, class: nil)`
172
172
  takes a block yielding the header and is hidden below `sm:`. Call
173
173
  `header.action { ... }` in the block to place a control on its right.
174
174
  `action_url:` declares the screen's main action. It publishes that URL and
175
175
  label for `ui_mobile_action` to pick up, and with no `action` block the
176
176
  header draws them as a button. An `action` block is drawn alone when both
177
- are given.
177
+ are given. `action_method:`, such as `:post`, makes the main action send
178
+ that method: the header's button and `ui_mobile_action`'s icon become
179
+ forms posting to `action_url:`.
178
180
  - `ui_breadcrumbs(trail:, current: nil)` renders `trail:` as links separated
179
181
  by `›`, then `current:` unlinked and marked as the current page, shown
180
182
  only from `lg:` up. On a form or detail screen pass `trail:` to the shell
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.68.0
4
+ version: 0.69.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider