voom-presenters 0.1.5 → 0.1.6
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 +4 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +8 -0
- data/README.md +12 -0
- data/app/demo/components/date_fields.pom +96 -0
- data/app/demo/components/datetime_fields.pom +106 -0
- data/app/demo/components/nav/drawer.pom +1 -1
- data/app/demo/components/nav/menu.pom +1 -1
- data/app/demo/components/time_fields.pom +59 -0
- data/app/demo/components/toggles.pom +28 -1
- data/app/demo/events/actions/autocomplete.pom +32 -0
- data/app/demo/events/actions/deletes.pom +24 -0
- data/app/demo/events/actions/dialog.pom +19 -0
- data/app/demo/{event/actions/dialog → events/actions/dialogs}/show_dialog.pom +0 -0
- data/app/demo/{event/actions/dialog → events/actions/dialogs}/trigger.pom +0 -0
- data/app/demo/events/actions/loads.pom +19 -0
- data/app/demo/events/actions/posts.pom +23 -0
- data/app/demo/{event/new_text.pom → events/actions/replace_text.pom} +0 -0
- data/app/demo/events/actions/replaces.pom +21 -0
- data/app/demo/events/actions/snackbar.pom +19 -0
- data/app/demo/events/actions/toggle_visiblity.pom +21 -0
- data/app/demo/events/actions/updates.pom +24 -0
- data/app/demo/events/field_level.pom +20 -0
- data/app/demo/events/form_level.pom +24 -0
- data/app/demo/events/nav/drawer.pom +21 -0
- data/app/demo/events.pom +8 -77
- data/app/demo/formatting_tokens.pom +125 -0
- data/app/demo/index.pom +12 -5
- data/app/demo/markdown.pom +33 -40
- data/app/demo/shared/context_list.pom +2 -2
- data/app/demo/styles.pom +1 -0
- data/config.ru +9 -0
- data/lib/voom/presenters/dsl/components/base.rb +5 -0
- data/lib/voom/presenters/dsl/components/card.rb +2 -0
- data/lib/voom/presenters/dsl/components/content.rb +2 -0
- data/lib/voom/presenters/dsl/components/date_field.rb +21 -0
- data/lib/voom/presenters/dsl/components/datetime_base.rb +48 -0
- data/lib/voom/presenters/dsl/components/datetime_field.rb +23 -0
- data/lib/voom/presenters/dsl/components/expansion_panel.rb +1 -0
- data/lib/voom/presenters/dsl/components/form.rb +2 -0
- data/lib/voom/presenters/dsl/components/grid.rb +2 -0
- data/lib/voom/presenters/dsl/components/mixins/date_time_fields.rb +29 -0
- data/lib/voom/presenters/dsl/components/mixins/text_fields.rb +0 -6
- data/lib/voom/presenters/dsl/components/table.rb +1 -1
- data/lib/voom/presenters/dsl/components/time_field.rb +21 -0
- data/lib/voom/presenters/dsl/user_interface.rb +3 -0
- data/lib/voom/presenters/helpers/rails/currency.rb +16 -0
- data/lib/voom/presenters/helpers/rails/model_table.rb +52 -0
- data/lib/voom/presenters/helpers/rails.rb +4 -34
- data/lib/voom/presenters/settings.rb +14 -0
- data/lib/voom/presenters/version.rb +1 -1
- data/lib/voom/presenters/web_client/app.rb +8 -0
- data/public/bundle.css +676 -0
- data/public/bundle.js +3314 -1151
- data/views/mdc/assets/js/components/datetime.js +36 -0
- data/views/mdc/assets/js/components/events/base.js +5 -5
- data/views/mdc/assets/js/components/forms.js +2 -2
- data/views/mdc/assets/js/components/initialize.js +2 -2
- data/views/mdc/assets/js/components/switches.js +1 -1
- data/views/mdc/assets/js/components/text-fields.js +2 -4
- data/views/mdc/assets/scss/components/datetime.scss +19 -0
- data/views/mdc/assets/scss/components/textfield.scss +7 -0
- data/views/mdc/assets/scss/components/vendor/flatpickr.min.css +13 -0
- data/views/mdc/components/date.erb +1 -0
- data/views/mdc/components/{date_time.erb → datetime.erb} +13 -8
- data/views/mdc/components/icon.erb +2 -0
- data/views/mdc/components/text_field.erb +3 -2
- data/views/mdc/components/time.erb +1 -0
- data/views/mdc/layout.erb +1 -0
- data/views/mdc/package-lock.json +5 -0
- data/views/mdc/package.json +1 -1
- metadata +33 -18
- data/LICENSE.txt +0 -21
- data/app/demo/event/actions/nav/drawer.pom +0 -5
- data/app/demo/event/actions/nav/menu.pom +0 -19
- data/app/demo/event/actions.rb +0 -86
- data/app/demo/event/autocomplete.pom +0 -27
- data/app/demo/event/field_level.pom +0 -22
- data/app/demo/event/form_level.pom +0 -26
- data/app/demo/event/nav/drawer.pom +0 -5
- data/app/demo/event/nav/menu.pom +0 -14
- data/lib/voom/presenters/dsl/components/date_time.rb +0 -17
- data/lib/voom/presenters/helpers/currency.rb +0 -14
- data/views/mdc/assets/js/components/date-time.js +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c58a3f67ab69ad134f50e569b2cb7d2d39529f145c5eede4e6acdc037e382080
|
4
|
+
data.tar.gz: 5f45db82e9c4b3cc40706dea5e951a852a51864be8d2819588ffd72e847b320d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b7a05cb8ea9c58dc40286375665e0a2682838fb9cd844423344f13d620863797b589e6cc6a3c9bf32bc11bbaa623df07b128a2d6215d986f1c40e91cd28d5e
|
7
|
+
data.tar.gz: e1610bec38099df78e3af49329b11d0466aa18b756551efda35f22f40ba2cfe50baada829e5ab10d5e4df98c67d06a57f640c32c261a25fc8c958c096c2049cb
|
data/.circleci/config.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -19,6 +19,7 @@ GEM
|
|
19
19
|
coderay (1.1.1)
|
20
20
|
concurrent-ruby (1.0.5)
|
21
21
|
diff-lcs (1.2.5)
|
22
|
+
docile (1.1.5)
|
22
23
|
dry-configurable (0.7.0)
|
23
24
|
concurrent-ruby (~> 1.0)
|
24
25
|
dry-container (0.6.0)
|
@@ -27,6 +28,7 @@ GEM
|
|
27
28
|
dry-inflector (0.1.2)
|
28
29
|
ffi (1.9.23)
|
29
30
|
ice_nine (0.11.2)
|
31
|
+
json (2.1.0)
|
30
32
|
method_source (0.8.2)
|
31
33
|
mini_portile2 (2.3.0)
|
32
34
|
mustermann (1.0.2)
|
@@ -65,6 +67,11 @@ GEM
|
|
65
67
|
selenium-webdriver (3.11.0)
|
66
68
|
childprocess (~> 0.5)
|
67
69
|
rubyzip (~> 1.2)
|
70
|
+
simplecov (0.15.1)
|
71
|
+
docile (~> 1.1.0)
|
72
|
+
json (>= 1.8, < 3)
|
73
|
+
simplecov-html (~> 0.10.0)
|
74
|
+
simplecov-html (0.10.2)
|
68
75
|
sinatra (2.0.1)
|
69
76
|
mustermann (~> 1.0)
|
70
77
|
rack (~> 2.0)
|
@@ -98,6 +105,7 @@ DEPENDENCIES
|
|
98
105
|
rspec
|
99
106
|
rspec-html-matchers
|
100
107
|
rspec_junit_formatter
|
108
|
+
simplecov
|
101
109
|
voom-presenters!
|
102
110
|
watir (~> 6.10.3)
|
103
111
|
watir-rspec
|
data/README.md
CHANGED
@@ -9,6 +9,10 @@ A POM client can fully render user interface from POM.
|
|
9
9
|
|
10
10
|
## Demo
|
11
11
|
|
12
|
+
[Demo](https://powerful-bastion-96181.herokuapp.com)
|
13
|
+
|
14
|
+
Or to run locally:
|
15
|
+
|
12
16
|
git clone git@github.com:rx/presenters.git
|
13
17
|
cd presenters/
|
14
18
|
bundle install
|
@@ -30,6 +34,14 @@ Then posts it to the reference web client.
|
|
30
34
|
That result is then saved to a file and opened up with a browser.
|
31
35
|
|
32
36
|
curl localhost:9292/pom/index > $TMPDIR/index.json && curl -d "@$TMPDIR/index.json" -X POST localhost:9292/index > $TMPDIR/index.html && open $TMPDIR/index.html
|
37
|
+
|
38
|
+
## Status
|
39
|
+
This project is in a pre-beta status. It is changing frequently as the first user interfaces are being built with it.
|
40
|
+
Any use should be for internal use only until the status becomes beta.
|
41
|
+
|
42
|
+
[![CircleCI](https://circleci.com/gh/rx/presenters.svg?style=svg)](https://circleci.com/gh/rx/presenters)
|
43
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/8fcea717485230e60f27/maintainability)](https://codeclimate.com/github/rx/presenters/maintainability)
|
44
|
+
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=plastic)](https://raw.githubusercontent.com/rx/presenters/master/LICENSE)
|
33
45
|
|
34
46
|
## Usage
|
35
47
|
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
Voom::Presenters.define(:date_fields) do
|
4
|
+
helpers Demo::Helpers::IndentedGrid
|
5
|
+
attach :top_nav
|
6
|
+
attach :component_drawer
|
7
|
+
|
8
|
+
indented_grid do
|
9
|
+
display 'Date Fields'
|
10
|
+
body <<~DOC
|
11
|
+
A date separates user display format from the value format.
|
12
|
+
|
13
|
+
The default date user display [format](/formatting_tokens#date) can be configured globally using the following:
|
14
|
+
|
15
|
+
````
|
16
|
+
Voom::Presenters::Settings.configure do |config|
|
17
|
+
config.presenters.components.defaults.date.format = 'F j, Y'
|
18
|
+
end
|
19
|
+
````
|
20
|
+
|
21
|
+
The value format for date times can be the following:
|
22
|
+
|
23
|
+
* Ruby Time/DateTime objects.
|
24
|
+
* ISO/Chronologically Date Strings, e.g. "2017-02-26"
|
25
|
+
DOC
|
26
|
+
grid do
|
27
|
+
column 6 do
|
28
|
+
date_field name: :skydive_at,
|
29
|
+
format: 'F j, Y' do
|
30
|
+
label 'Select your date to skydive'
|
31
|
+
icon :event
|
32
|
+
event :change do
|
33
|
+
replaces :context_list, :context_list, hide_time: true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
column 6 do
|
38
|
+
attach :context_list, hide_time: true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
grid do
|
42
|
+
column 6 do
|
43
|
+
title 'Min Date'
|
44
|
+
date_field min_date: "2020-01-01"
|
45
|
+
|
46
|
+
title 'Max Date'
|
47
|
+
date_field max_date: "2017-12-15"
|
48
|
+
|
49
|
+
title 'Min Date (today)'
|
50
|
+
date_field min_date: :today
|
51
|
+
|
52
|
+
title 'Min (today), Max (14 days from now)'
|
53
|
+
date_field min_date: :today, max_date: DateTime.now.next_day(14) # Or in rails Time.now + 14.days
|
54
|
+
|
55
|
+
title 'Disabling specific dates'
|
56
|
+
date_field disable: ["2025-01-30", "2025-02-21", "2025-03-08", DateTime.new(2025, 4, 9)]
|
57
|
+
|
58
|
+
title 'Disable range of dates'
|
59
|
+
date_field disable: [
|
60
|
+
{
|
61
|
+
from: "2025-04-01",
|
62
|
+
to: "2025-05-01"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
from: "2025-09-01",
|
66
|
+
to: "2025-12-01"
|
67
|
+
}
|
68
|
+
]
|
69
|
+
|
70
|
+
title 'Enabling specific dates'
|
71
|
+
date_field enable: [
|
72
|
+
{
|
73
|
+
from: "2025-04-01",
|
74
|
+
to: "2025-05-01"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
from: "2025-09-01",
|
78
|
+
to: "2025-12-01"
|
79
|
+
}
|
80
|
+
]
|
81
|
+
title 'Selecting multiple dates'
|
82
|
+
date_field mode: :multiple
|
83
|
+
|
84
|
+
title 'Preloading multiple dates'
|
85
|
+
date_field mode: :multiple do
|
86
|
+
value ["2016-10-20", "2016-11-04"]
|
87
|
+
end
|
88
|
+
|
89
|
+
title 'Range'
|
90
|
+
date_field mode: :range
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
attach :code, file: __FILE__
|
96
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
Voom::Presenters.define(:datetime_fields) do
|
4
|
+
helpers Demo::Helpers::IndentedGrid
|
5
|
+
attach :top_nav
|
6
|
+
attach :component_drawer
|
7
|
+
|
8
|
+
indented_grid do
|
9
|
+
display 'Date Time'
|
10
|
+
body <<~DOC
|
11
|
+
A date time separates user display format from the value format.
|
12
|
+
|
13
|
+
The default date time user display [format](/formatting_tokens#date) can be configured globally using the following:
|
14
|
+
|
15
|
+
````
|
16
|
+
Voom::Presenters::Settings.configure do |config|
|
17
|
+
config.presenters.components.defaults.datetime.format = 'F j, Y H:i'
|
18
|
+
end
|
19
|
+
````
|
20
|
+
|
21
|
+
The value format for date times can be the following:
|
22
|
+
|
23
|
+
* Ruby Time/DateTime objects.
|
24
|
+
* ISO Date Strings, e.g. "2017-02-26T19:40:03.243Z"
|
25
|
+
* Chronologically Date Strings, e.g., YYYY-MM-DD HH:MM
|
26
|
+
DOC
|
27
|
+
grid do
|
28
|
+
column 6 do
|
29
|
+
datetime_field name: :skydive_at,
|
30
|
+
format: 'F j, Y h:i' do
|
31
|
+
label 'Select your date and time to skydive'
|
32
|
+
icon :event
|
33
|
+
event :change do
|
34
|
+
replaces :context_list, :context_list, hide_time: true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
column 6 do
|
39
|
+
attach :context_list, hide_time: true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
grid do
|
43
|
+
column 6 do
|
44
|
+
title 'Min Date'
|
45
|
+
datetime_field min_date: "2020-01-01 00:15"
|
46
|
+
|
47
|
+
title 'Max Date'
|
48
|
+
datetime_field max_date: "2017-12-15 02:00"
|
49
|
+
|
50
|
+
title 'Min Date (today)'
|
51
|
+
datetime_field min_date: :today
|
52
|
+
|
53
|
+
title 'Min (today), Max (14 days from now)'
|
54
|
+
datetime_field min_date: :today, max_date: DateTime.now.next_day(14) # Or in rails Time.now + 14.days
|
55
|
+
|
56
|
+
title 'Disabling specific dates'
|
57
|
+
datetime_field disable: ["2025-01-30", "2025-02-21", "2025-03-08", DateTime.new(2025, 4, 9)]
|
58
|
+
|
59
|
+
title 'Disable range of dates'
|
60
|
+
datetime_field disable: [
|
61
|
+
{
|
62
|
+
from: "2025-04-01",
|
63
|
+
to: "2025-05-01"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
from: "2025-09-01",
|
67
|
+
to: "2025-12-01"
|
68
|
+
}
|
69
|
+
]
|
70
|
+
|
71
|
+
title 'Enabling specific dates'
|
72
|
+
datetime_field enable: [
|
73
|
+
{
|
74
|
+
from: "2025-04-01",
|
75
|
+
to: "2025-05-01"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
from: "2025-09-01",
|
79
|
+
to: "2025-12-01"
|
80
|
+
}
|
81
|
+
]
|
82
|
+
title 'Selecting multiple dates'
|
83
|
+
datetime_field mode: :multiple
|
84
|
+
|
85
|
+
title 'Preloading multiple dates'
|
86
|
+
datetime_field mode: :multiple do
|
87
|
+
value ["2016-10-20", "2016-11-04"]
|
88
|
+
end
|
89
|
+
|
90
|
+
title 'Min Time'
|
91
|
+
datetime_field min_time: "9:00"
|
92
|
+
|
93
|
+
title 'Max Time'
|
94
|
+
datetime_field max_time: "20:00"
|
95
|
+
|
96
|
+
title 'Range'
|
97
|
+
datetime_field mode: :range
|
98
|
+
|
99
|
+
title '24 hour time'
|
100
|
+
datetime_field time_24hr: true, format: 'H:i'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
attach :code, file: __FILE__
|
106
|
+
end
|
@@ -2,7 +2,7 @@ Voom::Presenters.define('component_menu') do
|
|
2
2
|
helpers Voom::Presenters::Helpers::Inflector
|
3
3
|
menu side: :left do
|
4
4
|
%i(cards lists expansion_panels tables text_fields selects buttons fabs fabs_mini dialogs layouts headers drawers
|
5
|
-
footers menus toggles chips snackbar badges tooltips hidden_fields text_areas forms icons).sort.each do |comp|
|
5
|
+
footers menus toggles chips snackbar badges tooltips hidden_fields text_areas forms icons datetime_fields date_fields time_fields).sort.each do |comp|
|
6
6
|
item titleize(comp) do
|
7
7
|
event :click do
|
8
8
|
loads comp
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
Voom::Presenters.define(:time_fields) do
|
4
|
+
helpers Demo::Helpers::IndentedGrid
|
5
|
+
attach :top_nav
|
6
|
+
attach :component_drawer
|
7
|
+
|
8
|
+
indented_grid do
|
9
|
+
display 'Time Field'
|
10
|
+
body <<~DOC
|
11
|
+
A time field separates user display format from the value format.
|
12
|
+
|
13
|
+
The default time user display [format](/formatting_tokens#time) can be configured globally using the following:
|
14
|
+
|
15
|
+
````
|
16
|
+
Voom::Presenters::Settings.configure do |config|
|
17
|
+
config.presenters.components.defaults.time.format = 'h:i K'
|
18
|
+
end
|
19
|
+
````
|
20
|
+
|
21
|
+
The value format for date times can be the following, they are expected to be in 24 hour time:
|
22
|
+
|
23
|
+
* Ruby Time/DateTime objects.
|
24
|
+
* Chronologically Time Strings, e.g., HH:MM
|
25
|
+
DOC
|
26
|
+
grid do
|
27
|
+
column 6 do
|
28
|
+
time_field name: :skydive_at,
|
29
|
+
format: 'H:i' do
|
30
|
+
label 'Select your time to skydive'
|
31
|
+
icon :event
|
32
|
+
event :change do
|
33
|
+
replaces :context_list, :context_list, hide_time: true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
column 6 do
|
38
|
+
attach :context_list, hide_time: true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
grid do
|
42
|
+
column 6 do
|
43
|
+
title 'Min Time'
|
44
|
+
time_field min_time: "9:00"
|
45
|
+
|
46
|
+
title 'Max Time'
|
47
|
+
time_field max_time: "20:00"
|
48
|
+
|
49
|
+
title 'Range'
|
50
|
+
time_field min_time: "16:00", max_time: "20:00"
|
51
|
+
|
52
|
+
title '24 hour time'
|
53
|
+
time_field time_24hr: true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
attach :code, file: __FILE__
|
59
|
+
end
|
@@ -17,13 +17,40 @@ Voom::Presenters.define(:toggles) do
|
|
17
17
|
radio_button
|
18
18
|
|
19
19
|
headline 'ICON TOGGLE'
|
20
|
-
icon_toggle 'format_bold', checked: true
|
20
|
+
icon_toggle 'format_bold', checked: true
|
21
21
|
icon_toggle 'format_italic'
|
22
22
|
|
23
23
|
headline 'SWITCH'
|
24
24
|
switch checked: true
|
25
25
|
switch
|
26
26
|
|
27
|
+
grid do
|
28
|
+
column 6 do
|
29
|
+
display 'Field Level Events'
|
30
|
+
heading 'Text Fields'
|
31
|
+
body 'This demonstrates that a change event will submit the field value to the event action. '\
|
32
|
+
'This works with posts and replace actions'
|
33
|
+
switch name: :myfield do
|
34
|
+
event :change do
|
35
|
+
replaces :context_list, :context_list
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
display 'Posts in Form'
|
40
|
+
body 'This demonstrates that a change event on **ANY** form input will send all the form inputs to the event action. '\
|
41
|
+
'This works with posts and replace actions'
|
42
|
+
form do
|
43
|
+
switch name: :myfield
|
44
|
+
switch name: :myfield2
|
45
|
+
event :change do
|
46
|
+
replaces :context_list, :context_list
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
column 6 do
|
51
|
+
attach :context_list
|
52
|
+
end
|
53
|
+
end
|
27
54
|
attach :code, file: __FILE__
|
28
55
|
end
|
29
56
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Voom::Presenters.define(:autocomplete_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
|
8
|
+
heading 'Autocomplete'
|
9
|
+
title 'Work In Progress'
|
10
|
+
body 'Provides a text field that when typed into will fetch a set of items to select base on what was typed.',
|
11
|
+
'Useful for providing search clues as the user types.',
|
12
|
+
'The search command returned should either an array of text terms found,
|
13
|
+
or optionally an id that will also be sumbitted using the same name as plus `_id` as the text field.'
|
14
|
+
|
15
|
+
|
16
|
+
heading 'Search'
|
17
|
+
content id: :search_field do
|
18
|
+
text_field name: :search, full_width: false do
|
19
|
+
label 'Search Silicon Valley'
|
20
|
+
event :input do
|
21
|
+
autocomplete '/_search_'
|
22
|
+
end
|
23
|
+
event :change do
|
24
|
+
replaces :context_list, :context_list, title: 'Search Results'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
attach :context_list, title: 'Search Results'
|
29
|
+
end
|
30
|
+
|
31
|
+
attach :code, file: __FILE__
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Voom::Presenters.define(:deletes_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Deletes'
|
8
|
+
body 'Issues a DEL to a given url',
|
9
|
+
'Generally used to destroy/delete a restful resource.'
|
10
|
+
body '*Note: Will generate a 404.*'
|
11
|
+
|
12
|
+
title 'Deletes'
|
13
|
+
body 'issues a DELETE to the passed path'
|
14
|
+
content do
|
15
|
+
button 'deletes' do
|
16
|
+
event :click do
|
17
|
+
# Will generate an error
|
18
|
+
deletes 'deletepath', {optional: :params}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
attach :code, file: __FILE__
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Voom::Presenters.define(:dialog_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Dialog'
|
8
|
+
body 'A dialog event displays a, you guessed it, dialog.'
|
9
|
+
|
10
|
+
title 'Dialog'
|
11
|
+
button 'dialog' do
|
12
|
+
event :click do
|
13
|
+
dialog :my_dialog
|
14
|
+
end
|
15
|
+
end
|
16
|
+
attach :show_dialog
|
17
|
+
end
|
18
|
+
attach :code, file: __FILE__
|
19
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Voom::Presenters.define(:toggle_visibility_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Loads'
|
8
|
+
body 'Loads a new presenter, replacing the whole page.'
|
9
|
+
|
10
|
+
subheading context['reloaded'] ? "Reloaded" : 'Loads'
|
11
|
+
button 'loads' do
|
12
|
+
event :click do
|
13
|
+
loads :events, reloaded: true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
heading context['reloaded'] ? "Reloaded" : 'Loaded'
|
17
|
+
end
|
18
|
+
attach :code, file: __FILE__
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Voom::Presenters.define(:posts_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Posts'
|
8
|
+
body 'Issues a POST to a given url',
|
9
|
+
'Generally used to create a restful resource or issue a command.'
|
10
|
+
body '*Note: Will generate a 404.*'
|
11
|
+
|
12
|
+
title 'Posts'
|
13
|
+
body "issues a POST to the passed path\nAlias: creates"
|
14
|
+
content shows_errors: false do
|
15
|
+
button 'posts' do
|
16
|
+
event :click do
|
17
|
+
posts 'postpath', {optional: :params}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
attach :code, file: __FILE__
|
23
|
+
end
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Voom::Presenters.define(:replaces_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Replaces'
|
8
|
+
body 'Replaces will replace content on the page with another presenter.',
|
9
|
+
'It takes the id of what to replace, usually a content block. And the presenter to replace it with.',
|
10
|
+
"You pass parameters to it as the last argument."
|
11
|
+
|
12
|
+
subheading 'Replaces'
|
13
|
+
button 'replaces' do
|
14
|
+
event :click do
|
15
|
+
replaces :replace_me, :replace_text, text: "I was replaced"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
attach :replace_text
|
19
|
+
end
|
20
|
+
attach :code, file: __FILE__
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Voom::Presenters.define(:snackbar_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Snackbar'
|
8
|
+
body 'Displays the snackbar at the bottom of the screen.',
|
9
|
+
'Useful for inplace editing notifications of success'
|
10
|
+
|
11
|
+
subheading 'Snackbar'
|
12
|
+
button 'snackbar' do
|
13
|
+
event :click do
|
14
|
+
snackbar 'I want a snack!'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
attach :code, file: __FILE__
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Voom::Presenters.define(:toggle_visibility_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Toggle Visibility'
|
8
|
+
body 'Allows you to toggle visiblity of content on and off on events.',
|
9
|
+
'Takes the id of the element to toggle.',
|
10
|
+
"Optionally takes :on or :off to force visiblity."
|
11
|
+
|
12
|
+
subheading 'Toggle Visibility'
|
13
|
+
button 'toggle visiblity' do
|
14
|
+
event :click do
|
15
|
+
toggle_visiblity :toggle_me
|
16
|
+
end
|
17
|
+
end
|
18
|
+
heading 'Sometimes I appear', id: :toggle_me
|
19
|
+
end
|
20
|
+
attach :code, file: __FILE__
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Voom::Presenters.define(:updates_action) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
heading 'Updates'
|
8
|
+
body 'Issues a PUT to a given url',
|
9
|
+
'Generally used to update a restful resource.'
|
10
|
+
body '*Note: Will generate a 404.*'
|
11
|
+
|
12
|
+
title 'Updates'
|
13
|
+
body 'issues a PUT to the passed path'
|
14
|
+
content do
|
15
|
+
button 'updates' do
|
16
|
+
event :click do
|
17
|
+
# This goes nowhere
|
18
|
+
updates 'updatepath', {optional: :params}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
attach :code, file: __FILE__
|
24
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Voom::Presenters.define(:field_level_events) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
attach :events_drawer
|
5
|
+
|
6
|
+
indented_grid do
|
7
|
+
display 'Field Level Events'
|
8
|
+
heading 'Text Fields'
|
9
|
+
body 'This demonstrates that a change event will submit the field value to the event action. '\
|
10
|
+
'This works with posts and replace actions'
|
11
|
+
text_field name: :myfield do
|
12
|
+
label 'Data to post'
|
13
|
+
event :change do
|
14
|
+
replaces :context_list, :context_list
|
15
|
+
end
|
16
|
+
end
|
17
|
+
attach :context_list
|
18
|
+
end
|
19
|
+
attach :code, file: __FILE__
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Voom::Presenters.define(:form_level_events) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
|
4
|
+
attach :top_nav
|
5
|
+
attach :events_drawer
|
6
|
+
|
7
|
+
indented_grid do
|
8
|
+
display 'Posts in Form'
|
9
|
+
body 'This demonstrates that a change event on **ANY** form input will send all the form inputs to the event action. '\
|
10
|
+
'This works with posts and replace actions'
|
11
|
+
form do
|
12
|
+
text_field name: :myfield do
|
13
|
+
label 'Data to post'
|
14
|
+
end
|
15
|
+
text_field name: :myfield2 do
|
16
|
+
label 'More Data to post'
|
17
|
+
end
|
18
|
+
event :change do
|
19
|
+
replaces :context_list, :context_list
|
20
|
+
end
|
21
|
+
end
|
22
|
+
attach :context_list
|
23
|
+
end
|
24
|
+
end
|