tramway 0.6.1.1 → 0.6.1.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: 7fffab981c47137351c1b55fb952713cf8ee9f1b4ba963ca60e2349d8e836d2e
4
- data.tar.gz: e858d3b6377eb934c5ae15bccee505a65f1a4abdb4d7088340f7271ba923c8f8
3
+ metadata.gz: 5a3af652c9e3a05d8524dbdd1af0e468b01d731d90684acf1cc3ba21c8b47a98
4
+ data.tar.gz: '08633354153733f0178487fdb9d1353d6d953b9aa0e60dd17e83d8645b074de3'
5
5
  SHA512:
6
- metadata.gz: 82dede0fafef9b81bf1e2bf12da749d14a7bf508d7855d57497ccecefb5f2bcb779c89460fdda9f4bdb71bdd6af6df224cb7c0036b457dba0f6d44e703f61cd5
7
- data.tar.gz: 37b31c109c429c1d5979a8bbbff3c5ef171653b2abbadc8b2a41c979096af9cf22b0302ede6496539fb8755c4fb83766f01cfe1f98d3e4761a27bb1b89b6903b
6
+ metadata.gz: fb847e9ef0970f10000961f82d9478b0be926c91a3e56b06b1c28c63b550a7e529a0c0bb3591238ace18f0967d8e97c4a4f765bb04aa15dcba92f7e06f7f7be5
7
+ data.tar.gz: 4e186f09455eca7b67a88aa89dce4582711729f299afea16ffd522f83e9534db407a824b2c6f38aa628df673a39c454fbafe1d1e9302e35347782b42b687f724
@@ -2,11 +2,19 @@
2
2
  - if link
3
3
  = link_to text, path, class: classes, **options.except(:class)
4
4
  - else
5
- = button_to text, path, method:, class: classes, **options.except(:class)
5
+ - if type&.to_sym == :submit
6
+ %button{ type: :submit, name: :commit, class: classes, **options.except(:class) }
7
+ = text
8
+ - else
9
+ = button_to text, path, method:, class: classes, **options.except(:class)
6
10
  - else
7
11
  - if link
8
12
  = link_to path, class: classes, **options.except(:class) do
9
13
  = content
10
14
  - else
11
- = button_to path, method:, class: classes, **options.except(:class) do
12
- = content
15
+ - if type&.to_sym == :submit
16
+ %button{ type: :submit, name: :commit, class: classes, **options.except(:class) }
17
+ = content
18
+ - else
19
+ = button_to path, method:, class: classes, **options.except(:class) do
20
+ = content
@@ -5,7 +5,7 @@ module Tailwinds
5
5
  #
6
6
  class ButtonComponent < BaseComponent
7
7
  option :text, optional: true, default: -> {}
8
- option :path
8
+ option :path, optional: true, default: -> { '#' }
9
9
  option :color, optional: true
10
10
  option :type, optional: true
11
11
  option :size, default: -> { :middle }
@@ -14,12 +14,11 @@ module Tailwinds
14
14
  option :options, optional: true, default: -> { {} }
15
15
 
16
16
  def size_classes
17
- case size
18
- when :small
19
- 'text-sm py-1 px-2 rounded' # small button
20
- when :middle
21
- 'py-2 px-4' # middle button
22
- end
17
+ {
18
+ small: 'text-sm py-1 px-2 rounded',
19
+ middle: 'py-2 px-4',
20
+ large: 'text-lg px-5 py-3'
21
+ }[size]
23
22
  end
24
23
 
25
24
  TYPE_COLOR_MAP = {
@@ -37,7 +36,8 @@ module Tailwinds
37
36
  love: :violet,
38
37
  compassion: :indigo,
39
38
  compassio: :indigo,
40
- fear: :yellow
39
+ fear: :yellow,
40
+ submit: :green
41
41
  }.freeze
42
42
 
43
43
  def classes
@@ -2,6 +2,11 @@
2
2
  - base_classes = 'bg-red-500 hover:bg-red-700 text-white font-bold rounded focus:outline-none focus:shadow-outline cursor-pointer '
3
3
  - base_classes += 'dark:text-white dark:bg-red-600 dark:hover:bg-red-500 dark:focus:ring-2 dark:focus:ring-red-400'
4
4
  - classes = "#{size_class(:submit_button)} #{base_classes}"
5
- %button{ type: :submit, name: :commit, class: classes, **@options }
6
- = @text
5
+
6
+ = helpers.tramway_button text: @text,
7
+ type: :submit,
8
+ name: :commit,
9
+ size:,
10
+ **@options
11
+
7
12
  = @content
@@ -36,7 +36,7 @@ module Tramway
36
36
  component 'tailwinds/table/cell', &
37
37
  end
38
38
 
39
- def tramway_button(path:, text: nil, method: :get, link: false, **options)
39
+ def tramway_button(path: nil, text: nil, method: :get, link: false, **options)
40
40
  component 'tailwinds/button',
41
41
  text:,
42
42
  path:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tramway
4
- VERSION = '0.6.1.1'
4
+ VERSION = '0.6.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1.1
4
+ version: 0.6.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kalashnikovisme
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-10-28 00:00:00.000000000 Z
12
+ date: 2025-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: anyway_config