tramway 2.2.3.1 → 2.2.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8fdcc19f72d21a32a847cbe65521d96122451e79661d56a04b91b9e24834684c
|
|
4
|
+
data.tar.gz: 0e24422cc70884ec8b30be9dbd1ab874d0696e0e332908032bd128318df1c0bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5baf5d3877644edc9bb9671aaf4c9fc70579a126f6dabe15af50eb7c0dbb324d17dc9bb08370b389d42190cd79952879ca36495caa9940cdb8ebd8681826d99d
|
|
7
|
+
data.tar.gz: b5e7db58d85f0cb419cab1c249d8478b1faed9698e0b7d34c395486976abf8ef6dcd4cd81a3ce33cbbbbe8461c029c788324751234c473d7ab2d9f0bb9fb5447
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
- if text.present?
|
|
2
|
-
-
|
|
3
|
-
- when :a
|
|
4
|
-
= link_to text, path, class: classes, **render_options
|
|
5
|
-
- when :button
|
|
6
|
-
%button{ class: classes, **render_options }
|
|
7
|
-
= text
|
|
8
|
-
- when :form
|
|
2
|
+
- if stop_cell_propagation?
|
|
9
3
|
= helpers.button_to text, path, method:, form: form_options, class: classes, **render_options
|
|
4
|
+
- else
|
|
5
|
+
- case @tag
|
|
6
|
+
- when :a
|
|
7
|
+
= link_to text, path, class: classes, **render_options
|
|
8
|
+
- when :button
|
|
9
|
+
%button{ class: classes, **render_options }
|
|
10
|
+
= text
|
|
11
|
+
- when :form
|
|
12
|
+
= helpers.button_to text, path, method:, form: form_options, class: classes, **render_options
|
|
10
13
|
- else
|
|
11
|
-
-
|
|
12
|
-
- when :a
|
|
13
|
-
= link_to path, class: classes, **render_options do
|
|
14
|
-
= content
|
|
15
|
-
- when :button
|
|
16
|
-
%button{ class: classes, **render_options }
|
|
17
|
-
= content
|
|
18
|
-
- when :form
|
|
14
|
+
- if stop_cell_propagation?
|
|
19
15
|
= helpers.button_to path, method:, class: classes, form: form_options, **render_options do
|
|
20
16
|
= content
|
|
17
|
+
- else
|
|
18
|
+
- case @tag
|
|
19
|
+
- when :a
|
|
20
|
+
= link_to path, class: classes, **render_options do
|
|
21
|
+
= content
|
|
22
|
+
- when :button
|
|
23
|
+
%button{ class: classes, **render_options }
|
|
24
|
+
= content
|
|
25
|
+
- when :form
|
|
26
|
+
= helpers.button_to path, method:, class: classes, form: form_options, **render_options do
|
|
27
|
+
= content
|
|
@@ -10,19 +10,20 @@ module Tailwinds
|
|
|
10
10
|
option :type, optional: true
|
|
11
11
|
option :size, default: -> { :medium }
|
|
12
12
|
option :method, optional: true, default: -> { :get }
|
|
13
|
-
option :tag, optional: true, default: -> {
|
|
13
|
+
option :tag, optional: true, default: -> {}
|
|
14
14
|
option :options, optional: true, default: -> { {} }
|
|
15
15
|
option :form_options, optional: true, default: -> { {} }
|
|
16
16
|
|
|
17
17
|
def before_render
|
|
18
18
|
return if tag.present?
|
|
19
|
-
return @tag = :button if options[:type] == :submit
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
@tag = if tag_button?
|
|
21
|
+
:button
|
|
22
|
+
elsif tag_a?
|
|
23
|
+
:a
|
|
24
|
+
else
|
|
25
|
+
:form
|
|
26
|
+
end
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def size_classes
|
|
@@ -94,5 +95,18 @@ module Tailwinds
|
|
|
94
95
|
'cursor-not-allowed'
|
|
95
96
|
end
|
|
96
97
|
end
|
|
98
|
+
|
|
99
|
+
def tag_button?
|
|
100
|
+
options[:type] == :submit
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def tag_a?
|
|
104
|
+
return true unless path.is_a?(String)
|
|
105
|
+
return false unless method.to_s.downcase == 'get'
|
|
106
|
+
|
|
107
|
+
uri = URI.parse(path)
|
|
108
|
+
|
|
109
|
+
uri.query.nil? || (uri.query && !uri.query.empty?) # rubocop:disable Rails/Present
|
|
110
|
+
end
|
|
97
111
|
end
|
|
98
112
|
end
|
data/lib/tramway/version.rb
CHANGED