lifeform 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46f529d43fb971ec766cde785b4fe2321f7f41cb6388fe667b0473b8db6b22e9
4
- data.tar.gz: e5de68e293b0f33a5bedbf4da01e5b53b2b9ff1d64b96702096e7ea2fd308b9b
3
+ metadata.gz: 0d7eca3cad846f501a2e7c536a1b425892f4345edf541f9c075247f43a0bd745
4
+ data.tar.gz: ecaed27fc58d8f4ee1d4124949e2b70880aee361adfce0a6c88ba4f1a4b15d5d
5
5
  SHA512:
6
- metadata.gz: 4f0432d54235ec3963e1f20cab857457ba09e41d508e5a785616905986b85e75acd13e6b86afb873f16dfc643c30592efd198fa13a528654b5a8445abcac489d
7
- data.tar.gz: ec6ccfb51135a4f5cd619b322bd887f51b608ee590a1be6a7480a0ed79662594c588ee7cfd568169ddf994d13ba312c110e7e67df013d7b8c50862a6237f175c
6
+ metadata.gz: 64ebc935866d5a6cfdf196ef9e9415d2a54a583d7782799cfbe5dfa4487000a6bf84565a4af004c6cda90bc4033c7405b58061111f46ce690a7f9159569ec0ac
7
+ data.tar.gz: dd0cf0480e6ec9b64d76235365952a398e1f79514c3903f870a8683fbbce6fcedb26356005b8b8bf4892159130fa22c733886f68df24789bcd09f85fb58cd52f
data/CHANGELOG.md CHANGED
@@ -1,8 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
3
8
  ## [Unreleased]
4
9
 
5
- ## [0.14.0] - 2024-03-15
10
+ ## [0.15.0] - 2024-04-17
11
+
12
+ - Add compatibility fixes re: Streamlined
13
+
14
+ ## [0.14.0] - 2024-03-03
15
+
16
+ - Add Rodauth support in Bridgetown
17
+
18
+ ## [0.13.0] - 2024-03-15
6
19
 
7
20
  - Fix rendering bug when wrapper tags were set to nil
8
21
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lifeform (0.13.0)
4
+ lifeform (0.15.0)
5
5
  hash_with_dot_access (>= 1.2)
6
6
  sequel (>= 5.72)
7
7
  streamlined (>= 0.2.0)
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.1.1)
13
+ activesupport (7.1.3.2)
14
14
  base64
15
15
  bigdecimal
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -23,41 +23,40 @@ GEM
23
23
  ansi (1.5.0)
24
24
  ast (2.4.2)
25
25
  backport (1.2.0)
26
- base64 (0.1.1)
27
- benchmark (0.2.1)
28
- bigdecimal (3.1.4)
26
+ base64 (0.2.0)
27
+ benchmark (0.3.0)
28
+ bigdecimal (3.1.7)
29
29
  builder (3.2.4)
30
- concurrent-ruby (1.2.2)
30
+ concurrent-ruby (1.2.3)
31
31
  connection_pool (2.4.1)
32
- diff-lcs (1.5.0)
33
- drb (2.1.1)
34
- ruby2_keywords
32
+ diff-lcs (1.5.1)
33
+ drb (2.2.1)
35
34
  e2mmap (0.1.0)
36
35
  erubi (1.12.0)
37
36
  hash_with_dot_access (1.2.0)
38
37
  activesupport (>= 5.0.0, < 8.0)
39
- i18n (1.14.1)
38
+ i18n (1.14.4)
40
39
  concurrent-ruby (~> 1.0)
41
40
  jaro_winkler (1.5.6)
42
- json (2.6.3)
41
+ json (2.7.2)
43
42
  kramdown (2.4.0)
44
43
  rexml
45
44
  kramdown-parser-gfm (1.1.0)
46
45
  kramdown (~> 2.0)
47
46
  language_server-protocol (3.17.0.3)
48
- minitest (5.20.0)
47
+ minitest (5.22.3)
49
48
  minitest-reporters (1.6.1)
50
49
  ansi
51
50
  builder
52
51
  minitest (>= 5.0)
53
52
  ruby-progressbar
54
- mutex_m (0.1.2)
55
- nokogiri (1.15.4-arm64-darwin)
53
+ mutex_m (0.2.0)
54
+ nokogiri (1.16.4-arm64-darwin)
56
55
  racc (~> 1.4)
57
- nokogiri (1.15.4-x86_64-linux)
56
+ nokogiri (1.16.4-x86_64-linux)
58
57
  racc (~> 1.4)
59
- parallel (1.23.0)
60
- parser (3.2.2.4)
58
+ parallel (1.24.0)
59
+ parser (3.3.0.5)
61
60
  ast (~> 2.4.1)
62
61
  racc
63
62
  racc (1.7.3)
@@ -66,37 +65,36 @@ GEM
66
65
  minitest
67
66
  nokogiri (>= 1.6)
68
67
  rainbow (3.1.1)
69
- rake (13.1.0)
70
- regexp_parser (2.8.2)
68
+ rake (13.2.1)
69
+ regexp_parser (2.9.0)
71
70
  reverse_markdown (2.1.1)
72
71
  nokogiri
73
72
  rexml (3.2.6)
74
- rubocop (1.57.2)
73
+ rubocop (1.63.2)
75
74
  json (~> 2.3)
76
75
  language_server-protocol (>= 3.17.0)
77
76
  parallel (~> 1.10)
78
- parser (>= 3.2.2.4)
77
+ parser (>= 3.3.0.2)
79
78
  rainbow (>= 2.2.2, < 4.0)
80
79
  regexp_parser (>= 1.8, < 3.0)
81
80
  rexml (>= 3.2.5, < 4.0)
82
- rubocop-ast (>= 1.28.1, < 2.0)
81
+ rubocop-ast (>= 1.31.1, < 2.0)
83
82
  ruby-progressbar (~> 1.7)
84
83
  unicode-display_width (>= 2.4.0, < 3.0)
85
- rubocop-ast (1.30.0)
86
- parser (>= 3.2.1.0)
87
- rubocop-bridgetown (0.4.1)
84
+ rubocop-ast (1.31.2)
85
+ parser (>= 3.3.0.4)
86
+ rubocop-bridgetown (0.5.0)
88
87
  rubocop (~> 1.23)
89
88
  rubocop-performance (~> 1.12)
90
89
  rubocop-minitest (0.20.1)
91
90
  rubocop (>= 0.90, < 2.0)
92
- rubocop-performance (1.19.1)
93
- rubocop (>= 1.7.0, < 2.0)
94
- rubocop-ast (>= 0.4.0)
91
+ rubocop-performance (1.21.0)
92
+ rubocop (>= 1.48.1, < 2.0)
93
+ rubocop-ast (>= 1.31.1, < 2.0)
95
94
  rubocop-rake (0.6.0)
96
95
  rubocop (~> 1.0)
97
96
  ruby-progressbar (1.13.0)
98
- ruby2_keywords (0.0.5)
99
- sequel (5.74.0)
97
+ sequel (5.79.0)
100
98
  bigdecimal
101
99
  serbea (2.1.0)
102
100
  erubi (>= 1.10)
@@ -116,16 +114,16 @@ GEM
116
114
  thor (~> 1.0)
117
115
  tilt (~> 2.0)
118
116
  yard (~> 0.9, >= 0.9.24)
119
- streamlined (0.3.1)
117
+ streamlined (0.5.2)
120
118
  serbea (>= 2.1)
121
119
  zeitwerk (~> 2.5)
122
- thor (1.3.0)
120
+ thor (1.3.1)
123
121
  tilt (2.3.0)
124
122
  tzinfo (2.0.6)
125
123
  concurrent-ruby (~> 1.0)
126
124
  unicode-display_width (2.5.0)
127
- yard (0.9.34)
128
- zeitwerk (2.6.12)
125
+ yard (0.9.36)
126
+ zeitwerk (2.6.13)
129
127
 
130
128
  PLATFORMS
131
129
  arm64-darwin-21
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Lifeform
2
2
 
3
- Component-centric form object rendering for Ruby. Rails and Bridgetown both supported.
3
+ Component-centric form object rendering for Ruby. Bridgetown, Roda, and Rails all supported.
4
4
 
5
5
  ## Installation
6
6
 
data/lib/lifeform/form.rb CHANGED
@@ -23,6 +23,11 @@ module Lifeform
23
23
  # Helper to point to `I18n.t` method
24
24
  def t(...) = I18n.t(...)
25
25
 
26
+ # Support integration with Rodauth for sign in/sign up forms
27
+ attr_writer :rodauth
28
+
29
+ def rodauth = Form.instance_variable_get(:@rodauth)
30
+
26
31
  def configuration = @configuration ||= HashWithDotAccess::Hash.new
27
32
 
28
33
  # @param block [Proc, nil]
@@ -192,7 +197,7 @@ module Lifeform
192
197
  form_tag = library::FORM_TAG
193
198
  parameters[:action] ||= url || (model ? helpers.send(self.class.const_get(:MODEL_PATH_HELPER), model) : nil)
194
199
 
195
- html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
200
+ html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc
196
201
  <#{form_tag} #{html_attributes attributes}>
197
202
  #{add_authenticity_token unless parameters[:method].to_s.casecmp("get").zero?}
198
203
  #{@method_tag&.() || ""}
@@ -24,17 +24,17 @@ module Lifeform
24
24
  return "" if !@if.nil? && !@if
25
25
 
26
26
  button_tag = dashed self.class.const_get(:BUTTON_TAG)
27
- label_text = block ? capture(self, &block) : @label.is_a?(Proc) ? @label.pipe : @label # rubocop:disable Style/NestedTernaryOperator
27
+ label_text = block ? capture(self, &block) : @label
28
28
 
29
- field_body = html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
30
- <#{button_tag}#{html_attributes @attributes, prefix_space: true}>#{text -> { label_text }}</#{button_tag}>
29
+ field_body = html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc
30
+ <#{button_tag}#{html_attributes @attributes, prefix_space: true}>#{text label_text}</#{button_tag}>
31
31
  HTML
32
32
  }
33
33
 
34
34
  return field_body unless self.class.const_get(:WRAPPER_TAG)
35
35
 
36
36
  wrapper_tag = dashed self.class.const_get(:WRAPPER_TAG)
37
- html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
37
+ html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc
38
38
  <#{wrapper_tag} #{html_attributes name: @attributes[:name]}>#{field_body}</#{wrapper_tag}>
39
39
  HTML
40
40
  }
@@ -41,13 +41,13 @@ module Lifeform
41
41
  def value_for_model = @model.send(attributes[:name])
42
42
 
43
43
  def handle_labels
44
- label_text = attributes[:label].is_a?(Proc) ? attributes[:label].pipe : attributes[:label]
44
+ label_text = attributes[:label]
45
45
  label_name = (attributes[:id] || attributes[:name]).to_s
46
46
 
47
47
  @attributes = attributes.filter_map { |k, v| [k, v] unless k == :label }.to_h
48
48
 
49
49
  -> { <<~HTML
50
- <label for="#{text -> { label_name }}">#{text -> { label_text }}</label>
50
+ <label for="#{text -> { label_name }}">#{text label_text}</label>
51
51
  HTML
52
52
  }
53
53
  end
@@ -58,7 +58,7 @@ module Lifeform
58
58
  input_tag = dashed self.class.const_get(:INPUT_TAG)
59
59
  closing_tag = input_tag != "input"
60
60
 
61
- field_body = html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
61
+ field_body = html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc
62
62
  #{html(@label || -> {}).to_s.strip}
63
63
  <#{input_tag} #{html_attributes type: @field_type.to_s, **@attributes}>#{
64
64
  "</#{input_tag}>" if closing_tag
@@ -70,7 +70,7 @@ module Lifeform
70
70
  return field_body unless self.class.const_get(:WRAPPER_TAG)
71
71
 
72
72
  wrapper_tag = dashed self.class.const_get(:WRAPPER_TAG)
73
- html -> { <<~HTML # rubocop:disable Bridgetown/HTMLEscapedHeredoc
73
+ html -> { <<~HTML # rubocop:disable Bridgetown/InsecureHeredoc
74
74
  <#{wrapper_tag} #{html_attributes name: @attributes[:name]}>#{field_body.to_s.strip}</#{wrapper_tag}>
75
75
  HTML
76
76
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lifeform
4
- VERSION = "0.13.0"
4
+ VERSION = "0.15.0"
5
5
  end
data/lib/lifeform.rb CHANGED
@@ -10,9 +10,9 @@ module Lifeform
10
10
  end
11
11
 
12
12
  if defined?(Bridgetown)
13
- # Check compatibility
14
- raise "The Lifeform support for Bridgetown requires v1.2 or newer" if Bridgetown::VERSION.to_f < 1.2
15
-
16
- Bridgetown.initializer :lifeform do # |config|
13
+ Bridgetown.initializer :lifeform do |config|
14
+ config.hook :authtown, :initialized do |rodauth|
15
+ Lifeform::Form.rodauth = rodauth
16
+ end
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifeform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-16 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hash_with_dot_access