voom-presenters 0.1.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 +7 -0
- data/.gitignore +54 -0
- data/.ruby-version +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +104 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/ROADMAP.md +21 -0
- data/Rakefile +6 -0
- data/app/demo/component_status.pom +76 -0
- data/app/demo/components.pom +19 -0
- data/app/demo/components/badges.pom +25 -0
- data/app/demo/components/buttons.pom +51 -0
- data/app/demo/components/cards.pom +79 -0
- data/app/demo/components/chips.pom +91 -0
- data/app/demo/components/dialogs.pom +27 -0
- data/app/demo/components/drawers.pom +34 -0
- data/app/demo/components/expansion_panels.pom +21 -0
- data/app/demo/components/fabs-mini.pom +18 -0
- data/app/demo/components/fabs.pom +16 -0
- data/app/demo/components/footers.pom +36 -0
- data/app/demo/components/forms.pom +30 -0
- data/app/demo/components/headers.pom +37 -0
- data/app/demo/components/hidden_fields.pom +20 -0
- data/app/demo/components/icons.pom +94 -0
- data/app/demo/components/layouts.pom +44 -0
- data/app/demo/components/lists.pom +124 -0
- data/app/demo/components/menus.pom +43 -0
- data/app/demo/components/nav/drawer.pom +5 -0
- data/app/demo/components/nav/menu.pom +15 -0
- data/app/demo/components/selects.pom +30 -0
- data/app/demo/components/snackbar.pom +24 -0
- data/app/demo/components/snackbar_attached.pom +6 -0
- data/app/demo/components/tables.pom +39 -0
- data/app/demo/components/text_areas.pom +19 -0
- data/app/demo/components/text_fields.pom +57 -0
- data/app/demo/components/toggles.pom +29 -0
- data/app/demo/components/tooltips.pom +120 -0
- data/app/demo/event/actions.rb +86 -0
- data/app/demo/event/actions/dialog/show_dialog.pom +9 -0
- data/app/demo/event/actions/dialog/trigger.pom +86 -0
- data/app/demo/event/actions/nav/drawer.pom +5 -0
- data/app/demo/event/actions/nav/menu.pom +19 -0
- data/app/demo/event/autocomplete.pom +27 -0
- data/app/demo/event/field_level.pom +22 -0
- data/app/demo/event/form_level.pom +26 -0
- data/app/demo/event/nav/drawer.pom +5 -0
- data/app/demo/event/nav/menu.pom +14 -0
- data/app/demo/event/new_text.pom +6 -0
- data/app/demo/events.pom +98 -0
- data/app/demo/helpers/indented_grid.rb +14 -0
- data/app/demo/index.pom +19 -0
- data/app/demo/markdown.pom +73 -0
- data/app/demo/nav/top_nav.pom +42 -0
- data/app/demo/shared/code.pom +20 -0
- data/app/demo/shared/context_list.pom +29 -0
- data/app/demo/shared/debug.pom +17 -0
- data/app/demo/styles.pom +26 -0
- data/bin/console +22 -0
- data/bin/setup +8 -0
- data/component-status.yml +219 -0
- data/config.ru +21 -0
- data/lib/voom-presenters.rb +9 -0
- data/lib/voom/container_methods.rb +40 -0
- data/lib/voom/logger_methods.rb +11 -0
- data/lib/voom/parameters.rb +73 -0
- data/lib/voom/presenters-engine.rb +40 -0
- data/lib/voom/presenters.rb +13 -0
- data/lib/voom/presenters/api/app.rb +53 -0
- data/lib/voom/presenters/api/router.rb +94 -0
- data/lib/voom/presenters/app.rb +55 -0
- data/lib/voom/presenters/container_item.rb +16 -0
- data/lib/voom/presenters/demo/echo.rb +29 -0
- data/lib/voom/presenters/demo/search-terms.yml +50 -0
- data/lib/voom/presenters/demo/search.rb +29 -0
- data/lib/voom/presenters/dsl.rb +60 -0
- data/lib/voom/presenters/dsl/components/action.rb +35 -0
- data/lib/voom/presenters/dsl/components/avatar.rb +27 -0
- data/lib/voom/presenters/dsl/components/badge.rb +21 -0
- data/lib/voom/presenters/dsl/components/base.rb +78 -0
- data/lib/voom/presenters/dsl/components/button.rb +49 -0
- data/lib/voom/presenters/dsl/components/card.rb +119 -0
- data/lib/voom/presenters/dsl/components/checkbox.rb +16 -0
- data/lib/voom/presenters/dsl/components/chip.rb +48 -0
- data/lib/voom/presenters/dsl/components/content.rb +33 -0
- data/lib/voom/presenters/dsl/components/date_time.rb +17 -0
- data/lib/voom/presenters/dsl/components/dialog.rb +50 -0
- data/lib/voom/presenters/dsl/components/drawer.rb +40 -0
- data/lib/voom/presenters/dsl/components/event.rb +101 -0
- data/lib/voom/presenters/dsl/components/event_base.rb +20 -0
- data/lib/voom/presenters/dsl/components/expansion_panel.rb +46 -0
- data/lib/voom/presenters/dsl/components/footer.rb +25 -0
- data/lib/voom/presenters/dsl/components/form.rb +42 -0
- data/lib/voom/presenters/dsl/components/grid.rb +64 -0
- data/lib/voom/presenters/dsl/components/header.rb +33 -0
- data/lib/voom/presenters/dsl/components/hidden_field.rb +25 -0
- data/lib/voom/presenters/dsl/components/icon.rb +21 -0
- data/lib/voom/presenters/dsl/components/icon_base.rb +24 -0
- data/lib/voom/presenters/dsl/components/icon_toggle.rb +21 -0
- data/lib/voom/presenters/dsl/components/image.rb +36 -0
- data/lib/voom/presenters/dsl/components/input.rb +19 -0
- data/lib/voom/presenters/dsl/components/list.rb +39 -0
- data/lib/voom/presenters/dsl/components/lists/action.rb +72 -0
- data/lib/voom/presenters/dsl/components/lists/line.rb +83 -0
- data/lib/voom/presenters/dsl/components/lists/separator.rb +16 -0
- data/lib/voom/presenters/dsl/components/menu.rb +66 -0
- data/lib/voom/presenters/dsl/components/mixins/append.rb +20 -0
- data/lib/voom/presenters/dsl/components/mixins/attaches.rb +18 -0
- data/lib/voom/presenters/dsl/components/mixins/avatar.rb +18 -0
- data/lib/voom/presenters/dsl/components/mixins/buttons.rb +15 -0
- data/lib/voom/presenters/dsl/components/mixins/chips.rb +21 -0
- data/lib/voom/presenters/dsl/components/mixins/common.rb +50 -0
- data/lib/voom/presenters/dsl/components/mixins/content.rb +15 -0
- data/lib/voom/presenters/dsl/components/mixins/dialogs.rb +19 -0
- data/lib/voom/presenters/dsl/components/mixins/event.rb +19 -0
- data/lib/voom/presenters/dsl/components/mixins/expansion_panels.rb +15 -0
- data/lib/voom/presenters/dsl/components/mixins/grids.rb +15 -0
- data/lib/voom/presenters/dsl/components/mixins/helpers.rb +20 -0
- data/lib/voom/presenters/dsl/components/mixins/icons.rb +17 -0
- data/lib/voom/presenters/dsl/components/mixins/images.rb +15 -0
- data/lib/voom/presenters/dsl/components/mixins/menus.rb +15 -0
- data/lib/voom/presenters/dsl/components/mixins/selects.rb +17 -0
- data/lib/voom/presenters/dsl/components/mixins/snackbars.rb +18 -0
- data/lib/voom/presenters/dsl/components/mixins/text_fields.rb +35 -0
- data/lib/voom/presenters/dsl/components/mixins/toggles.rb +40 -0
- data/lib/voom/presenters/dsl/components/mixins/tooltips.rb +18 -0
- data/lib/voom/presenters/dsl/components/mixins/typography.rb +37 -0
- data/lib/voom/presenters/dsl/components/page.rb +29 -0
- data/lib/voom/presenters/dsl/components/radio_button.rb +14 -0
- data/lib/voom/presenters/dsl/components/select.rb +64 -0
- data/lib/voom/presenters/dsl/components/snackbar.rb +32 -0
- data/lib/voom/presenters/dsl/components/switch.rb +14 -0
- data/lib/voom/presenters/dsl/components/table.rb +102 -0
- data/lib/voom/presenters/dsl/components/text_area.rb +20 -0
- data/lib/voom/presenters/dsl/components/text_field.rb +74 -0
- data/lib/voom/presenters/dsl/components/toggle_base.rb +26 -0
- data/lib/voom/presenters/dsl/components/tooltip.rb +25 -0
- data/lib/voom/presenters/dsl/components/typography.rb +25 -0
- data/lib/voom/presenters/dsl/definer.rb +13 -0
- data/lib/voom/presenters/dsl/definition.rb +31 -0
- data/lib/voom/presenters/dsl/invalid_presenter.rb +8 -0
- data/lib/voom/presenters/dsl/lockable.rb +15 -0
- data/lib/voom/presenters/dsl/user_interface.rb +135 -0
- data/lib/voom/presenters/errors/parameter_validation.rb +10 -0
- data/lib/voom/presenters/errors/unprocessable.rb +8 -0
- data/lib/voom/presenters/helpers.rb +18 -0
- data/lib/voom/presenters/helpers/currency.rb +14 -0
- data/lib/voom/presenters/helpers/date.rb +22 -0
- data/lib/voom/presenters/helpers/errors.rb +11 -0
- data/lib/voom/presenters/helpers/inflector.rb +16 -0
- data/lib/voom/presenters/helpers/rails.rb +60 -0
- data/lib/voom/presenters/helpers/route.rb +11 -0
- data/lib/voom/presenters/helpers/time.rb +27 -0
- data/lib/voom/presenters/settings.rb +35 -0
- data/lib/voom/presenters/version.rb +5 -0
- data/lib/voom/presenters/web_client/app.rb +128 -0
- data/lib/voom/presenters/web_client/markdown_render.rb +16 -0
- data/lib/voom/presenters/web_client/router.rb +96 -0
- data/lib/voom/serializer.rb +43 -0
- data/lib/voom/symbol/to_str.rb +29 -0
- data/lib/voom/trace.rb +19 -0
- data/presenters.gemspec +37 -0
- data/public/.gitignore +2 -0
- data/public/bundle.css +11413 -0
- data/public/bundle.js +16456 -0
- data/public/dialog-polyfill.js +738 -0
- data/public/favicon.ico +0 -0
- data/public/img/demo/dog.png +0 -0
- data/public/img/demo/image_card.jpg +0 -0
- data/public/img/demo/rx.png +0 -0
- data/public/img/demo/welcome_card.jpg +0 -0
- data/public/img/settings/blue.png +0 -0
- data/public/img/settings/green.png +0 -0
- data/public/img/settings/orange.png +0 -0
- data/public/img/settings/purple.png +0 -0
- data/public/img/settings/red.png +0 -0
- data/public/img/settings/teal.png +0 -0
- data/public/img/settings/white.png +0 -0
- data/public/img/settings/yellow.png +0 -0
- data/public/scripts.js +289 -0
- data/public/style-bundle.js +73 -0
- data/public/styles.css +16 -0
- data/views/mdc/.gitignore +1 -0
- data/views/mdc/assets/js/app.js +10 -0
- data/views/mdc/assets/js/components/base-component.js +5 -0
- data/views/mdc/assets/js/components/button.js +15 -0
- data/views/mdc/assets/js/components/cards.js +3 -0
- data/views/mdc/assets/js/components/checkboxes.js +15 -0
- data/views/mdc/assets/js/components/chips.js +12 -0
- data/views/mdc/assets/js/components/date-time.js +6 -0
- data/views/mdc/assets/js/components/dialogs.js +32 -0
- data/views/mdc/assets/js/components/events.js +151 -0
- data/views/mdc/assets/js/components/events/autocomplete.js +96 -0
- data/views/mdc/assets/js/components/events/base.js +41 -0
- data/views/mdc/assets/js/components/events/dialog.js +25 -0
- data/views/mdc/assets/js/components/events/errors.js +142 -0
- data/views/mdc/assets/js/components/events/loads.js +22 -0
- data/views/mdc/assets/js/components/events/navigates.js +17 -0
- data/views/mdc/assets/js/components/events/posts.js +99 -0
- data/views/mdc/assets/js/components/events/replaces.js +82 -0
- data/views/mdc/assets/js/components/events/selects.js +28 -0
- data/views/mdc/assets/js/components/events/snackbar.js +23 -0
- data/views/mdc/assets/js/components/events/toggle_visiblity.js +19 -0
- data/views/mdc/assets/js/components/forms.js +57 -0
- data/views/mdc/assets/js/components/icon-toggles.js +21 -0
- data/views/mdc/assets/js/components/initialize.js +34 -0
- data/views/mdc/assets/js/components/lists.js +4 -0
- data/views/mdc/assets/js/components/menus.js +31 -0
- data/views/mdc/assets/js/components/mixins/event-handler.js +13 -0
- data/views/mdc/assets/js/components/selects.js +45 -0
- data/views/mdc/assets/js/components/snackbar.js +32 -0
- data/views/mdc/assets/js/components/text-fields.js +77 -0
- data/views/mdc/assets/js/dialog-polyfill.js +738 -0
- data/views/mdc/assets/js/material.js +3996 -0
- data/views/mdc/assets/js/utils/urls.js +54 -0
- data/views/mdc/assets/scss/app.scss +31 -0
- data/views/mdc/assets/scss/components/avatar.scss +41 -0
- data/views/mdc/assets/scss/components/button.scss +47 -0
- data/views/mdc/assets/scss/components/card.scss +54 -0
- data/views/mdc/assets/scss/components/checkbox.scss +5 -0
- data/views/mdc/assets/scss/components/chip.scss +30 -0
- data/views/mdc/assets/scss/components/datetime.scss +0 -0
- data/views/mdc/assets/scss/components/dialog.scss +3 -0
- data/views/mdc/assets/scss/components/expansion-panel.scss +153 -0
- data/views/mdc/assets/scss/components/fab.scss +8 -0
- data/views/mdc/assets/scss/components/grid.scss +10 -0
- data/views/mdc/assets/scss/components/icon-toggles.scss +9 -0
- data/views/mdc/assets/scss/components/icon.scss +34 -0
- data/views/mdc/assets/scss/components/image.scss +24 -0
- data/views/mdc/assets/scss/components/list.scss +9 -0
- data/views/mdc/assets/scss/components/menu.scss +17 -0
- data/views/mdc/assets/scss/components/select.scss +16 -0
- data/views/mdc/assets/scss/components/snackbar.scss +5 -0
- data/views/mdc/assets/scss/components/switch.scss +6 -0
- data/views/mdc/assets/scss/components/table-pagination.scss +65 -0
- data/views/mdc/assets/scss/components/textfield.scss +1 -0
- data/views/mdc/assets/scss/components/typography.scss +25 -0
- data/views/mdc/assets/scss/material.blue_grey-orange.min.css +8 -0
- data/views/mdc/assets/scss/styles.scss +11 -0
- data/views/mdc/assets/scss/theme.scss +5 -0
- data/views/mdc/body/drawer.erb +18 -0
- data/views/mdc/body/drawers/menu.erb +25 -0
- data/views/mdc/body/footer.erb +1 -0
- data/views/mdc/body/footers/large.erb +27 -0
- data/views/mdc/body/footers/menu_item.erb +6 -0
- data/views/mdc/body/footers/small.erb +14 -0
- data/views/mdc/body/header.erb +25 -0
- data/views/mdc/body/snackbar.erb +10 -0
- data/views/mdc/components/avatar.erb +24 -0
- data/views/mdc/components/badge.erb +2 -0
- data/views/mdc/components/body.erb +2 -0
- data/views/mdc/components/button.erb +17 -0
- data/views/mdc/components/buttons/button.erb +20 -0
- data/views/mdc/components/buttons/fab.erb +22 -0
- data/views/mdc/components/buttons/icon.erb +24 -0
- data/views/mdc/components/card.erb +49 -0
- data/views/mdc/components/checkbox.erb +22 -0
- data/views/mdc/components/chip.erb +31 -0
- data/views/mdc/components/content.erb +11 -0
- data/views/mdc/components/date_time.erb +30 -0
- data/views/mdc/components/dialog.erb +27 -0
- data/views/mdc/components/display.erb +2 -0
- data/views/mdc/components/event.erb +18 -0
- data/views/mdc/components/expansion_panel.erb +11 -0
- data/views/mdc/components/form.erb +15 -0
- data/views/mdc/components/grid.erb +24 -0
- data/views/mdc/components/headline.erb +2 -0
- data/views/mdc/components/hidden_field.erb +1 -0
- data/views/mdc/components/icon.erb +30 -0
- data/views/mdc/components/icon_toggle.erb +15 -0
- data/views/mdc/components/image.erb +7 -0
- data/views/mdc/components/link.erb +14 -0
- data/views/mdc/components/list.erb +14 -0
- data/views/mdc/components/list/actions.erb +6 -0
- data/views/mdc/components/list/actions/button.erb +1 -0
- data/views/mdc/components/list/actions/checkbox.erb +1 -0
- data/views/mdc/components/list/actions/icon.erb +1 -0
- data/views/mdc/components/list/actions/icon_toggle.erb +1 -0
- data/views/mdc/components/list/actions/radio_button.erb +1 -0
- data/views/mdc/components/list/actions/switch.erb +1 -0
- data/views/mdc/components/list/avatar.erb +5 -0
- data/views/mdc/components/list/checkbox.erb +5 -0
- data/views/mdc/components/list/icon.erb +5 -0
- data/views/mdc/components/list/info.erb +1 -0
- data/views/mdc/components/list/line.erb +34 -0
- data/views/mdc/components/list/menu.erb +23 -0
- data/views/mdc/components/list/separator.erb +1 -0
- data/views/mdc/components/menu.erb +29 -0
- data/views/mdc/components/modal.erb +15 -0
- data/views/mdc/components/radio_button.erb +11 -0
- data/views/mdc/components/render.erb +4 -0
- data/views/mdc/components/select.erb +22 -0
- data/views/mdc/components/snackbar.erb +17 -0
- data/views/mdc/components/static.erb +7 -0
- data/views/mdc/components/subheading.erb +2 -0
- data/views/mdc/components/switch.erb +13 -0
- data/views/mdc/components/table.erb +13 -0
- data/views/mdc/components/table/header.erb +7 -0
- data/views/mdc/components/table/pagination.erb +24 -0
- data/views/mdc/components/table/row.erb +14 -0
- data/views/mdc/components/text_area.erb +8 -0
- data/views/mdc/components/text_field.erb +27 -0
- data/views/mdc/components/title.erb +4 -0
- data/views/mdc/components/tooltip.erb +5 -0
- data/views/mdc/components/typography.erb +13 -0
- data/views/mdc/init-depends.sh +2 -0
- data/views/mdc/layout.erb +50 -0
- data/views/mdc/package-lock.json +11524 -0
- data/views/mdc/package.json +39 -0
- data/views/mdc/web.erb +1 -0
- data/views/mdc/webpack.config.js +47 -0
- metadata +539 -0
@@ -0,0 +1,120 @@
|
|
1
|
+
require_relative '../helpers/indented_grid'
|
2
|
+
|
3
|
+
Voom::Presenters.define(:tooltips) do
|
4
|
+
helpers Demo::Helpers::IndentedGrid
|
5
|
+
attach :top_nav
|
6
|
+
attach :component_drawer
|
7
|
+
|
8
|
+
indented_grid do
|
9
|
+
display 'Tooltips'
|
10
|
+
|
11
|
+
headline 'Avatars'
|
12
|
+
subheading 'Cards'
|
13
|
+
card do
|
14
|
+
media do
|
15
|
+
avatar 'img/demo/rx.png' do
|
16
|
+
tooltip "Ill be back", position: :right
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
card do
|
22
|
+
media do
|
23
|
+
avatar :person do
|
24
|
+
tooltip "Ill be back", position: :right
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
subheading 'Lists (**Help Wanted**)'
|
30
|
+
list do
|
31
|
+
line do
|
32
|
+
text 'Terminator2'
|
33
|
+
avatar 'img/demo/rx.png' do
|
34
|
+
tooltip "I'll be back - not working", position: :right
|
35
|
+
end
|
36
|
+
end
|
37
|
+
line do
|
38
|
+
text 'Terminator3'
|
39
|
+
avatar :person do
|
40
|
+
tooltip "I'll be back - not working", position: :right
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
headline 'Buttons'
|
46
|
+
|
47
|
+
button 'Button', type: :raised do
|
48
|
+
tooltip "Yo\nsmile" # position: :left
|
49
|
+
end
|
50
|
+
button 'Button' do
|
51
|
+
tooltip "Yo\nsmile", position: :bottom
|
52
|
+
end
|
53
|
+
button icon: :mood do
|
54
|
+
tooltip "Yo\nsmile", position: :top
|
55
|
+
end
|
56
|
+
|
57
|
+
headline 'Chips'
|
58
|
+
chip 'Hover over me' do
|
59
|
+
tooltip 'I have this tip!'
|
60
|
+
end
|
61
|
+
|
62
|
+
headline 'Tables'
|
63
|
+
|
64
|
+
table selectable: true do
|
65
|
+
header do
|
66
|
+
column 'Material'
|
67
|
+
column 'Quantity' do
|
68
|
+
tooltip 'This is the quantity on hand.', position: :top
|
69
|
+
end
|
70
|
+
column 'Unit price'
|
71
|
+
end
|
72
|
+
|
73
|
+
row do
|
74
|
+
column 'Caulk' do
|
75
|
+
tooltip 'This fixes leaks', position: :right
|
76
|
+
end
|
77
|
+
column 99
|
78
|
+
column "$299"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
headline 'Toggles'
|
84
|
+
|
85
|
+
radio_button do
|
86
|
+
tooltip 'select it'
|
87
|
+
end
|
88
|
+
icon_toggle 'format_italic' do
|
89
|
+
tooltip 'toggle it'
|
90
|
+
end
|
91
|
+
switch do
|
92
|
+
tooltip 'switch it'
|
93
|
+
end
|
94
|
+
checkbox do
|
95
|
+
tooltip 'check it'
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
display 'Styles'
|
100
|
+
|
101
|
+
display 'Typography', level: 4 do
|
102
|
+
tooltip 'I do nothing.'
|
103
|
+
end
|
104
|
+
|
105
|
+
headline 'Headline' do
|
106
|
+
tooltip 'I do nothing.'
|
107
|
+
end
|
108
|
+
title 'Title' do
|
109
|
+
tooltip 'I do nothing.'
|
110
|
+
end
|
111
|
+
subheading 'Subheading 2', level: 2 do
|
112
|
+
tooltip 'I do nothing.'
|
113
|
+
end
|
114
|
+
body 'Body 2 text, calling something out.', level: 2 do
|
115
|
+
tooltip 'I do nothing.'
|
116
|
+
end
|
117
|
+
|
118
|
+
attach :code, file: __FILE__
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
Voom::Presenters.define(:event_actions) do
|
2
|
+
attach :top_nav
|
3
|
+
attach :events_drawer
|
4
|
+
|
5
|
+
grid do
|
6
|
+
column 1
|
7
|
+
column 11 do
|
8
|
+
heading 'Events'
|
9
|
+
|
10
|
+
subheading 'Dialog'
|
11
|
+
button 'dialog' do
|
12
|
+
event :click do
|
13
|
+
dialog :my_dialog
|
14
|
+
end
|
15
|
+
end
|
16
|
+
attach :show_dialog
|
17
|
+
|
18
|
+
subheading 'Replaces'
|
19
|
+
button 'replaces' do
|
20
|
+
event :click do
|
21
|
+
replaces :replace_me, :replace_text, text: "I was replaced"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
attach :replace_text
|
25
|
+
|
26
|
+
subheading 'Toggle Visibility'
|
27
|
+
button 'toggle visiblity' do
|
28
|
+
event :click do
|
29
|
+
toggle_visiblity :toggle_me
|
30
|
+
end
|
31
|
+
end
|
32
|
+
heading 'Sometimes I appear', id: :toggle_me
|
33
|
+
|
34
|
+
subheading 'Snackbar'
|
35
|
+
button 'snackbar' do
|
36
|
+
event :click do
|
37
|
+
snackbar 'I want a snack!'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
subheading context['reloaded'] ? "Reloaded" : 'Loads'
|
42
|
+
button 'loads' do
|
43
|
+
event :click do
|
44
|
+
loads :events, reloaded: true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
heading context['reloaded'] ? "Reloaded" : 'Loaded'
|
48
|
+
|
49
|
+
title "A Note on errors:"
|
50
|
+
body ['These will display an error. Errors are displayed in four locations.',
|
51
|
+
'1. Field/input level errors will display on the field/input.',
|
52
|
+
'2. By default all content blocks will display errors. Use `show_errors=false` to turn this off on a block',
|
53
|
+
'3. At the top of all forms.',
|
54
|
+
'4. At the top of the page'], level: 2
|
55
|
+
|
56
|
+
subheading 'Update'
|
57
|
+
body 'issues a PUT to the passed path'
|
58
|
+
content do
|
59
|
+
button 'updates' do
|
60
|
+
event :click do
|
61
|
+
updates 'updatepath', {optional: :params}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
subheading 'Delete'
|
67
|
+
body 'issues a DELETE to the passed path'
|
68
|
+
content do
|
69
|
+
button 'deletes' do
|
70
|
+
event :click do
|
71
|
+
deletes 'deletepath', {optional: :params}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
subheading 'Posts'
|
75
|
+
body "issues a POST to the passed path\nAlias: creates"
|
76
|
+
content shows_errors: false do
|
77
|
+
button 'posts' do
|
78
|
+
event :click do
|
79
|
+
posts 'postpath', {optional: :params}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
Voom::Presenters.define(:trigger_dialog) do
|
2
|
+
attach :top_nav
|
3
|
+
attach :events_drawer
|
4
|
+
|
5
|
+
grid do
|
6
|
+
column 1
|
7
|
+
column 11 do
|
8
|
+
heading 'Events'
|
9
|
+
|
10
|
+
subheading 'Dialog'
|
11
|
+
button 'dialog' do
|
12
|
+
event :click do
|
13
|
+
dialog :my_dialog
|
14
|
+
end
|
15
|
+
end
|
16
|
+
attach :show_dialog
|
17
|
+
|
18
|
+
subheading 'Replaces'
|
19
|
+
button 'replaces' do
|
20
|
+
event :click do
|
21
|
+
replaces :replace_me, :replace_text, text: "I was replaced"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
attach :replace_text
|
25
|
+
|
26
|
+
subheading 'Toggle Visibility'
|
27
|
+
button 'toggle visiblity' do
|
28
|
+
event :click do
|
29
|
+
toggle_visiblity :toggle_me
|
30
|
+
end
|
31
|
+
end
|
32
|
+
heading 'Sometimes I appear', id: :toggle_me
|
33
|
+
|
34
|
+
subheading 'Snackbar'
|
35
|
+
button 'snackbar' do
|
36
|
+
event :click do
|
37
|
+
snackbar 'I want a snack!'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
subheading context['reloaded'] ? "Reloaded" : 'Loads'
|
42
|
+
button 'loads' do
|
43
|
+
event :click do
|
44
|
+
loads :events, reloaded: true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
heading context['reloaded'] ? "Reloaded" : 'Loaded'
|
48
|
+
|
49
|
+
title "A Note on errors:"
|
50
|
+
body ['These will display an error. Errors are displayed in four locations.',
|
51
|
+
'1. Field/input level errors will display on the field/input.',
|
52
|
+
'2. By default all content blocks will display errors. Use `show_errors=false` to turn this off on a block',
|
53
|
+
'3. At the top of all forms.',
|
54
|
+
'4. At the top of the page'], level: 2
|
55
|
+
|
56
|
+
subheading 'Update'
|
57
|
+
body 'issues a PUT to the passed path'
|
58
|
+
content do
|
59
|
+
button 'updates' do
|
60
|
+
event :click do
|
61
|
+
updates 'updatepath', {optional: :params}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
subheading 'Delete'
|
67
|
+
body 'issues a DELETE to the passed path'
|
68
|
+
content do
|
69
|
+
button 'deletes' do
|
70
|
+
event :click do
|
71
|
+
deletes 'deletepath', {optional: :params}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
subheading 'Posts'
|
75
|
+
body "issues a POST to the passed path\nAlias: creates"
|
76
|
+
content shows_errors: false do
|
77
|
+
button 'posts' do
|
78
|
+
event :click do
|
79
|
+
posts 'postpath', {optional: :params}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Voom::Presenters.define(:event_actions_menu) do
|
2
|
+
helpers Voom::Presenters::Helpers::Inflector
|
3
|
+
menu side: :left do
|
4
|
+
item 'Back', icon: :back do
|
5
|
+
event :click do
|
6
|
+
loads :events
|
7
|
+
end
|
8
|
+
end
|
9
|
+
%i(dialog).sort.each do |action|
|
10
|
+
item titleize(action) do
|
11
|
+
event :click do
|
12
|
+
loads "trigger_#{action}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Voom::Presenters.define(:autocomplete) do
|
2
|
+
helpers Demo::Helpers::IndentedGrid
|
3
|
+
attach :top_nav
|
4
|
+
|
5
|
+
indented_grid do
|
6
|
+
heading 'Search'
|
7
|
+
|
8
|
+
content id: :search_field do
|
9
|
+
text_field name: :search, full_width: false do
|
10
|
+
label 'Find waldo'
|
11
|
+
# icon :close do
|
12
|
+
# event :click do
|
13
|
+
# replaces :search_field, :search_field
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
event :input do
|
17
|
+
autocomplete '/_search_'
|
18
|
+
end
|
19
|
+
event :change do
|
20
|
+
replaces :context_list, :context_list, title: 'Search Results'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
attach :context_list, title: 'Search Results'
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Voom::Presenters.define(:field_level_events) do
|
2
|
+
attach :top_nav
|
3
|
+
|
4
|
+
grid do
|
5
|
+
column 1
|
6
|
+
column 4 do
|
7
|
+
card do
|
8
|
+
display 'Field Level Events'
|
9
|
+
heading 'Text Fields'
|
10
|
+
body 'This demonstrates that a change event will submit the field value to the event action. '\
|
11
|
+
'This works with posts and replace actions'
|
12
|
+
text_field name: :myfield do
|
13
|
+
label 'Data to post'
|
14
|
+
event :change do
|
15
|
+
replaces :context_list, :context_list
|
16
|
+
end
|
17
|
+
end
|
18
|
+
attach :context_list
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Voom::Presenters.define(:form_level_events) do
|
2
|
+
attach :top_nav
|
3
|
+
|
4
|
+
grid do
|
5
|
+
column 1
|
6
|
+
column 4 do
|
7
|
+
card 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
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Voom::Presenters.define(:events_menu) do
|
2
|
+
helpers Voom::Presenters::Helpers::Inflector
|
3
|
+
menu side: :left do
|
4
|
+
%i(event_actions field_level form_level).sort.each do |comp|
|
5
|
+
item titleize(comp) do
|
6
|
+
event :click do
|
7
|
+
loads comp
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
data/app/demo/events.pom
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require_relative 'helpers/indented_grid'
|
2
|
+
|
3
|
+
Voom::Presenters.define(:events) do
|
4
|
+
helpers Demo::Helpers::IndentedGrid
|
5
|
+
attach :top_nav
|
6
|
+
attach :events_drawer
|
7
|
+
|
8
|
+
|
9
|
+
indented_grid do
|
10
|
+
heading 'Events'
|
11
|
+
body 'Events are able to be attached to most components. ',
|
12
|
+
'Common examples include `click` and `change` events. ',
|
13
|
+
"To see how an individual component handles events, visit the [component page](#{presenters_path(:components)})"
|
14
|
+
|
15
|
+
subheading 'Dialog'
|
16
|
+
button 'dialog' do
|
17
|
+
event :click do
|
18
|
+
dialog :my_dialog
|
19
|
+
end
|
20
|
+
end
|
21
|
+
attach :show_dialog
|
22
|
+
|
23
|
+
subheading 'Replaces'
|
24
|
+
button 'replaces' do
|
25
|
+
event :click do
|
26
|
+
replaces :replace_me, :replace_text, text: "I was replaced"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
attach :replace_text
|
30
|
+
|
31
|
+
subheading 'Toggle Visibility'
|
32
|
+
button 'toggle visiblity' do
|
33
|
+
event :click do
|
34
|
+
toggle_visiblity :toggle_me
|
35
|
+
end
|
36
|
+
end
|
37
|
+
heading 'Sometimes I appear', id: :toggle_me
|
38
|
+
|
39
|
+
subheading 'Snackbar'
|
40
|
+
button 'snackbar' do
|
41
|
+
event :click do
|
42
|
+
snackbar 'I want a snack!'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
subheading context['reloaded'] ? "Reloaded" : 'Loads'
|
47
|
+
button 'loads' do
|
48
|
+
event :click do
|
49
|
+
loads :events, reloaded: true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
heading context['reloaded'] ? "Reloaded" : 'Loaded'
|
53
|
+
|
54
|
+
title "A Note on errors:"
|
55
|
+
body 'The following event actions will display an error.',
|
56
|
+
nil,
|
57
|
+
'Errors are automatically displayed in the following locations.',
|
58
|
+
'1. Field/input level errors will display on the field/input.',
|
59
|
+
'1. At the top of all forms.',
|
60
|
+
'1. At the top of all dialogs.',
|
61
|
+
'1. At the top of all cards.',
|
62
|
+
'1. At the top of content blocks if they turn on show_errors.',
|
63
|
+
'1. At the top of the page', level: 2
|
64
|
+
|
65
|
+
body 'The closest error element will be used.'\
|
66
|
+
'If you want to control where errors appear. Use the attribute `show_errors=(true|false)`'
|
67
|
+
|
68
|
+
|
69
|
+
subheading 'Update'
|
70
|
+
body 'issues a PUT to the passed path'
|
71
|
+
content shows_errors: true do
|
72
|
+
button 'updates' do
|
73
|
+
event :click do
|
74
|
+
updates 'updatepath', {optional: :params}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
subheading 'Delete'
|
79
|
+
body 'issues a DELETE to the passed path'
|
80
|
+
content shows_errors: true do
|
81
|
+
button 'deletes' do
|
82
|
+
event :click do
|
83
|
+
deletes 'deletepath', {optional: :params}
|
84
|
+
end
|
85
|
+
end
|
86
|
+
subheading 'Posts'
|
87
|
+
body "issues a POST to the passed path\nAlias: creates"
|
88
|
+
content do
|
89
|
+
button 'posts' do
|
90
|
+
event :click do
|
91
|
+
posts 'postpath', {optional: :params}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|