formstrap 0.4.11 → 0.5.0
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/.gitignore +1 -1
- data/README.md +74 -23
- data/app/assets/javascripts/formstrap/controllers/nested_preview_controller.js +8 -1
- data/app/assets/javascripts/formstrap.js +7 -1
- data/app/views/formstrap/_association.html.erb +4 -4
- data/app/views/formstrap/_checkbox.html.erb +2 -2
- data/app/views/formstrap/_color.html.erb +2 -2
- data/app/views/formstrap/_date.html.erb +2 -2
- data/app/views/formstrap/_date_range.html.erb +2 -2
- data/app/views/formstrap/_datetime.html.erb +2 -2
- data/app/views/formstrap/_datetime_range.html.erb +2 -2
- data/app/views/formstrap/_email.html.erb +2 -2
- data/app/views/formstrap/_file.html.erb +2 -2
- data/app/views/formstrap/_flatpickr.html.erb +2 -2
- data/app/views/formstrap/_flatpickr_range.html.erb +2 -2
- data/app/views/formstrap/_hidden.html.erb +2 -2
- data/app/views/formstrap/_hint.html.erb +2 -2
- data/app/views/formstrap/_media.html.erb +2 -2
- data/app/views/formstrap/_number.html.erb +2 -2
- data/app/views/formstrap/_password.html.erb +2 -2
- data/app/views/formstrap/_redactor.html.erb +2 -2
- data/app/views/formstrap/_repeater.html.erb +20 -10
- data/app/views/formstrap/_search.html.erb +2 -2
- data/app/views/formstrap/_select.html.erb +4 -4
- data/app/views/formstrap/_switch.html.erb +2 -2
- data/app/views/formstrap/_text.html.erb +2 -2
- data/app/views/formstrap/_textarea.html.erb +2 -2
- data/app/views/formstrap/_url.html.erb +2 -2
- data/app/views/formstrap/_wysiwyg.html.erb +2 -2
- data/lib/formstrap/form_builder.rb +1 -1
- data/lib/formstrap/version.rb +1 -1
- data/lib/formstrap.rb +3 -0
- data/lib/generators/install/install_generator.rb +14 -0
- data/lib/generators/install/templates/formstrap.rb +6 -0
- data/package.json +2 -2
- metadata +4 -9
- data/app/assets/images/avatar.jpg +0 -0
- data/app/assets/images/document.docx +0 -0
- data/app/assets/images/document.pdf +0 -0
- data/app/assets/images/image.jpg +0 -0
- data/app/assets/images/spreadsheet.xls +0 -0
- data/app/assets/images/video.mp4 +0 -0
- data/formstrap.iml +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9667f4d2f17cfd38607cd5c95ee67d705b6b2545190d9689c23e23e9aedb9e
|
4
|
+
data.tar.gz: d8254ea343cb85bb21d05c8f7187bb72329faef062b1684f0a69d1524ba7ceb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4241e92c629a097d90a9b9b28bf94ef9c9523b29a54aaa522142fa9419e6539390eb920496dce93c16e8b1d4573d2c2e35064d0e5eac8ff8840c2d5756cce5e
|
7
|
+
data.tar.gz: 8dd17d637f12039fecf049dbe537c3ce8da6ba36c5560e44a068615f8fe6f22669e4d44c738bccd25e03fce5f4398ce347545006290d6bef9927bd3ad1a761f4
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,21 +1,33 @@
|
|
1
1
|
# Formstrap
|
2
2
|
|
3
|
-
|
3
|
+
Formstrap enhances the default Rails form helpers with Bootstrap-friendly markup and extended functionality.
|
4
|
+
Simply replace your existing ```form_with``` calls with ```formstrap_form_with```, and your forms will automatically be styled according to Bootstrap (5.3.x) conventions.
|
4
5
|
|
5
|
-
|
6
|
+
In addition to clean and responsive markup, Formstrap offers a set of extended form helpers out of the box:
|
7
|
+
|
8
|
+
- A WYSIWYG editor for rich text fields
|
9
|
+
- A date range picker
|
10
|
+
- A media picker for selecting Active Storage assets
|
11
|
+
- ...and more
|
6
12
|
|
7
|
-
|
13
|
+
## Installation
|
8
14
|
|
15
|
+
Add Formstrap to your Rails application
|
9
16
|
```bash
|
10
|
-
|
17
|
+
bundle add 'formstrap'
|
11
18
|
```
|
12
19
|
|
13
|
-
|
14
|
-
|
20
|
+
And copy the default configuration with:
|
15
21
|
```bash
|
16
|
-
|
22
|
+
rails generate formstrap:install
|
17
23
|
```
|
18
24
|
|
25
|
+
We're a big believer of "BYOD" Bring Your Own Dependencies.
|
26
|
+
You need to have Bootstrap (5.3.x) already installed in your application.
|
27
|
+
|
28
|
+
Formstrap provides support for Redactor (Paid), TomSelect and Flatpickr.
|
29
|
+
If you wish to make use of these dependencies you need to provide them yourself.
|
30
|
+
|
19
31
|
## Usage
|
20
32
|
|
21
33
|
### Getting started
|
@@ -34,9 +46,7 @@ An example:
|
|
34
46
|
<% end %>
|
35
47
|
```
|
36
48
|
|
37
|
-
|
38
|
-
|
39
|
-
If the original Rails helper needs to be accessed, it can be accessed by:
|
49
|
+
To fallback to the default form helpers add ```formstrap: false```:
|
40
50
|
|
41
51
|
```erb
|
42
52
|
<%= formstrap_for_for(@user) do |f| %>
|
@@ -74,12 +84,60 @@ An overview of all the Formstrap / Ruby on Rails form helpers:
|
|
74
84
|
| WYSIWYG * | wysiwyg | N/A |
|
75
85
|
| Repeater | repeater_for | Adds advanced features to fields_for |
|
76
86
|
|
77
|
-
|
78
|
-
correct assets.
|
87
|
+
Formstrap provides more helpers than what is standard in Ruby on Rails, e.g. ```Media```, ```Date range```, ```Redactor```.
|
79
88
|
|
80
|
-
|
89
|
+
#### Media
|
90
|
+
A visual media picker that allows you to select ActiveStorage blobs to be attached to the current record.
|
91
|
+
Works with ```has_many_attached``` and ```has_one_attached```
|
81
92
|
|
82
|
-
|
93
|
+
```erb
|
94
|
+
<%= formstrap_form_with do |form| %>
|
95
|
+
<%= form.media :image %>
|
96
|
+
<%= form.media :files %>
|
97
|
+
<% end %>
|
98
|
+
```
|
99
|
+
|
100
|
+

|
101
|
+
|
102
|
+
#### Date range
|
103
|
+
The default date range picker adds 2 date pickers. There's also "Flatpickr range" for a combined input which depends on Flatpickr
|
104
|
+
|
105
|
+
```erb
|
106
|
+
<%= formstrap_form_with do |form| %>
|
107
|
+
<%= form.date_range start: {attribute: :start_date}, end: {attribute: :end_date} %>
|
108
|
+
<% end %>
|
109
|
+
```
|
110
|
+
|
111
|
+

|
112
|
+
|
113
|
+
#### WYSIWYG
|
114
|
+
This form helper depends on Redactor (paid).
|
115
|
+
|
116
|
+
```erb
|
117
|
+
<%= formstrap_form_with do |form| %>
|
118
|
+
<%= form.wysiwyg :text %>
|
119
|
+
<% end %>
|
120
|
+
```
|
121
|
+
|
122
|
+

|
123
|
+
|
124
|
+
#### Repeater
|
125
|
+
This form helper allows you to manage nested attributes in a visually appealing way. (replacement for cocoon)
|
126
|
+
It adds buttons to: add and delete rows. A drag-&-drop interface allows you to reorder rows.
|
127
|
+
To persist the order of rows a `position` attribute should be available on the associated model.
|
128
|
+
|
129
|
+
```erb
|
130
|
+
<%= formstrap_form_with do |form| %>
|
131
|
+
<% form.repeater_for :questions do |question| %>
|
132
|
+
<% render "admin/questions/fields, form: :question" %>
|
133
|
+
<% end %>
|
134
|
+
<% end %>
|
135
|
+
```
|
136
|
+
|
137
|
+

|
138
|
+
|
139
|
+
|
140
|
+
### Overriding Formstrap helpers
|
83
141
|
|
84
142
|
Because Formstrap uses html and Ruby on Rails helpers behind the scenes to render its helpers, editing the Formstrap
|
85
143
|
helpers is straightforward.
|
@@ -94,18 +152,11 @@ rails generate formstrap:views
|
|
94
152
|
This will create a directory ```./views/formstrap```, in which all the views (and its helpers) are copied in and can thus be
|
95
153
|
inspected / altered. Because Formstrap is an engine, the application's local files take precedence over the engine's files.
|
96
154
|
|
97
|
-
|
155
|
+
Running the command again will override the files already present in your application.
|
98
156
|
|
99
|
-
|
100
|
-
rails generate formstrap:views
|
101
|
-
```
|
102
|
-
|
103
|
-
To get new or updated versions of the helpers. **This will override the files that are already present (and which might contain your personal adjustments)**.
|
104
|
-
|
105
|
-
### Extending Formstrap helpers
|
157
|
+
### Build your own Formstrap helpers
|
106
158
|
|
107
159
|
Extending Formstrap helpers is straightforward.
|
108
|
-
|
109
160
|
Add your custom Formstrap (e.g. map) helper into the map ```./views/formstrap```. Formstrap makes it possible to access this helper is by its filename.
|
110
161
|
|
111
162
|
|
@@ -133,6 +133,7 @@ export default class extends Controller {
|
|
133
133
|
const currentName = element.getAttribute('name')
|
134
134
|
const newName = currentName.replace(regex, '$1')
|
135
135
|
const values = this.readValues(element)
|
136
|
+
|
136
137
|
values.forEach((value) => {
|
137
138
|
formData.append(newName, value)
|
138
139
|
})
|
@@ -148,6 +149,12 @@ export default class extends Controller {
|
|
148
149
|
// Check if the element is a select with multiple selection
|
149
150
|
if (element.tagName.toLowerCase() === 'select' && element.multiple) {
|
150
151
|
return [...element.selectedOptions].map(option => option.value)
|
152
|
+
} else if (element.tagName.toLowerCase() === 'input' && element.type === 'checkbox') {
|
153
|
+
if (element.checked) {
|
154
|
+
return [element.value]
|
155
|
+
} else {
|
156
|
+
return []
|
157
|
+
}
|
151
158
|
} else {
|
152
159
|
return [element.value]
|
153
160
|
}
|
@@ -162,7 +169,7 @@ export default class extends Controller {
|
|
162
169
|
opacity: 0;
|
163
170
|
transform-origin: 0 0;
|
164
171
|
width: ${100 / scaleFactor}%;
|
165
|
-
|
172
|
+
`
|
166
173
|
this.iframeTarget.setAttribute('style', style)
|
167
174
|
}
|
168
175
|
|
@@ -11555,6 +11555,12 @@ var nested_preview_controller_default = class extends Controller {
|
|
11555
11555
|
readValues(element) {
|
11556
11556
|
if (element.tagName.toLowerCase() === "select" && element.multiple) {
|
11557
11557
|
return [...element.selectedOptions].map((option2) => option2.value);
|
11558
|
+
} else if (element.tagName.toLowerCase() === "input" && element.type === "checkbox") {
|
11559
|
+
if (element.checked) {
|
11560
|
+
return [element.value];
|
11561
|
+
} else {
|
11562
|
+
return [];
|
11563
|
+
}
|
11558
11564
|
} else {
|
11559
11565
|
return [element.value];
|
11560
11566
|
}
|
@@ -11566,7 +11572,7 @@ var nested_preview_controller_default = class extends Controller {
|
|
11566
11572
|
opacity: 0;
|
11567
11573
|
transform-origin: 0 0;
|
11568
11574
|
width: ${100 / scaleFactor}%;
|
11569
|
-
|
11575
|
+
`;
|
11570
11576
|
this.iframeTarget.setAttribute("style", style);
|
11571
11577
|
}
|
11572
11578
|
scaleFactor() {
|
@@ -26,13 +26,13 @@
|
|
26
26
|
#
|
27
27
|
# ==== Examples
|
28
28
|
# Basic version
|
29
|
-
# <%=
|
30
|
-
# <%=
|
29
|
+
# <%= formstrap_form_with do |form| %#>
|
30
|
+
# <%= form.association :product %#>
|
31
31
|
# <% end %#>
|
32
32
|
#
|
33
33
|
# Remote data
|
34
|
-
# <%=
|
35
|
-
# <%=
|
34
|
+
# <%= formstrap_form_with do |form| %#>
|
35
|
+
# <%= form.association :product, remote: {url: admin_products_path, value: "id", label: "name"} %#>
|
36
36
|
# <% end %#>
|
37
37
|
|
38
38
|
association = Formstrap::AssociationView.new(local_assigns)
|
@@ -20,8 +20,8 @@
|
|
20
20
|
#
|
21
21
|
# ==== Examples
|
22
22
|
# Basic version
|
23
|
-
# <%=
|
24
|
-
# <%=
|
23
|
+
# <%= formstrap_form_with do |form| %#>
|
24
|
+
# <%= form.checkbox :active %#>
|
25
25
|
# <% end %#>
|
26
26
|
|
27
27
|
checkbox = Formstrap::CheckboxView.new(local_assigns)
|
@@ -18,8 +18,8 @@
|
|
18
18
|
#
|
19
19
|
# ==== Examples
|
20
20
|
# Basic version
|
21
|
-
# <%=
|
22
|
-
# <%=
|
21
|
+
# <%= formstrap_form_with do |form| %#>
|
22
|
+
# <%= form.color :active %#>
|
23
23
|
# <% end %#>
|
24
24
|
|
25
25
|
color = Formstrap::ColorView.new(local_assigns)
|
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# ==== Examples
|
25
25
|
# Basic version
|
26
|
-
# <%=
|
27
|
-
# <%=
|
26
|
+
# <%= formstrap_form_with do |form| %#>
|
27
|
+
# <%= form.date :date_of_birth %#>
|
28
28
|
# <% end %#>
|
29
29
|
|
30
30
|
date = Formstrap::DateView.new(local_assigns)
|
@@ -22,8 +22,8 @@
|
|
22
22
|
#
|
23
23
|
# ==== Examples
|
24
24
|
# Basic version
|
25
|
-
# <%=
|
26
|
-
# <%=
|
25
|
+
# <%= formstrap_form_with do |form| %#>
|
26
|
+
# <%= form.date_range start: {attribute: :start_date}, end: {attribute: :end_date} %#>
|
27
27
|
# <% end %#>
|
28
28
|
|
29
29
|
date_range = Formstrap::DateRangeView.new(local_assigns)
|
@@ -22,8 +22,8 @@
|
|
22
22
|
#
|
23
23
|
# ==== Examples
|
24
24
|
# Basic version
|
25
|
-
# <%=
|
26
|
-
# <%=
|
25
|
+
# <%= formstrap_form_with do |form| %#>
|
26
|
+
# <%= form.datetime :deadline %#>
|
27
27
|
# <% end %#>
|
28
28
|
|
29
29
|
datetime = Formstrap::DatetimeView.new(local_assigns)
|
@@ -22,8 +22,8 @@
|
|
22
22
|
#
|
23
23
|
# ==== Examples
|
24
24
|
# Basic version
|
25
|
-
# <%=
|
26
|
-
# <%=
|
25
|
+
# <%= formstrap_form_with do |form| %#>
|
26
|
+
# <%= form.datetime_range start: {attribute: :start_date}, end: {attribute: :end_date} %#>
|
27
27
|
# <% end %#>
|
28
28
|
|
29
29
|
datetime_range = Formstrap::DatetimeRangeView.new(local_assigns)
|
@@ -24,8 +24,8 @@
|
|
24
24
|
#
|
25
25
|
# ==== Examples
|
26
26
|
# Basic version
|
27
|
-
# <%=
|
28
|
-
# <%=
|
27
|
+
# <%= formstrap_form_with do |form| %#>
|
28
|
+
# <%= form.email :email_address %#>
|
29
29
|
# <% end %#>
|
30
30
|
|
31
31
|
email = Formstrap::EmailView.new(local_assigns)
|
@@ -24,8 +24,8 @@
|
|
24
24
|
#
|
25
25
|
# ==== Examples
|
26
26
|
# Basic version
|
27
|
-
# <%=
|
28
|
-
# <%=
|
27
|
+
# <%= formstrap_form_with do |form| %#>
|
28
|
+
# <%= form.file :file %#>
|
29
29
|
# <% end %#>
|
30
30
|
|
31
31
|
file = Formstrap::FileView.new(local_assigns)
|
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# ==== Examples
|
25
25
|
# Basic version
|
26
|
-
# <%=
|
27
|
-
# <%=
|
26
|
+
# <%= formstrap_form_with do |form| %#>
|
27
|
+
# <%= form.date :date_of_birth %#>
|
28
28
|
# <% end %#>
|
29
29
|
|
30
30
|
flatpickr = Formstrap::FlatpickrView.new(local_assigns)
|
@@ -19,8 +19,8 @@
|
|
19
19
|
#
|
20
20
|
# ==== Examples
|
21
21
|
# Basic version
|
22
|
-
# <%=
|
23
|
-
# <%=
|
22
|
+
# <%= formstrap_form_with do |form| %#>
|
23
|
+
# <%= form.flatpickr_range, start: {attribute: :start_date}, end: {attribute: :end_date} %#>
|
24
24
|
# <% end %#>
|
25
25
|
|
26
26
|
flatpickr_range = Formstrap::FlatpickrRangeView.new(local_assigns)
|
@@ -12,8 +12,8 @@
|
|
12
12
|
#
|
13
13
|
# ==== Examples
|
14
14
|
# Basic version
|
15
|
-
# <%=
|
16
|
-
# <%=
|
15
|
+
# <%= formstrap_form_with do |form| %#>
|
16
|
+
# <%= form.hidden :id %#>
|
17
17
|
# <% end %#>
|
18
18
|
|
19
19
|
hidden = Formstrap::HiddenView.new(local_assigns)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#
|
7
7
|
# ==== Examples
|
8
8
|
# Basic version
|
9
|
-
# <%=
|
9
|
+
# <%= formstrap_form_with do |form| %#>
|
10
10
|
# <%= render "formstrap/hint", content: "Hello" %#>
|
11
11
|
# <% end %#>
|
12
12
|
|
@@ -18,4 +18,4 @@
|
|
18
18
|
<% if hint.maxlength %>
|
19
19
|
<div data-textarea-target="count"></div>
|
20
20
|
<% end %>
|
21
|
-
</div>
|
21
|
+
</div>
|
@@ -24,8 +24,8 @@
|
|
24
24
|
#
|
25
25
|
# ==== Examples
|
26
26
|
# Basic version
|
27
|
-
# <%=
|
28
|
-
# <%=
|
27
|
+
# <%= formstrap_form_with do |form| %#>
|
28
|
+
# <%= form.media :file %#>
|
29
29
|
# <% end %#>
|
30
30
|
|
31
31
|
media = Formstrap::MediaView.new(local_assigns)
|
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# ==== Examples
|
25
25
|
# Basic version
|
26
|
-
# <%=
|
27
|
-
# <%=
|
26
|
+
# <%= formstrap_form_with do |form| %#>
|
27
|
+
# <%= form.number :number %#>
|
28
28
|
# <% end %#>
|
29
29
|
|
30
30
|
number = Formstrap::NumberView.new(local_assigns)
|
@@ -22,8 +22,8 @@
|
|
22
22
|
#
|
23
23
|
# ==== Examples
|
24
24
|
# Basic version
|
25
|
-
# <%=
|
26
|
-
# <%=
|
25
|
+
# <%= formstrap_form_with do |form| %#>
|
26
|
+
# <%= form.password :password %#>
|
27
27
|
# <% end %#>
|
28
28
|
|
29
29
|
password = Formstrap::PasswordView.new(local_assigns)
|
@@ -19,8 +19,8 @@
|
|
19
19
|
#
|
20
20
|
# ==== Examples
|
21
21
|
# Basic version
|
22
|
-
# <%=
|
23
|
-
# <%=
|
22
|
+
# <%= formstrap_form_with do |form| %#>
|
23
|
+
# <%= form.redactor :text %#>
|
24
24
|
# <% end %#>
|
25
25
|
|
26
26
|
redactor = Formstrap::RedactorView.new(local_assigns)
|
@@ -15,29 +15,39 @@
|
|
15
15
|
#
|
16
16
|
# ==== Examples
|
17
17
|
# # Basic version
|
18
|
-
#
|
19
|
-
# <%
|
18
|
+
# <%= formstrap_form_with do |form| %#>
|
19
|
+
# <% form.repeater_for :questions do |question| %#>
|
20
|
+
# <% render "admin/questions/fields, form: :question" %#>
|
21
|
+
# <% end %#>
|
20
22
|
# <% end %#>
|
21
23
|
#
|
22
24
|
# # Let list group sit flush within its container
|
23
|
-
#
|
24
|
-
# <%
|
25
|
+
# <%= formstrap_form_with do |form| %#>
|
26
|
+
# <% form.repeater_for :questions, flush: true do |question| %#>
|
27
|
+
# <% render "admin/questions/fields, form: :question" %#>
|
28
|
+
# <% end %#>
|
25
29
|
# <% end %#>
|
26
30
|
#
|
27
31
|
# # With fixed header row. A header row can be used to show the labels, so you can omit them in the repeated fields
|
28
|
-
#
|
29
|
-
# <%
|
32
|
+
# <%= formstrap_form_with do |form| %#>
|
33
|
+
# <% form.repeater_for :questions, header: "admin/questions/header" do |question| %#>
|
34
|
+
# <% render "admin/questions/fields, form: :question" %#>
|
35
|
+
# <% end %#>
|
30
36
|
# <% end %#>
|
31
37
|
#
|
32
38
|
# # Allow more than one type of fields to be inserted. You must specify the templates as an array of view paths
|
33
39
|
# <% templates = ["admin/questions/fields/type_1", "admin/questions/fields/type_2"] %#>
|
34
|
-
#
|
35
|
-
# <%
|
40
|
+
# <%= formstrap_form_with do |form| %#>
|
41
|
+
# <% form.repeater_for :questions, templates: templates do |question, template_name| %#>
|
42
|
+
# <% render "admin/questions/#{template_name}, form: :question" %#>
|
43
|
+
# <% end %#>
|
36
44
|
# <% end %#>
|
37
45
|
#
|
38
46
|
# # Enable previews
|
39
|
-
#
|
40
|
-
# <%
|
47
|
+
# <%= formstrap_form_with do |form| %#>
|
48
|
+
# <% form.repeater_for :questions, preview_url: admin_preview_question_path do |question| %#>
|
49
|
+
# <% render "admin/questions/fields, form: :question" %#>
|
50
|
+
# <% end %#>
|
41
51
|
# <% end %#>
|
42
52
|
|
43
53
|
label = local_assigns.has_key?(:label) ? label : nil
|
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# ==== Examples
|
25
25
|
# Basic version
|
26
|
-
# <%=
|
27
|
-
# <%=
|
26
|
+
# <%= formstrap_form_with do |form| %#>
|
27
|
+
# <%= form.search :example %#>
|
28
28
|
# <% end %#>
|
29
29
|
|
30
30
|
search = Formstrap::SearchView.new(local_assigns)
|
@@ -32,13 +32,13 @@
|
|
32
32
|
#
|
33
33
|
# ==== Examples
|
34
34
|
# Basic version
|
35
|
-
# <%=
|
36
|
-
# <%=
|
35
|
+
# <%= formstrap_form_with do |form| %#>
|
36
|
+
# <%= form.select :color, collection: %w[red green blue] %#>
|
37
37
|
# <% end %#>
|
38
38
|
#
|
39
39
|
# Remote data
|
40
|
-
# <%=
|
41
|
-
# <%=
|
40
|
+
# <%= formstrap_form_with do |form| %#>
|
41
|
+
# <%= form.select :id, collection: [["Page 1", 1]], remote: {url: admin_pages_path, value: "id", label: "title"} %#>
|
42
42
|
# <% end %#>
|
43
43
|
|
44
44
|
select = Formstrap::SelectView.new(local_assigns)
|
@@ -20,8 +20,8 @@
|
|
20
20
|
#
|
21
21
|
# ==== Examples
|
22
22
|
# Basic version
|
23
|
-
# <%=
|
24
|
-
# <%=
|
23
|
+
# <%= formstrap_form_with do |form| %#>
|
24
|
+
# <%= form.switch :active %#>
|
25
25
|
# <% end %#>
|
26
26
|
|
27
27
|
switch = Formstrap::SwitchView.new(local_assigns)
|
@@ -24,8 +24,8 @@
|
|
24
24
|
#
|
25
25
|
# ==== Examples
|
26
26
|
# Basic version
|
27
|
-
# <%=
|
28
|
-
# <%=
|
27
|
+
# <%= formstrap_form_with do |form| %#>
|
28
|
+
# <%= form.text :title %#>
|
29
29
|
# <% end %#>
|
30
30
|
text = Formstrap::TextView.new(local_assigns)
|
31
31
|
%>
|
@@ -22,8 +22,8 @@
|
|
22
22
|
#
|
23
23
|
# ==== Examples
|
24
24
|
# Basic version
|
25
|
-
# <%=
|
26
|
-
# <%=
|
25
|
+
# <%= formstrap_form_with do |form| %#>
|
26
|
+
# <%= form.textarea :text %#>
|
27
27
|
# <% end %#>
|
28
28
|
|
29
29
|
textarea = Formstrap::TextareaView.new(local_assigns)
|
@@ -23,8 +23,8 @@
|
|
23
23
|
#
|
24
24
|
# ==== Examples
|
25
25
|
# Basic version
|
26
|
-
# <%=
|
27
|
-
# <%=
|
26
|
+
# <%= formstrap_form_with do |form| %#>
|
27
|
+
# <%= form.url :website_url %#>
|
28
28
|
# <% end %#>
|
29
29
|
|
30
30
|
url = Formstrap::UrlView.new(local_assigns)
|
@@ -17,8 +17,8 @@
|
|
17
17
|
#
|
18
18
|
# ==== Examples
|
19
19
|
# Basic version
|
20
|
-
# <%=
|
21
|
-
# <%=
|
20
|
+
# <%= formstrap_form_with do |form| %#>
|
21
|
+
# <%= form.wysiwyg :text %#>
|
22
22
|
# <% end %#>
|
23
23
|
|
24
24
|
wysiwyg = Formstrap::WysiwygView.new(local_assigns)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Formstrap
|
2
2
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
3
3
|
def initialize(object_name, object, template, options)
|
4
|
-
super
|
4
|
+
super
|
5
5
|
|
6
6
|
custom_helpers_path = "app/views/formstrap/"
|
7
7
|
@custom_helpers = Dir["#{custom_helpers_path}*.html.erb"].map { |item| item.gsub("#{custom_helpers_path}_", "").split(".").first.to_sym }
|
data/lib/formstrap/version.rb
CHANGED
data/lib/formstrap.rb
CHANGED
@@ -6,6 +6,9 @@ require_relative "formstrap/configuration"
|
|
6
6
|
require "formstrap/form_builder"
|
7
7
|
require "formstrap/form_helper"
|
8
8
|
|
9
|
+
# Load generators
|
10
|
+
Dir[File.join(__dir__, "generators", "**", "*_generator.rb")].each { |g| require g }
|
11
|
+
|
9
12
|
module Formstrap
|
10
13
|
mattr_accessor :configuration, default: Formstrap::Configuration.new
|
11
14
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# lib/generators/my_engine/my_initializer/my_initializer_generator.rb
|
2
|
+
require "rails/generators"
|
3
|
+
|
4
|
+
module Formstrap
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
|
9
|
+
def create_initializer_file
|
10
|
+
template "formstrap.rb", "config/initializers/formstrap.rb"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@frontierdotbe/formstrap",
|
3
|
-
"version": "0.4.
|
4
|
-
"description": "Bootstrap
|
3
|
+
"version": "0.4.12",
|
4
|
+
"description": "An extensive Bootstrap form library to power your Ruby On Rails application.",
|
5
5
|
"module": "app/assets/javascripts/formstrap.js",
|
6
6
|
"main": "app/assets/javascripts/formstrap.js",
|
7
7
|
"sass": "app/assets/stylesheets/formstrap.scss",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jef Vlamings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An extensive Bootstrap form library to power your Ruby On Rails application.
|
14
14
|
email:
|
@@ -28,12 +28,6 @@ files:
|
|
28
28
|
- Rakefile
|
29
29
|
- app/assets/.DS_Store
|
30
30
|
- app/assets/config/formstrap_manifest.js
|
31
|
-
- app/assets/images/avatar.jpg
|
32
|
-
- app/assets/images/document.docx
|
33
|
-
- app/assets/images/document.pdf
|
34
|
-
- app/assets/images/image.jpg
|
35
|
-
- app/assets/images/spreadsheet.xls
|
36
|
-
- app/assets/images/video.mp4
|
37
31
|
- app/assets/javascripts/formstrap.js
|
38
32
|
- app/assets/javascripts/formstrap/config/i18n.js
|
39
33
|
- app/assets/javascripts/formstrap/controllers/autocomplete_controller.js
|
@@ -188,13 +182,14 @@ files:
|
|
188
182
|
- esbuild-css.js
|
189
183
|
- esbuild-js.js
|
190
184
|
- formstrap.gemspec
|
191
|
-
- formstrap.iml
|
192
185
|
- lib/formstrap.rb
|
193
186
|
- lib/formstrap/configuration.rb
|
194
187
|
- lib/formstrap/engine.rb
|
195
188
|
- lib/formstrap/form_builder.rb
|
196
189
|
- lib/formstrap/form_helper.rb
|
197
190
|
- lib/formstrap/version.rb
|
191
|
+
- lib/generators/install/install_generator.rb
|
192
|
+
- lib/generators/install/templates/formstrap.rb
|
198
193
|
- package.json
|
199
194
|
- src/js/formstrap.js
|
200
195
|
- src/scss/formstrap.scss
|
Binary file
|
Binary file
|
File without changes
|
data/app/assets/images/image.jpg
DELETED
Binary file
|
Binary file
|
data/app/assets/images/video.mp4
DELETED
Binary file
|
data/formstrap.iml
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module type="RUBY_MODULE" version="4">
|
3
|
-
<component name="FacetManager">
|
4
|
-
<facet type="RailsFacetType" name="Ruby on Rails">
|
5
|
-
<configuration>
|
6
|
-
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
|
7
|
-
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
|
8
|
-
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$/test/dummy" />
|
9
|
-
</configuration>
|
10
|
-
</facet>
|
11
|
-
</component>
|
12
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
13
|
-
<exclude-output />
|
14
|
-
<content url="file://$MODULE_DIR$">
|
15
|
-
<sourceFolder url="file://$MODULE_DIR$/test/dummy/features" isTestSource="true" />
|
16
|
-
<sourceFolder url="file://$MODULE_DIR$/test/dummy/spec" isTestSource="true" />
|
17
|
-
<sourceFolder url="file://$MODULE_DIR$/test/dummy/test" isTestSource="true" />
|
18
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/.bundle" />
|
19
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/public/packs" />
|
20
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/vendor/bundle" />
|
21
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/vendor/cache" />
|
22
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/log" />
|
23
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/tmp" />
|
24
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/public/system" />
|
25
|
-
<excludeFolder url="file://$MODULE_DIR$/test/dummy/components" />
|
26
|
-
</content>
|
27
|
-
<orderEntry type="inheritedJdk" />
|
28
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
29
|
-
</component>
|
30
|
-
<component name="RModuleSettingsStorage">
|
31
|
-
<LOAD_PATH number="0" />
|
32
|
-
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/test/dummy/config/locales" />
|
33
|
-
</component>
|
34
|
-
</module>
|