template_form 0.4.6 → 0.4.7
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 +4 -4
- data/README.md +2 -0
- data/lib/template_form/base_input.rb +4 -1
- data/lib/template_form/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9da5ef52af3c84bb5b484452ecb693f4ce8ffe4c908f045c52ab9abede6030a7
|
4
|
+
data.tar.gz: 425de0736d09aeca3f27d73b0970c8bce1036ff10fd9d7d0ad496159fae9d537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 710691873b95b172be68cda8357d68e6b1cf9d8ac733896fc18ca00485ca5687e46ed94ff0a73064f83d88dfa9045ed7fe7f0b6e9bf8909d2786a51173b5e009
|
7
|
+
data.tar.gz: 29752a9dcd330f0c95a7e682cdfb6747094fe784335d89884c96fd66d0487339a436a69cd9e6c1cc74723652ff0d3efd07bb2b948a347c23bf3379694e59c4be
|
data/README.md
CHANGED
@@ -111,6 +111,8 @@ They should have these names:
|
|
111
111
|
|
112
112
|
Use whatever extension goes with your template engine.
|
113
113
|
|
114
|
+
You can have several variations of a template, for example a [text input with inline add-on](https://tailwindui.com/components/application-ui/forms/input-groups#component-3620fb44e0a49ebce229526254018508). First, write your template at `<BASE>_<VARIANT>.html.erb`; say, `text_input_inline_add_on.html.erb`. Then use a `with: <VARIANT>` option in your view, e.g. `<%= form.input :name, with: :inline_add_on %>`.
|
115
|
+
|
114
116
|
Inside each template you can use the normal Rails form helpers. Here's the template for Bulma's [text input](https://github.com/airblade/template_form/blob/master/lib/template_form/templates/bulma/text_input.html.erb):
|
115
117
|
|
116
118
|
```erb
|
@@ -77,7 +77,10 @@ module TemplateForm
|
|
77
77
|
|
78
78
|
# TemplateForm::TextInput -> text_input
|
79
79
|
def template_name
|
80
|
-
|
80
|
+
@template_name ||= [
|
81
|
+
self.class.name.demodulize.underscore,
|
82
|
+
options.delete(:with)
|
83
|
+
].compact.join('_')
|
81
84
|
end
|
82
85
|
|
83
86
|
def detect_template_path(name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: template_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.4.10
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: A template-based form builder for Rails.
|