hot-glue 0.5.14 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +74 -0
- data/.github/workflows/test.yml +33 -14
- data/.gitignore +0 -2
- data/.ruby-version +1 -1
- data/Gemfile +4 -2
- data/Gemfile.lock +280 -0
- data/README.md +33 -4
- data/lib/generators/hot_glue/direct_upload_install_generator.rb +1 -1
- data/lib/generators/hot_glue/dropzone_install_generator.rb +1 -1
- data/lib/generators/hot_glue/field_factory.rb +6 -2
- data/lib/generators/hot_glue/fields/association_field.rb +73 -6
- data/lib/generators/hot_glue/fields/attachment_field.rb +7 -3
- data/lib/generators/hot_glue/fields/boolean_field.rb +31 -1
- data/lib/generators/hot_glue/fields/date_field.rb +13 -0
- data/lib/generators/hot_glue/fields/date_time_field.rb +30 -3
- data/lib/generators/hot_glue/fields/enum_field.rb +39 -6
- data/lib/generators/hot_glue/fields/field.rb +92 -8
- data/lib/generators/hot_glue/fields/float_field.rb +11 -0
- data/lib/generators/hot_glue/fields/integer_field.rb +4 -0
- data/lib/generators/hot_glue/fields/string_field.rb +17 -0
- data/lib/generators/hot_glue/fields/text_field.rb +17 -0
- data/lib/generators/hot_glue/fields/time_field.rb +20 -0
- data/lib/generators/hot_glue/fields/uuid_field.rb +1 -1
- data/lib/generators/hot_glue/flash_notices_install_generator.rb +1 -1
- data/lib/generators/hot_glue/install_generator.rb +15 -9
- data/lib/generators/hot_glue/layout/builder.rb +4 -2
- data/lib/generators/hot_glue/markup_templates/erb.rb +14 -279
- data/lib/generators/hot_glue/scaffold_generator.rb +133 -151
- data/lib/generators/hot_glue/templates/erb/_edit.erb +1 -1
- data/lib/hotglue/version.rb +1 -1
- data/script/test +9 -14
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61d066f183e4a0563768d26589b1fcf140c4867ea540458fea8e084ef3903b03
|
4
|
+
data.tar.gz: 32361a4068d3b9808f2d9caa2a9e1c22d484e1c23d3196fdde6e0939d6b6ce60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca1797468a13ade3f508d5fb8fc8799532bc9ec010ff0adffad7702bc569c42d6eb5926ee6682474d8b9ea3f4aeadaabe7e721a5ce3dc03996573767d04ff1c
|
7
|
+
data.tar.gz: 7ec34f2f77fa45740e521ec867bec02c712cbd80f4f91a59a8011a76f10e5595ea91bdf3cb3c48770d8959606b7d9a6424ad13d0f0aa2e80fa7821000e66d272
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# more about orbs: https://circleci.com/docs/2.0/using-orbs/
|
2
|
+
version: 2.1
|
3
|
+
|
4
|
+
orbs:
|
5
|
+
ruby: circleci/ruby@1.0
|
6
|
+
browser-tools: circleci/browser-tools@1.4.1
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
docker:
|
11
|
+
- image: cimg/ruby:3.2.2-browsers
|
12
|
+
auth:
|
13
|
+
username: mydockerhub-user
|
14
|
+
password: $DOCKERHUB_PASSWORD
|
15
|
+
- image: redis:6.2.6
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- checkout
|
19
|
+
- ruby/install-deps
|
20
|
+
- run:
|
21
|
+
name: Build assets
|
22
|
+
command: bundle exec rails assets:precompile
|
23
|
+
|
24
|
+
test:
|
25
|
+
parallelism: 1
|
26
|
+
docker:
|
27
|
+
- image: cimg/ruby:3.2.2-browsers
|
28
|
+
auth:
|
29
|
+
username: mydockerhub-user
|
30
|
+
password: $DOCKERHUB_PASSWORD
|
31
|
+
- image: redis:6.2.6
|
32
|
+
- image: cimg/postgres:13.7
|
33
|
+
auth:
|
34
|
+
username: mydockerhub-user
|
35
|
+
password: $DOCKERHUB_PASSWORD
|
36
|
+
environment:
|
37
|
+
POSTGRES_USER: circleci-demo-ruby
|
38
|
+
POSTGRES_DB: helios-dev-shop-test
|
39
|
+
POSTGRES_PASSWORD: ""
|
40
|
+
|
41
|
+
environment:
|
42
|
+
BUNDLE_JOBS: "3"
|
43
|
+
BUNDLE_RETRY: "3"
|
44
|
+
PGHOST: 127.0.0.1
|
45
|
+
PGUSER: circleci-demo-ruby
|
46
|
+
PGPASSWORD: ""
|
47
|
+
RAILS_ENV: test
|
48
|
+
|
49
|
+
steps:
|
50
|
+
- browser-tools/install-chrome
|
51
|
+
- browser-tools/install-chromedriver
|
52
|
+
- checkout
|
53
|
+
- ruby/install-deps
|
54
|
+
|
55
|
+
- run:
|
56
|
+
name: Wait for DB
|
57
|
+
command: dockerize -wait tcp://localhost:5432 -timeout 1m
|
58
|
+
|
59
|
+
- run:
|
60
|
+
name: Run system tests
|
61
|
+
command: script/test
|
62
|
+
|
63
|
+
- run:
|
64
|
+
name: Run internal tests
|
65
|
+
command: bundle exec rspec
|
66
|
+
|
67
|
+
workflows:
|
68
|
+
version: 2
|
69
|
+
build_and_test:
|
70
|
+
jobs:
|
71
|
+
- build
|
72
|
+
- test:
|
73
|
+
requires:
|
74
|
+
- build
|
data/.github/workflows/test.yml
CHANGED
@@ -3,6 +3,24 @@ on: [ push, pull_request ]
|
|
3
3
|
|
4
4
|
jobs:
|
5
5
|
internal_tests:
|
6
|
+
services:
|
7
|
+
# Label used to access the service container
|
8
|
+
postgres:
|
9
|
+
# Docker Hub image
|
10
|
+
image: postgres
|
11
|
+
# Provide the password for postgres
|
12
|
+
env:
|
13
|
+
POSTGRES_USER: postgres
|
14
|
+
POSTGRES_PASSWORD: postgres
|
15
|
+
POSTGRES_DB: test_database_name
|
16
|
+
ports:
|
17
|
+
- 5432:5432
|
18
|
+
# Set health checks to wait until postgres has started
|
19
|
+
options: >-
|
20
|
+
--health-cmd pg_isready
|
21
|
+
--health-interval 10s
|
22
|
+
--health-timeout 5s
|
23
|
+
--health-retries 5
|
6
24
|
runs-on: ubuntu-latest
|
7
25
|
steps:
|
8
26
|
- uses: actions/checkout@v3
|
@@ -12,19 +30,20 @@ jobs:
|
|
12
30
|
# Not needed with a .ruby-version file
|
13
31
|
# runs 'bundle install' and caches installed gems automatically
|
14
32
|
bundler-cache: true
|
15
|
-
-
|
16
|
-
|
33
|
+
- name: bundle install
|
34
|
+
run: cd dummy && bundle install && cd ..
|
35
|
+
|
36
|
+
- name: run tests
|
37
|
+
env:
|
38
|
+
RUBYOPT: "-W:no-deprecated -W:no-experimental" # Suppress Rails 6 deprecation warnings for ruby 2.7
|
39
|
+
RAILS_ENV: "test"
|
40
|
+
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/test_database_name"
|
41
|
+
|
42
|
+
run: |
|
43
|
+
cd dummy && bin/setup && cd ..
|
44
|
+
bundle install
|
45
|
+
bundle exec rspec --fail-fast --backtrace
|
46
|
+
|
47
|
+
|
17
48
|
|
18
49
|
|
19
|
-
system_tests:
|
20
|
-
runs-on: ubuntu-latest
|
21
|
-
steps:
|
22
|
-
- uses: actions/checkout@v3
|
23
|
-
- name: Set up Ruby
|
24
|
-
uses: ruby/setup-ruby@v1
|
25
|
-
with:
|
26
|
-
# Not needed with a .ruby-version file
|
27
|
-
# runs 'bundle install' and caches installed gems automatically
|
28
|
-
bundler-cache: true
|
29
|
-
- run: bundle install
|
30
|
-
- run: bundle exec script/test
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.2
|
data/Gemfile
CHANGED
@@ -17,8 +17,8 @@ gem "rspec-rails"
|
|
17
17
|
gem "factory_bot_rails"
|
18
18
|
gem "ffaker"
|
19
19
|
gem "capybara"
|
20
|
-
gem "selenium-webdriver"
|
21
|
-
gem "webdrivers"
|
20
|
+
gem "selenium-webdriver", "4.11.0"
|
21
|
+
# gem "webdrivers"
|
22
22
|
|
23
23
|
gem "sprockets-rails"
|
24
24
|
gem "importmap-rails"
|
@@ -29,3 +29,5 @@ gem "byebug"
|
|
29
29
|
gem "puma", "~> 5.0"
|
30
30
|
|
31
31
|
gem "devise"
|
32
|
+
|
33
|
+
gem "pg", "~> 1.5"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,280 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hot-glue (0.5.15)
|
5
|
+
ffaker (~> 2.16)
|
6
|
+
kaminari (~> 1.2)
|
7
|
+
rails (> 5.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actioncable (7.0.4)
|
13
|
+
actionpack (= 7.0.4)
|
14
|
+
activesupport (= 7.0.4)
|
15
|
+
nio4r (~> 2.0)
|
16
|
+
websocket-driver (>= 0.6.1)
|
17
|
+
actionmailbox (7.0.4)
|
18
|
+
actionpack (= 7.0.4)
|
19
|
+
activejob (= 7.0.4)
|
20
|
+
activerecord (= 7.0.4)
|
21
|
+
activestorage (= 7.0.4)
|
22
|
+
activesupport (= 7.0.4)
|
23
|
+
mail (>= 2.7.1)
|
24
|
+
net-imap
|
25
|
+
net-pop
|
26
|
+
net-smtp
|
27
|
+
actionmailer (7.0.4)
|
28
|
+
actionpack (= 7.0.4)
|
29
|
+
actionview (= 7.0.4)
|
30
|
+
activejob (= 7.0.4)
|
31
|
+
activesupport (= 7.0.4)
|
32
|
+
mail (~> 2.5, >= 2.5.4)
|
33
|
+
net-imap
|
34
|
+
net-pop
|
35
|
+
net-smtp
|
36
|
+
rails-dom-testing (~> 2.0)
|
37
|
+
actionpack (7.0.4)
|
38
|
+
actionview (= 7.0.4)
|
39
|
+
activesupport (= 7.0.4)
|
40
|
+
rack (~> 2.0, >= 2.2.0)
|
41
|
+
rack-test (>= 0.6.3)
|
42
|
+
rails-dom-testing (~> 2.0)
|
43
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
44
|
+
actiontext (7.0.4)
|
45
|
+
actionpack (= 7.0.4)
|
46
|
+
activerecord (= 7.0.4)
|
47
|
+
activestorage (= 7.0.4)
|
48
|
+
activesupport (= 7.0.4)
|
49
|
+
globalid (>= 0.6.0)
|
50
|
+
nokogiri (>= 1.8.5)
|
51
|
+
actionview (7.0.4)
|
52
|
+
activesupport (= 7.0.4)
|
53
|
+
builder (~> 3.1)
|
54
|
+
erubi (~> 1.4)
|
55
|
+
rails-dom-testing (~> 2.0)
|
56
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
57
|
+
activejob (7.0.4)
|
58
|
+
activesupport (= 7.0.4)
|
59
|
+
globalid (>= 0.3.6)
|
60
|
+
activemodel (7.0.4)
|
61
|
+
activesupport (= 7.0.4)
|
62
|
+
activerecord (7.0.4)
|
63
|
+
activemodel (= 7.0.4)
|
64
|
+
activesupport (= 7.0.4)
|
65
|
+
activestorage (7.0.4)
|
66
|
+
actionpack (= 7.0.4)
|
67
|
+
activejob (= 7.0.4)
|
68
|
+
activerecord (= 7.0.4)
|
69
|
+
activesupport (= 7.0.4)
|
70
|
+
marcel (~> 1.0)
|
71
|
+
mini_mime (>= 1.1.0)
|
72
|
+
activesupport (7.0.4)
|
73
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
74
|
+
i18n (>= 1.6, < 2)
|
75
|
+
minitest (>= 5.1)
|
76
|
+
tzinfo (~> 2.0)
|
77
|
+
addressable (2.8.1)
|
78
|
+
public_suffix (>= 2.0.2, < 6.0)
|
79
|
+
bcrypt (3.1.18)
|
80
|
+
builder (3.2.4)
|
81
|
+
byebug (11.1.3)
|
82
|
+
capybara (3.38.0)
|
83
|
+
addressable
|
84
|
+
matrix
|
85
|
+
mini_mime (>= 0.1.3)
|
86
|
+
nokogiri (~> 1.8)
|
87
|
+
rack (>= 1.6.0)
|
88
|
+
rack-test (>= 0.6.3)
|
89
|
+
regexp_parser (>= 1.5, < 3.0)
|
90
|
+
xpath (~> 3.2)
|
91
|
+
concurrent-ruby (1.1.10)
|
92
|
+
crass (1.0.6)
|
93
|
+
date (3.3.3)
|
94
|
+
devise (4.8.1)
|
95
|
+
bcrypt (~> 3.0)
|
96
|
+
orm_adapter (~> 0.1)
|
97
|
+
railties (>= 4.1.0)
|
98
|
+
responders
|
99
|
+
warden (~> 1.2.3)
|
100
|
+
diff-lcs (1.5.0)
|
101
|
+
docile (1.4.0)
|
102
|
+
erubi (1.11.0)
|
103
|
+
factory_bot (6.2.1)
|
104
|
+
activesupport (>= 5.0.0)
|
105
|
+
factory_bot_rails (6.2.0)
|
106
|
+
factory_bot (~> 6.2.0)
|
107
|
+
railties (>= 5.0.0)
|
108
|
+
ffaker (2.21.0)
|
109
|
+
globalid (1.0.0)
|
110
|
+
activesupport (>= 5.0)
|
111
|
+
i18n (1.12.0)
|
112
|
+
concurrent-ruby (~> 1.0)
|
113
|
+
importmap-rails (1.1.5)
|
114
|
+
actionpack (>= 6.0.0)
|
115
|
+
railties (>= 6.0.0)
|
116
|
+
kaminari (1.2.2)
|
117
|
+
activesupport (>= 4.1.0)
|
118
|
+
kaminari-actionview (= 1.2.2)
|
119
|
+
kaminari-activerecord (= 1.2.2)
|
120
|
+
kaminari-core (= 1.2.2)
|
121
|
+
kaminari-actionview (1.2.2)
|
122
|
+
actionview
|
123
|
+
kaminari-core (= 1.2.2)
|
124
|
+
kaminari-activerecord (1.2.2)
|
125
|
+
activerecord
|
126
|
+
kaminari-core (= 1.2.2)
|
127
|
+
kaminari-core (1.2.2)
|
128
|
+
loofah (2.19.0)
|
129
|
+
crass (~> 1.0.2)
|
130
|
+
nokogiri (>= 1.5.9)
|
131
|
+
mail (2.8.1)
|
132
|
+
mini_mime (>= 0.1.1)
|
133
|
+
net-imap
|
134
|
+
net-pop
|
135
|
+
net-smtp
|
136
|
+
marcel (1.0.2)
|
137
|
+
matrix (0.4.2)
|
138
|
+
method_source (1.0.0)
|
139
|
+
mini_mime (1.1.2)
|
140
|
+
mini_portile2 (2.8.4)
|
141
|
+
minitest (5.16.3)
|
142
|
+
net-imap (0.3.7)
|
143
|
+
date
|
144
|
+
net-protocol
|
145
|
+
net-pop (0.1.2)
|
146
|
+
net-protocol
|
147
|
+
net-protocol (0.2.1)
|
148
|
+
timeout
|
149
|
+
net-smtp (0.3.3)
|
150
|
+
net-protocol
|
151
|
+
nio4r (2.5.8)
|
152
|
+
nokogiri (1.13.9)
|
153
|
+
mini_portile2 (~> 2.8.0)
|
154
|
+
racc (~> 1.4)
|
155
|
+
orm_adapter (0.5.0)
|
156
|
+
pg (1.5.3)
|
157
|
+
public_suffix (5.0.0)
|
158
|
+
puma (5.6.5)
|
159
|
+
nio4r (~> 2.0)
|
160
|
+
racc (1.6.0)
|
161
|
+
rack (2.2.4)
|
162
|
+
rack-test (2.0.2)
|
163
|
+
rack (>= 1.3)
|
164
|
+
rails (7.0.4)
|
165
|
+
actioncable (= 7.0.4)
|
166
|
+
actionmailbox (= 7.0.4)
|
167
|
+
actionmailer (= 7.0.4)
|
168
|
+
actionpack (= 7.0.4)
|
169
|
+
actiontext (= 7.0.4)
|
170
|
+
actionview (= 7.0.4)
|
171
|
+
activejob (= 7.0.4)
|
172
|
+
activemodel (= 7.0.4)
|
173
|
+
activerecord (= 7.0.4)
|
174
|
+
activestorage (= 7.0.4)
|
175
|
+
activesupport (= 7.0.4)
|
176
|
+
bundler (>= 1.15.0)
|
177
|
+
railties (= 7.0.4)
|
178
|
+
rails-dom-testing (2.0.3)
|
179
|
+
activesupport (>= 4.2.0)
|
180
|
+
nokogiri (>= 1.6)
|
181
|
+
rails-html-sanitizer (1.4.3)
|
182
|
+
loofah (~> 2.3)
|
183
|
+
railties (7.0.4)
|
184
|
+
actionpack (= 7.0.4)
|
185
|
+
activesupport (= 7.0.4)
|
186
|
+
method_source
|
187
|
+
rake (>= 12.2)
|
188
|
+
thor (~> 1.0)
|
189
|
+
zeitwerk (~> 2.5)
|
190
|
+
rake (13.0.6)
|
191
|
+
regexp_parser (2.6.0)
|
192
|
+
responders (3.0.1)
|
193
|
+
actionpack (>= 5.0)
|
194
|
+
railties (>= 5.0)
|
195
|
+
rexml (3.2.6)
|
196
|
+
rspec-core (3.12.0)
|
197
|
+
rspec-support (~> 3.12.0)
|
198
|
+
rspec-expectations (3.12.0)
|
199
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
200
|
+
rspec-support (~> 3.12.0)
|
201
|
+
rspec-mocks (3.12.0)
|
202
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
203
|
+
rspec-support (~> 3.12.0)
|
204
|
+
rspec-rails (6.0.1)
|
205
|
+
actionpack (>= 6.1)
|
206
|
+
activesupport (>= 6.1)
|
207
|
+
railties (>= 6.1)
|
208
|
+
rspec-core (~> 3.11)
|
209
|
+
rspec-expectations (~> 3.11)
|
210
|
+
rspec-mocks (~> 3.11)
|
211
|
+
rspec-support (~> 3.11)
|
212
|
+
rspec-support (3.12.0)
|
213
|
+
rubyzip (2.3.2)
|
214
|
+
selenium-webdriver (4.11.0)
|
215
|
+
rexml (~> 3.2, >= 3.2.5)
|
216
|
+
rubyzip (>= 1.2.2, < 3.0)
|
217
|
+
websocket (~> 1.0)
|
218
|
+
simplecov (0.22.0)
|
219
|
+
docile (~> 1.1)
|
220
|
+
simplecov-html (~> 0.11)
|
221
|
+
simplecov_json_formatter (~> 0.1)
|
222
|
+
simplecov-html (0.12.3)
|
223
|
+
simplecov-rcov (0.3.1)
|
224
|
+
simplecov (>= 0.4.1)
|
225
|
+
simplecov_json_formatter (0.1.4)
|
226
|
+
sprockets (4.1.1)
|
227
|
+
concurrent-ruby (~> 1.0)
|
228
|
+
rack (> 1, < 3)
|
229
|
+
sprockets-rails (3.4.2)
|
230
|
+
actionpack (>= 5.2)
|
231
|
+
activesupport (>= 5.2)
|
232
|
+
sprockets (>= 3.0.0)
|
233
|
+
sqlite3 (1.5.3)
|
234
|
+
mini_portile2 (~> 2.8.0)
|
235
|
+
stimulus-rails (1.1.1)
|
236
|
+
railties (>= 6.0.0)
|
237
|
+
thor (1.2.1)
|
238
|
+
timeout (0.4.0)
|
239
|
+
turbo-rails (1.3.2)
|
240
|
+
actionpack (>= 6.0.0)
|
241
|
+
activejob (>= 6.0.0)
|
242
|
+
railties (>= 6.0.0)
|
243
|
+
tzinfo (2.0.5)
|
244
|
+
concurrent-ruby (~> 1.0)
|
245
|
+
warden (1.2.9)
|
246
|
+
rack (>= 2.0.9)
|
247
|
+
websocket (1.2.9)
|
248
|
+
websocket-driver (0.7.6)
|
249
|
+
websocket-extensions (>= 0.1.0)
|
250
|
+
websocket-extensions (0.1.5)
|
251
|
+
xpath (3.2.0)
|
252
|
+
nokogiri (~> 1.8)
|
253
|
+
zeitwerk (2.6.6)
|
254
|
+
|
255
|
+
PLATFORMS
|
256
|
+
arm64-darwin-21
|
257
|
+
arm64-darwin-22
|
258
|
+
x86_64-linux
|
259
|
+
|
260
|
+
DEPENDENCIES
|
261
|
+
byebug
|
262
|
+
capybara
|
263
|
+
devise
|
264
|
+
factory_bot_rails
|
265
|
+
ffaker
|
266
|
+
hot-glue!
|
267
|
+
importmap-rails
|
268
|
+
pg (~> 1.5)
|
269
|
+
puma (~> 5.0)
|
270
|
+
rake
|
271
|
+
rspec-rails
|
272
|
+
selenium-webdriver (= 4.11.0)
|
273
|
+
simplecov-rcov
|
274
|
+
sprockets-rails
|
275
|
+
sqlite3
|
276
|
+
stimulus-rails
|
277
|
+
turbo-rails
|
278
|
+
|
279
|
+
BUNDLED WITH
|
280
|
+
2.3.22
|
data/README.md
CHANGED
@@ -605,9 +605,7 @@ With Hot Glue in specified grouping or smart layout mode, it automatically attem
|
|
605
605
|
|
606
606
|
Using Bootstrap with neither specified grouping nor smart layouts may make more than 12 columns, which will produce strange results. (Bootstrap is not designed to work with, for example, a 13-column layout.)
|
607
607
|
|
608
|
-
You should typically either specify your grouping or use smart layouts when building with Bootstrap, but if your use case does not fit the stacking feature you can specify neither flag and then you may then have to deal with the over-stuffed layouts as explained.
|
609
|
-
|
610
|
-
|
608
|
+
You should typically either specify your grouping or use smart layouts when building with Bootstrap, but if your use case does not fit the stacking feature you can specify neither flag and then you may then have to deal with the over-stuffed layouts as explained.
|
611
609
|
|
612
610
|
### `--smart-layout` (also known as automatic grouping)
|
613
611
|
|
@@ -656,6 +654,26 @@ IMPORTANT: By default, all fields that begin with an underscore (`_`) are automa
|
|
656
654
|
|
657
655
|
This is for fields you want globally non-editable by users in your app. For example, a counter cache or other field set only by a backend mechanism.
|
658
656
|
|
657
|
+
### `--modify=field1{...},field2{...}`
|
658
|
+
|
659
|
+
|
660
|
+
You can apply modification to the viewable (non-edit) display of field using the `--modify` switch.
|
661
|
+
|
662
|
+
The syntax is `--modify=cost{$},price{$}`
|
663
|
+
|
664
|
+
Here, the `cost` and `price` fields will be displayed as wrapped in `number_to_currency()` when displayed on the list view and when displayed as show-only.
|
665
|
+
|
666
|
+
(You will need to separately specify them as show-only if you want them to be non-editable.)
|
667
|
+
|
668
|
+
The availabel modifiers are:
|
669
|
+
|
670
|
+
| modifier | what it does | can be used on | | |
|
671
|
+
|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|---|---|
|
672
|
+
| $ | wraps output in `number_to_currency()` | float, integer | | |
|
673
|
+
| truthy label\|falsy label | specify a binary switch with a pipe (\|) character if the value is truthy, it will display as "truthy label" if the value is falsy, it will display as "falsy label" | boolean, datetime, date, time | | |
|
674
|
+
| | | | | |
|
675
|
+
|
676
|
+
|
659
677
|
|
660
678
|
### `--update-show-only`
|
661
679
|
(separate field names by COMMA)
|
@@ -1253,14 +1271,25 @@ end
|
|
1253
1271
|
|
1254
1272
|
# VERSION HISTORY
|
1255
1273
|
|
1256
|
-
####
|
1274
|
+
#### 2023-08-17 - v0.5.16
|
1275
|
+
|
1276
|
+
- Adds `--modidy` flag to turn numbers into currency and apply binary labels (see docs for `--modify` flag)
|
1277
|
+
|
1278
|
+
#### 2023-08-11 - v0.5.15
|
1279
|
+
|
1257
1280
|
- When using big edit, updating a child will now re-render the parent EDIT record automatically.
|
1258
1281
|
|
1259
1282
|
For example
|
1283
|
+
`rails generate hot_glue:scafold Invoice --big-edit`
|
1260
1284
|
`rails generate hot_glue:scafold LineItem --nested=invioce`
|
1261
1285
|
|
1262
1286
|
Whenever the line item is created, updated, or destroyed, the parent invoice record gets (edit action) re-rendered automatically. This happens for the big edit screen of the invoice.
|
1263
1287
|
|
1288
|
+
- Refactors fields into polymoric objects
|
1289
|
+
|
1290
|
+
- Adds test coverage for Postgres Enums
|
1291
|
+
|
1292
|
+
|
1264
1293
|
#### 2023-05-14 - v0.5.14 Delete message flash notice and new flash notice partial
|
1265
1294
|
|
1266
1295
|
- This changes to how flash_notices work.
|
@@ -45,8 +45,11 @@ class FieldFactory
|
|
45
45
|
end
|
46
46
|
@class_name = class_name
|
47
47
|
|
48
|
-
|
49
48
|
@field = field_class.new(name: name,
|
49
|
+
layout_strategy: generator.layout_strategy,
|
50
|
+
form_placeholder_labels: generator.form_placeholder_labels,
|
51
|
+
form_labels_position: generator.form_labels_position,
|
52
|
+
ownership_field: generator.ownership_field,
|
50
53
|
hawk_keys: generator.hawk_keys,
|
51
54
|
auth: generator.auth,
|
52
55
|
class_name: generator.singular_class,
|
@@ -54,6 +57,7 @@ class FieldFactory
|
|
54
57
|
singular: generator.singular,
|
55
58
|
update_show_only: generator.update_show_only,
|
56
59
|
attachment_data: generator.attachments[name.to_sym],
|
57
|
-
sample_file_path: generator.sample_file_path
|
60
|
+
sample_file_path: generator.sample_file_path,
|
61
|
+
modify: generator.modify[name.to_sym] || nil )
|
58
62
|
end
|
59
63
|
end
|
@@ -3,10 +3,15 @@ require_relative './field.rb'
|
|
3
3
|
|
4
4
|
class AssociationField < Field
|
5
5
|
|
6
|
+
attr_accessor :assoc_name, :assoc_class, :assoc
|
7
|
+
|
6
8
|
def initialize(name: , class_name: , alt_lookups: , singular: , update_show_only: ,
|
7
|
-
hawk_keys: , auth: , sample_file_path:,
|
9
|
+
hawk_keys: , auth: , sample_file_path:, ownership_field: ,
|
10
|
+
attachment_data: nil , layout_strategy: , form_placeholder_labels: nil,
|
11
|
+
form_labels_position:, modify: )
|
8
12
|
super
|
9
|
-
|
13
|
+
|
14
|
+
@assoc_model = eval("#{class_name}.reflect_on_association(:#{assoc})")
|
10
15
|
|
11
16
|
if assoc_model.nil?
|
12
17
|
exit_message = "*** Oops: The model #{class_name} is missing an association for :#{assoc_name} or the model #{assoc_name.titlecase} doesn't exist. TODO: Please implement a model for #{assoc_name.titlecase}; or add to #{class_name} `belongs_to :#{assoc_name}`. To make a controller that can read all records, specify with --god."
|
@@ -14,9 +19,7 @@ class AssociationField < Field
|
|
14
19
|
raise(HotGlue::Error, exit_message)
|
15
20
|
end
|
16
21
|
|
17
|
-
|
18
|
-
assoc_class = eval(assoc_model.try(:class_name))
|
19
|
-
end
|
22
|
+
@assoc_class = eval(assoc_model.try(:class_name))
|
20
23
|
|
21
24
|
name_list = [:name, :to_label, :full_name, :display_name, :email]
|
22
25
|
|
@@ -27,7 +30,6 @@ class AssociationField < Field
|
|
27
30
|
raise(HotGlue::Error, exit_message)
|
28
31
|
end
|
29
32
|
|
30
|
-
# set teh assoc label
|
31
33
|
end
|
32
34
|
|
33
35
|
def assoc_label
|
@@ -73,4 +75,69 @@ class AssociationField < Field
|
|
73
75
|
|
74
76
|
" let!(:#{assoc}1) {create(:#{the_foreign_class}" + hawk_keys_on_lets + ")}"
|
75
77
|
end
|
78
|
+
|
79
|
+
def form_field_output
|
80
|
+
assoc_name = name.to_s.gsub("_id","")
|
81
|
+
assoc = eval("#{class_name}.reflect_on_association(:#{assoc_name})")
|
82
|
+
|
83
|
+
|
84
|
+
if @alt_lookups.keys.include?(name.to_s)
|
85
|
+
alt = @alt_lookups[name.to_s][:lookup_as]
|
86
|
+
"<%= f.text_field :__lookup_#{alt}, value: @#{singular}.#{assoc_name}.try(:#{alt}), placeholder: \"search by #{alt}\" %>"
|
87
|
+
else
|
88
|
+
if assoc.nil?
|
89
|
+
exit_message = "*** Oops. on the #{class_name} object, there doesn't seem to be an association called '#{assoc_name}'"
|
90
|
+
exit
|
91
|
+
end
|
92
|
+
|
93
|
+
is_owner = name == ownership_field
|
94
|
+
assoc_class_name = assoc.class_name.to_s
|
95
|
+
display_column = HotGlue.derrive_reference_name(assoc_class_name)
|
96
|
+
|
97
|
+
if hawk_keys[assoc.foreign_key.to_sym]
|
98
|
+
hawk_definition = hawk_keys[assoc.foreign_key.to_sym]
|
99
|
+
hawked_association = hawk_definition[:bind_to].join(".")
|
100
|
+
else
|
101
|
+
hawked_association = "#{assoc.class_name}.all"
|
102
|
+
end
|
103
|
+
|
104
|
+
(is_owner ? "<% unless @#{assoc_name} %>\n" : "") +
|
105
|
+
" <%= f.collection_select(:#{name}, #{hawked_association}, :id, :#{display_column}, {prompt: true, selected: @#{singular}.#{name} }, class: 'form-control') %>\n" +
|
106
|
+
(is_owner ? "<% else %>\n <%= @#{assoc_name}.#{display_column} %>" : "") +
|
107
|
+
(is_owner ? "\n<% end %>" : "")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def field_error_name
|
112
|
+
name
|
113
|
+
end
|
114
|
+
|
115
|
+
def form_show_only_output
|
116
|
+
assoc_name = name.to_s.gsub("_id","")
|
117
|
+
assoc = eval("#{singular_class}.reflect_on_association(:#{assoc_name})")
|
118
|
+
if assoc.nil?
|
119
|
+
exit_message = "*** Oops. on the #{singular_class} object, there doesn't seem to be an association called '#{assoc_name}'"
|
120
|
+
exit
|
121
|
+
end
|
122
|
+
|
123
|
+
is_owner = name == ownership_field
|
124
|
+
assoc_class_name = assoc.class_name.to_s
|
125
|
+
display_column = HotGlue.derrive_reference_name(assoc_class_name)
|
126
|
+
|
127
|
+
if hawk_keys[assoc.foreign_key.to_sym]
|
128
|
+
hawk_definition = hawk_keys[assoc.foreign_key.to_sym]
|
129
|
+
hawked_association = hawk_definition.join(".")
|
130
|
+
else
|
131
|
+
hawked_association = "#{assoc.class_name}.all"
|
132
|
+
end
|
133
|
+
"<%= #{singular}.#{assoc_name}.#{display_column} %>"
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
def line_field_output
|
138
|
+
|
139
|
+
display_column = HotGlue.derrive_reference_name(assoc_class.to_s)
|
140
|
+
|
141
|
+
"<%= #{singular}.#{assoc}.try(:#{display_column}) || '<span class=\"content alert-danger\">MISSING</span>'.html_safe %>"
|
142
|
+
end
|
76
143
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
class AttachmentField < Field
|
2
2
|
attr_accessor :attachment_data
|
3
3
|
def initialize(name:, class_name:, alt_lookups:, singular:, update_show_only:, hawk_keys:, auth:,
|
4
|
-
sample_file_path: nil, attachment_data:
|
4
|
+
sample_file_path: nil, attachment_data:, ownership_field:, layout_strategy: ,
|
5
|
+
form_placeholder_labels: , form_labels_position:, modify: )
|
5
6
|
super
|
7
|
+
|
6
8
|
@attachment_data = attachment_data
|
7
9
|
end
|
8
10
|
|
@@ -30,7 +32,9 @@ class AttachmentField < Field
|
|
30
32
|
return field_result
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
34
|
-
|
35
|
+
def line_field_output
|
36
|
+
thumbnail = attachment_data[:thumbnail]
|
37
|
+
|
38
|
+
(thumbnail ? "<%= #{singular}.#{name}.attached? ? image_tag(#{singular}.#{name}.variant(:#{thumbnail})) : '' %>" : "")
|
35
39
|
end
|
36
40
|
end
|