coprl 3.0.0.beta.4 → 3.0.0.beta.8
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/.circleci/config.yml +11 -16
- data/.ruby-version +1 -1
- data/CHANGELOG.md +37 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +43 -47
- data/README.md +3 -3
- data/app/demo/components/dialogs.pom +1 -1
- data/app/demo/components/snackbar.pom +9 -3
- data/app/demo/events/content_as_form.pom +3 -3
- data/app/demo/events/halted.pom +23 -0
- data/app/demo/events/nav/drawer.pom +1 -1
- data/app/demo/events/tagged_input.pom +2 -2
- data/app/demo/patterns/search_select.pom +1 -1
- data/coprl.gemspec +1 -2
- data/lib/coprl/presenters/dsl/components/actions/base.rb +5 -1
- data/lib/coprl/presenters/dsl/components/base.rb +6 -4
- data/lib/coprl/presenters/dsl/components/multi_select.rb +3 -3
- data/lib/coprl/presenters/dsl/components/table.rb +2 -2
- data/lib/coprl/presenters/dsl/definition.rb +2 -2
- data/lib/coprl/presenters/dsl/user_interface.rb +2 -2
- data/lib/coprl/presenters/helpers/rails/routes.rb +14 -0
- data/lib/coprl/presenters/helpers/rails.rb +8 -6
- data/lib/coprl/presenters/rails/concerns/coprl_partial.rb +51 -0
- data/lib/coprl/presenters/rails/engine.rb +5 -0
- data/lib/coprl/presenters/rails/railtie.rb +6 -14
- data/lib/coprl/presenters/rails/reloader.rb +15 -0
- data/lib/coprl/presenters/version.rb +1 -1
- data/lib/coprl/presenters/web_client/helpers/headers.rb +8 -6
- data/lib/coprl/presenters/web_client/helpers/rails/template_helper.rb +10 -0
- data/lib/coprl/presenters/web_client/helpers/rails.rb +1 -0
- data/lib/coprl/presenters/web_client/helpers/sinatra/template_helper.rb +20 -0
- data/lib/coprl/presenters/web_client/helpers/sinatra.rb +1 -0
- data/lib/coprl/presenters/web_client/plugin_views_path.rb +5 -5
- data/public/bundle.js +10 -4
- data/public/wc.js +10 -4
- data/rails-engine/app/controllers/coprl_controller.rb +0 -17
- data/rails-engine/app/views/layouts/coprl.html.erb +4 -4
- data/rails-engine/config/initializers/presenters.rb +4 -2
- data/rails-engine/config/initializers/routes.rb +5 -0
- data/views/mdc/assets/js/components/events/posts.js +10 -6
- data/views/mdc/body/{_preamble.erb → _wrapper.erb} +16 -5
- data/views/mdc/components/_card.erb +2 -2
- data/views/mdc/components/_checkbox.erb +1 -1
- data/views/mdc/components/_chip.erb +2 -2
- data/views/mdc/components/_content.erb +2 -2
- data/views/mdc/components/_datetime.erb +1 -1
- data/views/mdc/components/_dialog.erb +2 -2
- data/views/mdc/components/_form.erb +2 -2
- data/views/mdc/components/_grid.erb +2 -2
- data/views/mdc/components/_hidden_field.erb +1 -1
- data/views/mdc/components/_multi_select.erb +1 -1
- data/views/mdc/components/_number_field.erb +1 -1
- data/views/mdc/components/_radio_button.erb +1 -1
- data/views/mdc/components/_rich_text_area.erb +1 -1
- data/views/mdc/components/_select.erb +1 -1
- data/views/mdc/components/_slider.erb +2 -2
- data/views/mdc/components/_stepper.erb +4 -4
- data/views/mdc/components/_switch.erb +1 -1
- data/views/mdc/components/_text_area.erb +1 -1
- data/views/mdc/components/_text_field.erb +1 -1
- data/views/mdc/components/buttons/_image.erb +1 -1
- data/views/mdc/layout.erb +4 -4
- metadata +17 -26
- data/app/demo/components/snackbar_attached.pom +0 -6
- data/views/mdc/body/_postamble.erb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75ce54746d2a84764c59cef17d5a95716ecb0fdf677fba2067443d75c3c16ddd
|
4
|
+
data.tar.gz: be6092483bcb43bfe4d46ac3834fdaedc1b8ecc69ce2f6c6ad18d7e86d88f69f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 595b2f2af38f2683ba51cf4380d683a995dd007802e1b433f61d8197c8fb7893a03a67e9937d5c0f16a978ab4dfaffd0bc2d93762a993f93691d84269d41524b
|
7
|
+
data.tar.gz: 12bbdfc968bde0e12e70d40a94574323d72214fbc9bd5d9a20e0c6d5ee91804ba7f07d58070a6ae79cf51c5e14b3116a26809d01ce4722101cda2e8682986136
|
data/.circleci/config.yml
CHANGED
@@ -7,7 +7,7 @@ jobs:
|
|
7
7
|
build:
|
8
8
|
docker:
|
9
9
|
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.7.
|
10
|
+
- image: circleci/ruby:2.7.4-node-browsers
|
11
11
|
|
12
12
|
# Specify service dependencies here if necessary
|
13
13
|
# CircleCI maintains a library of pre-built images
|
@@ -18,28 +18,23 @@ jobs:
|
|
18
18
|
|
19
19
|
steps:
|
20
20
|
- checkout
|
21
|
-
|
22
|
-
# Download and cache dependencies
|
23
21
|
- restore_cache:
|
24
22
|
keys:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
- run:
|
30
|
-
|
31
|
-
|
32
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
33
|
-
|
23
|
+
# when lock file changes, use increasingly general patterns to restore cache
|
24
|
+
- v1-gem-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
|
25
|
+
- v1-gem-cache-{{ arch }}-{{ .Branch }}-
|
26
|
+
- v1-gem-cache-{{ arch }}-
|
27
|
+
- run: gem install bundler:2.2.20
|
28
|
+
- run: bundle install
|
29
|
+
- run: bundle clean --force
|
34
30
|
- save_cache:
|
35
31
|
paths:
|
36
|
-
-
|
37
|
-
key: v1-
|
38
|
-
|
32
|
+
- ~/.bundle
|
33
|
+
key: v1-gem-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
|
39
34
|
- run:
|
40
35
|
name: 'start integration testing server'
|
41
36
|
command: |
|
42
|
-
rackup
|
37
|
+
bundle exec rackup
|
43
38
|
background: true
|
44
39
|
|
45
40
|
# run tests!
|
data/.ruby-version
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.4
|
2
2
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
# [3.0.0-beta.8](https://github.com/rx/presenters/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-09-17)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* added check for engine coprl_presenters_rails_engine_url ([d2ee7b5](https://github.com/rx/presenters/commit/d2ee7b5900a256c30e6715d1246639dec682ff08))
|
7
|
+
|
8
|
+
# [3.0.0-beta.7](https://github.com/rx/presenters/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-07-09)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* Rails routes automatically made available as helpers ([#322](https://github.com/rx/presenters/issues/322)) ([abb0031](https://github.com/rx/presenters/commit/abb00311940fda8741459f8aafe29cd7bf074b88))
|
14
|
+
* view paths issue when using partials with Rails Engine ([#321](https://github.com/rx/presenters/issues/321)) ([2a917e7](https://github.com/rx/presenters/commit/2a917e7076895037e5a069e77525ef53d2ca45f1))
|
15
|
+
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
* switch to use Rails built-in watchers and reloader ([#320](https://github.com/rx/presenters/issues/320)) ([53e0ee4](https://github.com/rx/presenters/commit/53e0ee49caa663ce93ff731c280bcd754da73fc1))
|
20
|
+
|
21
|
+
# [3.0.0-beta.6](https://github.com/rx/presenters/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-06-23)
|
22
|
+
|
23
|
+
|
24
|
+
### Bug Fixes
|
25
|
+
|
26
|
+
* fixed typo on if check ([95b3091](https://github.com/rx/presenters/commit/95b3091365a853eee24e4bce0e37b182da1fdc3d))
|
27
|
+
* small tweaks to simplify the presenters wrappers ([#319](https://github.com/rx/presenters/issues/319)) ([cbf0c7c](https://github.com/rx/presenters/commit/cbf0c7c4c80d68ecc84a2989934d2d02e8a1a928))
|
28
|
+
|
29
|
+
# [3.0.0-beta.5](https://github.com/rx/presenters/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-06-18)
|
30
|
+
|
31
|
+
|
32
|
+
### Bug Fixes
|
33
|
+
|
34
|
+
* add Rack > 2.2.2 support ([c39c18d](https://github.com/rx/presenters/commit/c39c18d48c557f9f206396eb73e20f15b0a85e7e))
|
35
|
+
* add Rack > 2.2.2 support ([6e23287](https://github.com/rx/presenters/commit/6e232875d1ea3c4250f9e19e841215a750082ffc))
|
36
|
+
* native rails tag helper conflicts with base components tag method. ([c9d3847](https://github.com/rx/presenters/commit/c9d3847405ab53c1ba728bf9f2afac655f0b1c1f))
|
37
|
+
|
1
38
|
# [3.0.0-beta.4](https://github.com/rx/presenters/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-06-15)
|
2
39
|
|
3
40
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -12,7 +12,7 @@ GIT
|
|
12
12
|
|
13
13
|
GIT
|
14
14
|
remote: https://github.com/coprl/chart_presenter_plugin.git
|
15
|
-
revision:
|
15
|
+
revision: 6b93c7a1b04356987cbe962841f564f4afc744c4
|
16
16
|
specs:
|
17
17
|
chart_presenter_plugin (0.1.0)
|
18
18
|
|
@@ -24,32 +24,32 @@ GIT
|
|
24
24
|
|
25
25
|
GIT
|
26
26
|
remote: https://github.com/coprl/color_picker_presenter_plugin.git
|
27
|
-
revision:
|
27
|
+
revision: 10bdc8b555b2c168ee1d93316c7b10e961a7f5b5
|
28
28
|
specs:
|
29
29
|
color_picker_presenter_plugin (0.0.1)
|
30
30
|
|
31
31
|
GIT
|
32
32
|
remote: https://github.com/coprl/foo_presenter_plugin.git
|
33
|
-
revision:
|
33
|
+
revision: 6f1d796bf030bf69fca87777d28bdee63e9880d8
|
34
34
|
specs:
|
35
35
|
foo_presenter_plugin (0.0.2)
|
36
36
|
|
37
37
|
GIT
|
38
38
|
remote: https://github.com/coprl/google_maps_presenter_plugin.git
|
39
|
-
revision:
|
39
|
+
revision: 53d8d4d778fcc0295980aaae29bbc3fdb3a947d4
|
40
40
|
branch: main
|
41
41
|
specs:
|
42
42
|
google_maps_presenter_plugin (0.1.0)
|
43
43
|
|
44
44
|
GIT
|
45
45
|
remote: https://github.com/coprl/iframe_presenter_plugin.git
|
46
|
-
revision:
|
46
|
+
revision: d0bc691adba4807499af30ee375e9b6dd1426732
|
47
47
|
specs:
|
48
48
|
iframe_presenter_plugin (0.0.1)
|
49
49
|
|
50
50
|
GIT
|
51
51
|
remote: https://github.com/coprl/image_crop_presenter_plugin.git
|
52
|
-
revision:
|
52
|
+
revision: 586ef47bd6132f94810cfb04d02fcf7c9df1ae10
|
53
53
|
specs:
|
54
54
|
image_crop_presenter_plugin (0.1.0)
|
55
55
|
|
@@ -67,24 +67,23 @@ GIT
|
|
67
67
|
|
68
68
|
GIT
|
69
69
|
remote: https://github.com/coprl/scroll_to_presenter_plugin.git
|
70
|
-
revision:
|
70
|
+
revision: c34ab770665a16b81b8274357dd9cc77dbd0a566
|
71
71
|
specs:
|
72
72
|
scroll_to_presenter_plugin (0.0.2)
|
73
73
|
|
74
74
|
GIT
|
75
75
|
remote: https://github.com/coprl/timer_presenter_plugin.git
|
76
|
-
revision:
|
76
|
+
revision: 5901fd1a368ae7b293c0b87f58ebd01a24a38573
|
77
77
|
specs:
|
78
78
|
timer_presenter_plugin (0.0.1)
|
79
79
|
|
80
80
|
PATH
|
81
81
|
remote: .
|
82
82
|
specs:
|
83
|
-
coprl (
|
83
|
+
coprl (3.0.0.beta.8)
|
84
84
|
dry-configurable (> 0.1, <= 7.0)
|
85
85
|
dry-container (~> 0.6)
|
86
86
|
dry-inflector (~> 0.1)
|
87
|
-
filewatcher (~> 1.1.1)
|
88
87
|
ice_nine (~> 0.11)
|
89
88
|
redcarpet (~> 3.4)
|
90
89
|
sinatra (>= 1.4, < 3.0)
|
@@ -98,35 +97,31 @@ GEM
|
|
98
97
|
byebug (11.1.3)
|
99
98
|
childprocess (3.0.0)
|
100
99
|
coderay (1.1.2)
|
101
|
-
concurrent-ruby (1.1.
|
102
|
-
diff-lcs (1.
|
100
|
+
concurrent-ruby (1.1.9)
|
101
|
+
diff-lcs (1.4.4)
|
103
102
|
docile (1.3.1)
|
104
103
|
dotenv (2.7.6)
|
105
|
-
dry-configurable (0.
|
104
|
+
dry-configurable (0.13.0)
|
106
105
|
concurrent-ruby (~> 1.0)
|
107
|
-
dry-core (~> 0.
|
108
|
-
dry-container (0.
|
106
|
+
dry-core (~> 0.6)
|
107
|
+
dry-container (0.9.0)
|
109
108
|
concurrent-ruby (~> 1.0)
|
110
|
-
dry-configurable (~> 0.
|
111
|
-
dry-core (0.
|
109
|
+
dry-configurable (~> 0.13, >= 0.13.0)
|
110
|
+
dry-core (0.7.1)
|
112
111
|
concurrent-ruby (~> 1.0)
|
113
|
-
dry-inflector (0.2.
|
114
|
-
filewatcher (1.1.1)
|
115
|
-
optimist (~> 3.0)
|
116
|
-
gem-release (2.0.1)
|
112
|
+
dry-inflector (0.2.1)
|
117
113
|
ice_nine (0.11.2)
|
118
114
|
json (2.3.1)
|
119
115
|
method_source (0.9.0)
|
120
|
-
mini_portile2 (2.5.
|
116
|
+
mini_portile2 (2.5.3)
|
121
117
|
mustermann (1.1.1)
|
122
118
|
ruby2_keywords (~> 0.0.1)
|
123
119
|
nio4r (2.5.7)
|
124
|
-
nokogiri (1.11.
|
120
|
+
nokogiri (1.11.7)
|
125
121
|
mini_portile2 (~> 2.5.0)
|
126
122
|
racc (~> 1.4)
|
127
|
-
nokogiri (1.11.
|
123
|
+
nokogiri (1.11.7-x86_64-darwin)
|
128
124
|
racc (~> 1.4)
|
129
|
-
optimist (3.0.1)
|
130
125
|
pry (0.11.3)
|
131
126
|
coderay (~> 1.1.0)
|
132
127
|
method_source (~> 0.9.0)
|
@@ -145,27 +140,27 @@ GEM
|
|
145
140
|
rack (>= 1.0, < 3)
|
146
141
|
rake (13.0.1)
|
147
142
|
redcarpet (3.5.1)
|
148
|
-
regexp_parser (1.
|
149
|
-
rspec (3.
|
150
|
-
rspec-core (~> 3.
|
151
|
-
rspec-expectations (~> 3.
|
152
|
-
rspec-mocks (~> 3.
|
153
|
-
rspec-core (3.
|
154
|
-
rspec-support (~> 3.
|
155
|
-
rspec-expectations (3.
|
143
|
+
regexp_parser (2.1.1)
|
144
|
+
rspec (3.10.0)
|
145
|
+
rspec-core (~> 3.10.0)
|
146
|
+
rspec-expectations (~> 3.10.0)
|
147
|
+
rspec-mocks (~> 3.10.0)
|
148
|
+
rspec-core (3.10.1)
|
149
|
+
rspec-support (~> 3.10.0)
|
150
|
+
rspec-expectations (3.10.1)
|
156
151
|
diff-lcs (>= 1.2.0, < 2.0)
|
157
|
-
rspec-support (~> 3.
|
152
|
+
rspec-support (~> 3.10.0)
|
158
153
|
rspec-html-matchers (0.9.1)
|
159
154
|
nokogiri (~> 1)
|
160
155
|
rspec (>= 3.0.0.a, < 4)
|
161
|
-
rspec-mocks (3.
|
156
|
+
rspec-mocks (3.10.2)
|
162
157
|
diff-lcs (>= 1.2.0, < 2.0)
|
163
|
-
rspec-support (~> 3.
|
164
|
-
rspec-support (3.
|
158
|
+
rspec-support (~> 3.10.0)
|
159
|
+
rspec-support (3.10.2)
|
165
160
|
rspec_junit_formatter (0.4.1)
|
166
161
|
rspec-core (>= 2, < 4, != 2.12.0)
|
167
|
-
ruby2_keywords (0.0.
|
168
|
-
rubyzip (
|
162
|
+
ruby2_keywords (0.0.5)
|
163
|
+
rubyzip (2.3.0)
|
169
164
|
selenium-webdriver (3.142.7)
|
170
165
|
childprocess (>= 0.5, < 4.0)
|
171
166
|
rubyzip (>= 1.2.2)
|
@@ -183,19 +178,20 @@ GEM
|
|
183
178
|
tilt (~> 2.0)
|
184
179
|
thor (1.1.0)
|
185
180
|
tilt (2.0.10)
|
181
|
+
timecop (0.9.4)
|
186
182
|
tzinfo (2.0.4)
|
187
183
|
concurrent-ruby (~> 1.0)
|
188
184
|
tzinfo-data (1.2021.1)
|
189
185
|
tzinfo (>= 1.0.0)
|
190
|
-
watir (6.
|
191
|
-
regexp_parser (
|
192
|
-
selenium-webdriver (
|
186
|
+
watir (6.19.1)
|
187
|
+
regexp_parser (>= 1.2, < 3)
|
188
|
+
selenium-webdriver (>= 3.142.7)
|
193
189
|
watir-rspec (3.0.0)
|
194
190
|
rspec (~> 3.0)
|
195
191
|
watir (>= 6.0.0.beta4)
|
196
|
-
webdrivers (4.
|
192
|
+
webdrivers (4.6.0)
|
197
193
|
nokogiri (~> 1.6)
|
198
|
-
rubyzip (
|
194
|
+
rubyzip (>= 1.3.0)
|
199
195
|
selenium-webdriver (>= 3.0, < 4.0)
|
200
196
|
zeitwerk (2.4.2)
|
201
197
|
|
@@ -213,7 +209,6 @@ DEPENDENCIES
|
|
213
209
|
coprl!
|
214
210
|
dotenv
|
215
211
|
foo_presenter_plugin!
|
216
|
-
gem-release (~> 2.0)
|
217
212
|
google_maps_presenter_plugin!
|
218
213
|
iframe_presenter_plugin!
|
219
214
|
image_crop_presenter_plugin!
|
@@ -233,13 +228,14 @@ DEPENDENCIES
|
|
233
228
|
shotgun (~> 0.9)
|
234
229
|
simplecov
|
235
230
|
thor (~> 1.1.0)
|
231
|
+
timecop (~> 0.9.4)
|
236
232
|
timer_presenter_plugin!
|
237
|
-
watir (~> 6.
|
233
|
+
watir (~> 6.19)
|
238
234
|
watir-rspec (~> 3.0)
|
239
235
|
webdrivers (~> 4.1)
|
240
236
|
|
241
237
|
RUBY VERSION
|
242
|
-
ruby 2.7.
|
238
|
+
ruby 2.7.4p191
|
243
239
|
|
244
240
|
BUNDLED WITH
|
245
241
|
2.2.20
|
data/README.md
CHANGED
@@ -101,13 +101,13 @@ You need to add the following to your layout to use presenters as a partial alon
|
|
101
101
|
##### Inside the <head> tag add the following:
|
102
102
|
|
103
103
|
<title><%= @pom.page.title if @pom.page %></title>
|
104
|
-
<%= coprl_headers
|
104
|
+
<%= coprl_headers %>
|
105
105
|
|
106
106
|
##### Inside the <body> tag, around you existing yield add the following:
|
107
107
|
|
108
|
-
<%=
|
108
|
+
<%= with_presenters_wrapper do %>
|
109
109
|
<%= yield %>
|
110
|
-
<%=
|
110
|
+
<%= end %>
|
111
111
|
|
112
112
|
### Rack
|
113
113
|
#### 1) To use it, add this line to your Gemfile:
|
@@ -170,7 +170,7 @@ Coprl::Presenters.define(:dialogs) do
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
separator
|
173
|
-
content
|
173
|
+
content input_tag: :second_form_input do
|
174
174
|
dlg_form
|
175
175
|
end
|
176
176
|
subtitle 'The buttons below are Dialog Action buttons. When clicked, they will process any configured actions, then automatically clsoe the dialog.'
|
@@ -8,10 +8,10 @@ Coprl::Presenters.define(:snackbar) do
|
|
8
8
|
|
9
9
|
indented_grid do
|
10
10
|
title 'On Page'
|
11
|
-
body 'You can attach a snackbar on the server side and will render after load.'
|
11
|
+
body 'You can invoke or attach a snackbar on the server side and will render after load.'
|
12
12
|
snackbar 'Top Level Important Information!'
|
13
|
-
|
14
|
-
attach :snackbar_attached
|
13
|
+
# This is the same as above -- see POM at end of file
|
14
|
+
# attach :snackbar_attached
|
15
15
|
|
16
16
|
title 'As Event'
|
17
17
|
button 'Show Snackbar', id: :show_snackbar do
|
@@ -33,3 +33,9 @@ Coprl::Presenters.define(:snackbar) do
|
|
33
33
|
|
34
34
|
attach :code, file: __FILE__
|
35
35
|
end
|
36
|
+
|
37
|
+
# Coprl::Presenters.define(:snackbar_attached) do
|
38
|
+
# title 'In Attached'
|
39
|
+
# body 'This can be done in an attached presenter as well'
|
40
|
+
# snackbar 'Attached Snackbar Displayed!'
|
41
|
+
# end
|
@@ -118,7 +118,7 @@ Coprl::Presenters.define(:content_as_form) do
|
|
118
118
|
|
119
119
|
grid do
|
120
120
|
column 12 do
|
121
|
-
text_field id: :input_tag_extra, name: :whatever,
|
121
|
+
text_field id: :input_tag_extra, name: :whatever, input_tag: :test_input_tag do
|
122
122
|
value 'foo bar'
|
123
123
|
end
|
124
124
|
end
|
@@ -127,7 +127,7 @@ Coprl::Presenters.define(:content_as_form) do
|
|
127
127
|
indented_grid do
|
128
128
|
card do
|
129
129
|
title 'Content with input_tag'
|
130
|
-
content id: :content_2,
|
130
|
+
content id: :content_2, input_tag: :test_input_tag do
|
131
131
|
text_field name: :text1 do
|
132
132
|
label 'Text 1'
|
133
133
|
end
|
@@ -275,7 +275,7 @@ end
|
|
275
275
|
|
276
276
|
Coprl::Presenters.define(:dialog_c) do
|
277
277
|
dialog id: :dialog_c do
|
278
|
-
content
|
278
|
+
content input_tag: :some_dialog_tag do
|
279
279
|
text_field name: :dialog_text_field do
|
280
280
|
value 'whatever'
|
281
281
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Coprl::Presenters.define(:halted) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
display 'Halted Events'
|
8
|
+
body 'This demonstrates how to respond to failed, or halted events'
|
9
|
+
|
10
|
+
content do
|
11
|
+
button :failed_post do
|
12
|
+
event :click do
|
13
|
+
posts '_echo_', status: 500
|
14
|
+
end
|
15
|
+
event 'V:eventsHalted' do
|
16
|
+
snackbar 'That did not work! Please try again later.'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
attach :code, file: __FILE__
|
23
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Coprl::Presenters.define(:events_drawer) do
|
2
2
|
helpers Coprl::Presenters::Helpers::Inflector
|
3
3
|
|
4
|
-
events = %i[field_level_events form_level_events tagged_input parallel_events].sort
|
4
|
+
events = %i[field_level_events form_level_events tagged_input parallel_events halted].sort
|
5
5
|
actions = %i[dialog replaces loads toggle_visibility snackbar updates deletes posts clear last_response prompt_if_dirty].sort
|
6
6
|
|
7
7
|
drawer 'Events' do
|
@@ -18,11 +18,11 @@ Coprl::Presenters.define(:tagged_input) do
|
|
18
18
|
|
19
19
|
title 'Example'
|
20
20
|
|
21
|
-
content
|
21
|
+
content input_tag: :somefields do
|
22
22
|
radio_button text: :on, name: :check_me, value: :on, checked: true
|
23
23
|
radio_button text: :off, name: :check_me, value: :off
|
24
24
|
end
|
25
|
-
text_field name: :myfield2,
|
25
|
+
text_field name: :myfield2, input_tag: :somefields do
|
26
26
|
label 'More Data to post'
|
27
27
|
end
|
28
28
|
|
data/coprl.gemspec
CHANGED
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_runtime_dependency 'tzinfo', '>=1.1', '< 3.0'
|
29
29
|
spec.add_runtime_dependency 'tzinfo-data', '~>1.2018'
|
30
30
|
spec.add_runtime_dependency 'redcarpet', '~>3.4'
|
31
|
-
spec.add_runtime_dependency 'filewatcher', '~> 1.1.1'
|
32
31
|
spec.add_runtime_dependency 'zeitwerk', '~> 2.1'
|
33
32
|
|
34
33
|
spec.add_development_dependency 'thor', '~> 1.1.0'
|
@@ -38,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
38
37
|
spec.add_development_dependency 'bundler', '>= 1.13'
|
39
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
40
39
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
41
|
-
spec.add_development_dependency 'gem-release', '~> 2.0'
|
42
40
|
spec.add_development_dependency 'shotgun', '~> 0.9'
|
41
|
+
spec.add_development_dependency 'timecop', '~> 0.9.4 '
|
43
42
|
end
|
@@ -25,10 +25,14 @@ module Coprl
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def extract_options!
|
28
|
-
%i(path presenter target
|
28
|
+
%i(path presenter target headers).each do |option|
|
29
29
|
option_value = attribs.delete(option){:not_found}
|
30
30
|
@options.merge!({option => option_value}) unless option_value==:not_found
|
31
31
|
end
|
32
|
+
# Special case ... the input tag is defined at the component base level for all components
|
33
|
+
# By the time we get here we have put it into its accessor via the super call
|
34
|
+
# So we manually move it to the options for all actions
|
35
|
+
@options.merge!(input_tag: self.input_tag) if self.input_tag
|
32
36
|
end
|
33
37
|
|
34
38
|
def extract_dynamic_params(hash)
|
@@ -15,16 +15,19 @@ module Coprl
|
|
15
15
|
include Mixins::YieldTo
|
16
16
|
extend Pluggable
|
17
17
|
|
18
|
-
attr_reader :type, :id, :
|
18
|
+
attr_reader :type, :id, :input_tag, :attributes, :draggable, :drop_zone, :css_class
|
19
19
|
|
20
20
|
alias attribs attributes
|
21
21
|
|
22
|
-
def initialize(type:, parent:, id: nil, tag: nil, **attributes, &block)
|
22
|
+
def initialize(type:, parent:, id: nil, tag: nil, input_tag: nil, **attributes, &block)
|
23
23
|
@draggable = attributes.delete(:draggable) {nil}
|
24
24
|
@drop_zone = attributes.delete(:drop_zone) {nil}
|
25
25
|
@css_class = Array(attributes.delete(:class) {nil})
|
26
26
|
@id = id || generate_id
|
27
|
-
@
|
27
|
+
@input_tag = input_tag || tag
|
28
|
+
logger.warn(
|
29
|
+
'The `tag` attribute is deprecated. ' \
|
30
|
+
'Please use `input_tag` instead. This will change in a future feature release.') unless tag.nil?
|
28
31
|
@type = type
|
29
32
|
@parent = parent
|
30
33
|
@attributes = attributes
|
@@ -72,7 +75,6 @@ module Coprl
|
|
72
75
|
|
73
76
|
alias params context
|
74
77
|
|
75
|
-
|
76
78
|
def yield_block
|
77
79
|
return @_yield_block_ if @_yield_block_
|
78
80
|
@parent.send(:yield_block)
|
@@ -16,8 +16,8 @@ module Coprl
|
|
16
16
|
def check_option(**attribs, &block)
|
17
17
|
@options << CheckOption.new(parent: self,
|
18
18
|
name: @name,
|
19
|
-
|
20
|
-
**attribs.delete_if{ |k,v| [:tag, :name].include?(k) }, &block)
|
19
|
+
input_tag: @input_tag,
|
20
|
+
**attribs.delete_if{ |k,v| [:tag, :name, :input_tag].include?(k) }, &block)
|
21
21
|
end
|
22
22
|
|
23
23
|
class CheckOption < EventBase
|
@@ -33,7 +33,7 @@ module Coprl
|
|
33
33
|
self.checkbox(name: "#{attribs[:name]}[]",
|
34
34
|
value: @value,
|
35
35
|
text: @text,
|
36
|
-
|
36
|
+
input_tag: self.input_tag,
|
37
37
|
checked: @selected,
|
38
38
|
disabled: @disabled,
|
39
39
|
&block)
|
@@ -58,10 +58,10 @@ module Coprl
|
|
58
58
|
def checkbox(**attributes, &block)
|
59
59
|
return @checkbox if locked?
|
60
60
|
field_name = @type == :header ? 'all' : "#{attributes.delete(:name)}[]"
|
61
|
-
tag = @type == :header ? '' : @parent.
|
61
|
+
tag = @type == :header ? '' : @parent.input_tag
|
62
62
|
@checkbox = Components::Checkbox.new(parent: self,
|
63
63
|
name: field_name,
|
64
|
-
|
64
|
+
input_tag: tag,
|
65
65
|
**attributes,
|
66
66
|
&block)
|
67
67
|
end
|
@@ -17,8 +17,8 @@ module Coprl
|
|
17
17
|
self
|
18
18
|
end
|
19
19
|
|
20
|
-
def expand(router: , context:{}, &block)
|
21
|
-
presenter = UserInterface.new(router: router, context: context,
|
20
|
+
def expand(router: , context:{}, plugins: [], &block)
|
21
|
+
presenter = UserInterface.new(router: router, context: context, plugins: plugins, name: @name, namespace: @namespace, &@block)
|
22
22
|
yield(presenter) if block
|
23
23
|
presenter.expand_instance
|
24
24
|
end
|
@@ -25,7 +25,7 @@ module Coprl
|
|
25
25
|
private :context, :router, :namespace
|
26
26
|
alias params context
|
27
27
|
|
28
|
-
def initialize(context:, parent: nil, router: nil, name: nil, namespace: [], &block)
|
28
|
+
def initialize(context:, parent: nil, router: nil, name: nil, plugins: [], namespace: [], &block)
|
29
29
|
@parent = parent
|
30
30
|
@router = router || @parent&.send(:router)
|
31
31
|
@context = context || {}
|
@@ -36,7 +36,7 @@ module Coprl
|
|
36
36
|
@footer = nil
|
37
37
|
@name = name
|
38
38
|
@namespace = namespace
|
39
|
-
@plugins = []
|
39
|
+
@plugins = plugins || []
|
40
40
|
@csrf_meta_tags = authenticity_token_meta_tags(@context.fetch(:session, nil))
|
41
41
|
add_global_helpers
|
42
42
|
initialize_plugins
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Coprl
|
2
|
+
module Presenters
|
3
|
+
module Helpers
|
4
|
+
module Rails
|
5
|
+
module Routes
|
6
|
+
include ::Rails.application.routes.url_helpers
|
7
|
+
def default_url_options
|
8
|
+
::Rails.application.config.action_controller.default_url_options || { :host => context[:request].host_with_port }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -6,18 +6,20 @@ if defined?(Rails)
|
|
6
6
|
include ActionView::Helpers::AssetUrlHelper
|
7
7
|
include Coprl::Presenters::Helpers::Rails::Currency
|
8
8
|
include Coprl::Presenters::Helpers::Rails::ModelTable
|
9
|
+
include Coprl::Presenters::Helpers::Rails::Routes
|
9
10
|
include Namespace
|
10
11
|
|
11
|
-
def default_url_options
|
12
|
-
{}
|
13
|
-
end
|
14
|
-
|
15
12
|
def presenters_path(presenter, host: false, **params)
|
16
13
|
presenter = _expand_namespace_(presenter, namespace)
|
17
14
|
presenter = presenter.gsub(':', '/')
|
18
15
|
|
19
|
-
path =
|
20
|
-
|
16
|
+
path = if defined?(coprl_presenters_rails_engine_url)
|
17
|
+
host ? coprl_presenters_rails_engine_url(params, host: router.base_url) :
|
18
|
+
coprl_presenters_rails_engine_path(params)
|
19
|
+
else
|
20
|
+
host ? coprl_presenters_web_client_app_url(params, host: router.base_url) :
|
21
|
+
coprl_presenters_web_client_app_path(params)
|
22
|
+
end
|
21
23
|
|
22
24
|
if path.include?('?')
|
23
25
|
path = path.sub('?', "#{presenter}?")
|