template_form 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/template_form/base_input.rb +1 -1
- data/lib/template_form/form_builder.rb +1 -1
- data/lib/template_form/version.rb +1 -1
- data/lib/template_form.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 408026155358aa91f7c4751f36424be1364a7e21962c93501eaafad752e469ef
|
4
|
+
data.tar.gz: 8193bbf3b0241df0956e2b4957fea34e33aa6030e997f705ddf063b65caba4a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8e9c96f173d1ade04629e2f22457d2ea885c3a4262f8e2327b6ab13a172c992469f269922d907491fdd7668f93d43def8c1773a4ceb9cb293d57f922b7eaa4
|
7
|
+
data.tar.gz: ccf8c4be15bfa0d5e615a2ffa07125fcd58b55d9f2d0c71898d37d1678b2018dab187c48d014bcb1b6a2bbb647039c40a7a63b31a5c604f5feba8442399ed008
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Template Form makes defining the HTML your form inputs generate as simple as possible: you just write it out. Most other form builders, e.g. Simple Form, add a layer of indirection and make you use their own DSL.
|
4
4
|
|
5
|
-
Templates are
|
5
|
+
Templates are namespaced so you can define different HTML for different situations, e.g. stacked or horizontal, in the same Rails app.
|
6
6
|
|
7
|
-
Right now Template Form includes templates for [Bulma](https://bulma.io/documentation/form/)
|
7
|
+
Right now Template Form includes templates for [Bulma](https://bulma.io/documentation/form/) because those are defined by Bulma. For Tailwind, or Bootstrap, you define your inputs yourself.
|
8
8
|
|
9
9
|
Template Form works with all template engines supported by [Tilt](https://github.com/rtomayko/tilt).
|
10
10
|
|
@@ -98,7 +98,7 @@ And then you will get this HTML instead:
|
|
98
98
|
|
99
99
|
### Defining your templates
|
100
100
|
|
101
|
-
Your templates live at `/app/forms/<FORM TYPE>/` where `<FORM TYPE>` is a name that makes sense to you, and the value that you use with the `:form_type` option to `#template_form_with`.
|
101
|
+
Your templates live at `TemplateForm.template_path` which defaults to `/app/forms/<FORM TYPE>/` where `<FORM TYPE>` is a name that makes sense to you, and the value that you use with the `:form_type` option to `#template_form_with`.
|
102
102
|
|
103
103
|
They should have these names:
|
104
104
|
|
data/lib/template_form.rb
CHANGED
@@ -15,6 +15,14 @@ module TemplateForm
|
|
15
15
|
@form_type = val
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.template_path
|
19
|
+
@template_path || Pathname.new("#{Rails.root}/app/forms")
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.template_path=(val)
|
23
|
+
@template_path = Pathname.new(val)
|
24
|
+
end
|
25
|
+
|
18
26
|
private
|
19
27
|
|
20
28
|
def self.noop_field_error_proc
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|