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
@@ -0,0 +1,36 @@
|
|
1
|
+
import flatpickr from "flatpickr";
|
2
|
+
import {VTextField} from './text-fields';
|
3
|
+
import {MDCTextField} from '@material/textfield';
|
4
|
+
|
5
|
+
|
6
|
+
export function initDateTime() {
|
7
|
+
console.log('\tDateTime');
|
8
|
+
let components = document.querySelectorAll('.v-datetime');
|
9
|
+
for (let i = 0; i < components.length; i++) {
|
10
|
+
let component = components[i];
|
11
|
+
if (!component.vComponent) {
|
12
|
+
component.vComponent = new VDateTime(component, new MDCTextField(component));
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
export class VDateTime extends VTextField {
|
19
|
+
constructor(element, mdcComponent) {
|
20
|
+
super(element, mdcComponent);
|
21
|
+
let config = JSON.parse(element.dataset.config);
|
22
|
+
config.altInput = true;
|
23
|
+
let type = element.dataset.type;
|
24
|
+
|
25
|
+
if(type==='datetime'){
|
26
|
+
config.enableTime = true;
|
27
|
+
}else if(type==='time'){
|
28
|
+
config.enableTime=true;
|
29
|
+
config.noCalendar=true;
|
30
|
+
}
|
31
|
+
flatpickr(this.input, config);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
|
@@ -16,9 +16,9 @@ export class VBase extends VUrls {
|
|
16
16
|
}
|
17
17
|
|
18
18
|
inputValues(form) {
|
19
|
-
|
19
|
+
let params = [];
|
20
20
|
// Let input component push parameters
|
21
|
-
|
21
|
+
let vComp = this.component();
|
22
22
|
if (vComp) {
|
23
23
|
vComp.prepareSubmit(form, params);
|
24
24
|
}
|
@@ -27,12 +27,12 @@ export class VBase extends VUrls {
|
|
27
27
|
|
28
28
|
component() {
|
29
29
|
let parent = this.parentElement();
|
30
|
-
return parent ?
|
30
|
+
return parent ? parent.vComponent : null;
|
31
31
|
}
|
32
32
|
|
33
33
|
validate() {
|
34
|
-
|
35
|
-
|
34
|
+
let errors = [];
|
35
|
+
let comp = this.component();
|
36
36
|
if (comp) {
|
37
37
|
errors = comp.validate();
|
38
38
|
}
|
@@ -24,7 +24,7 @@ export class VForm {
|
|
24
24
|
console.log("Form validate", form, params);
|
25
25
|
var errors = [];
|
26
26
|
for (let input of this.inputs()) {
|
27
|
-
if (input.vComponent) {
|
27
|
+
if (input.vComponent && input.vComponent.validate) {
|
28
28
|
var result = input.vComponent.validate(form, params);
|
29
29
|
if (result !== true) {
|
30
30
|
errors.push(result);
|
@@ -41,7 +41,7 @@ export class VForm {
|
|
41
41
|
// Called to collect data for submission
|
42
42
|
prepareSubmit(form, params) {
|
43
43
|
for (let input of this.inputs()) {
|
44
|
-
if (input.vComponent) {
|
44
|
+
if (input.vComponent && input.vComponent.prepareSubmit) {
|
45
45
|
input.vComponent.prepareSubmit(form, params);
|
46
46
|
}
|
47
47
|
}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import {initButtons} from './button';
|
2
2
|
import {initDialogs} from './dialogs';
|
3
|
+
import {initDateTime} from './datetime';
|
3
4
|
import {initTextFields} from './text-fields';
|
4
5
|
import {initEvents} from './events';
|
5
6
|
import {initLists} from './lists';
|
@@ -11,13 +12,13 @@ import {initCards} from './cards';
|
|
11
12
|
import {initForms} from './forms';
|
12
13
|
import {initSnackbar} from './snackbar';
|
13
14
|
import {initCheckboxes} from './checkboxes';
|
14
|
-
import {initDateTime} from './date-time';
|
15
15
|
import {initSwitches} from './switches';
|
16
16
|
|
17
17
|
export function initialize(){
|
18
18
|
console.log('Initializing');
|
19
19
|
initButtons();
|
20
20
|
initDialogs();
|
21
|
+
initDateTime();// MUST BE BEFORE initTextFields
|
21
22
|
initTextFields();
|
22
23
|
initLists();
|
23
24
|
initIconToggles();
|
@@ -28,7 +29,6 @@ export function initialize(){
|
|
28
29
|
initForms();
|
29
30
|
initSnackbar();
|
30
31
|
initCheckboxes();
|
31
|
-
initDateTime();
|
32
32
|
initSwitches();
|
33
33
|
// This needs to be last, because it relies on the components installed above.
|
34
34
|
initEvents();
|
@@ -9,10 +9,7 @@ export function initTextFields() {
|
|
9
9
|
for (var i = 0; i < textFields.length; i++) {
|
10
10
|
var textField = textFields[i];
|
11
11
|
if (!textField.vComponent) {
|
12
|
-
|
13
|
-
var input = textField.querySelector('input');
|
14
|
-
input.vComponent = vTextField;
|
15
|
-
textField.vComponent = vTextField;
|
12
|
+
textField.vComponent = new VTextField(textField, new MDCTextField(textField));
|
16
13
|
}
|
17
14
|
}
|
18
15
|
}
|
@@ -21,6 +18,7 @@ export class VTextField extends eventHandlerMixin(VBaseComponent) {
|
|
21
18
|
constructor(element, mdcComponent) {
|
22
19
|
super(element);
|
23
20
|
this.input = element.querySelector('input');
|
21
|
+
this.input.vComponent = this;
|
24
22
|
this.mdcComponent = mdcComponent;
|
25
23
|
}
|
26
24
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@import "vendor/flatpickr.min";
|
2
|
+
|
3
|
+
.mdc-text-field__icon.v-datetime--clear {
|
4
|
+
right: 15px;
|
5
|
+
left: initial;
|
6
|
+
}
|
7
|
+
|
8
|
+
// Fixes the follwing bug: https://github.com/material-components/material-components-web/issues/2044
|
9
|
+
.v-datetime.mdc-text-field--fullwidth:not(.mdc-text-field--textarea) .mdc-text-field__input {
|
10
|
+
padding-right: 48px;
|
11
|
+
.mdc-text-field--with-leading-icon {
|
12
|
+
padding-left: 48px;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
.v-datetime.mdc-text-field--fullwidth:not(.mdc-text-field--textarea).mdc-text-field--with-leading-icon .mdc-text-field__input {
|
17
|
+
padding-right: 48px;
|
18
|
+
padding-left: 48px;
|
19
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px);}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.rightMost:after{left:auto;right:22px}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:28px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;line-height:16px;height:28px;padding:10px;z-index:3;}.flatpickr-months .flatpickr-prev-month.disabled,.flatpickr-months .flatpickr-next-month.disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/*
|
2
|
+
/*rtl:begin:ignore*/left:0;/*
|
3
|
+
/*rtl:end:ignore*/}/*
|
4
|
+
/*rtl:begin:ignore*/
|
5
|
+
/*
|
6
|
+
/*rtl:end:ignore*/
|
7
|
+
.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{/*
|
8
|
+
/*rtl:begin:ignore*/right:0;/*
|
9
|
+
/*rtl:end:ignore*/}/*
|
10
|
+
/*rtl:begin:ignore*/
|
11
|
+
/*
|
12
|
+
/*rtl:end:ignore*/
|
13
|
+
.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9;}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px;}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto;}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%;}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box;}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0;}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%;}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto;}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05);}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:6.16px 0 0 0;line-height:1;height:28px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0;}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block;}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px;}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px;}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1;}.dayContainer + .dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9;}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.disabled,.flatpickr-day.disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.disabled,.flatpickr-day.disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{display:inline-block;float:left;}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left;}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;cursor:pointer;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;display:inline-block;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400;}.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time .flatpickr-am-pm:focus{background:#f0f0f0}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= erb :"components/datetime", :locals => {comp: comp} %>
|
@@ -1,29 +1,34 @@
|
|
1
1
|
<%
|
2
|
-
|
2
|
+
time_val = comp.value ? Array(comp.value).map{ |v| v.respond_to?(:strftime) ? v.strftime("%Y-%m-%dT%H:%M:%S.%L") : v}.join(', ') : nil
|
3
3
|
%>
|
4
4
|
<div id="<%= comp.id %>"
|
5
|
-
|
6
|
-
<%= 'mdc-text-field--with-
|
5
|
+
class="mdc-text-field v-datetime
|
6
|
+
<%= comp.icon ? 'mdc-text-field--with-leading-icon' : 'mdc-text-field--with-trailing-icon' %>
|
7
7
|
<%= 'mdc-text-field--fullwidth' if comp.full_width %>
|
8
|
-
<%= 'is-invalid is-dirty' if comp.error %>"
|
9
|
-
|
8
|
+
<%= 'is-invalid is-dirty' if comp.error %>"
|
9
|
+
data-config='<%= snake_to_camel(comp.config, except: %i(time_24hr)).to_json %>'
|
10
|
+
data-type='<%= comp.type %>'>
|
11
|
+
<%= erb :"components/icon", :locals => {comp: comp.icon, class_name: 'mdc-text-field__icon',
|
12
|
+
parent_id: "#{comp.id}-input"} %>
|
10
13
|
<input id="<%= comp.id %>-input"
|
11
14
|
name="<%= comp.name %>"
|
12
|
-
type="
|
15
|
+
type="text"
|
13
16
|
value="<%= time_val %>"
|
14
17
|
class="mdc-text-field__input"
|
15
18
|
aria-controls="<%= comp.id %>-input-helper-text"
|
19
|
+
data-input
|
16
20
|
<%= 'required' if comp.required %>
|
17
21
|
<%= 'invalid' if comp.error %>
|
18
22
|
<%= "pattern='#{comp.pattern}'" if comp.pattern %>
|
19
23
|
<%= 'readonly' if comp.readonly %>
|
20
24
|
list="<%= comp.id %>-list"
|
21
|
-
<%= erb :"components/event", :locals => {events: comp.events, parent_id:
|
25
|
+
<%= erb :"components/event", :locals => {events: comp.events, parent_id: "#{comp.id}-input"} %>>
|
22
26
|
<label class='mdc-floating-label mdc-floating-label--float-above' for="<%= comp.id %>"><%= comp.label %></label>
|
23
27
|
<div class="mdc-line-ripple"></div>
|
24
28
|
<datalist id="<%= comp.id %>-list">
|
25
29
|
</datalist>
|
26
|
-
|
30
|
+
<%= erb :"components/icon", :locals => {comp: comp.clear_icon, class_name: 'v-datetime--clear mdc-text-field__icon',
|
31
|
+
parent_id: "#{comp.id}-input"} %>
|
27
32
|
</div>
|
28
33
|
<p id="<%= comp.id %>-input-helper-text" class="mdc-text-field-helper-text" aria-hidden="true">
|
29
34
|
<%= comp.error || comp.hint %>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% class_name = '' unless local_variables.include? :class_name
|
2
|
+
data = nil unless local_variables.include? :data
|
2
3
|
%>
|
3
4
|
<% if comp
|
4
5
|
parent_id = comp.event_parent_id unless locals.include? :parent_id
|
@@ -20,6 +21,7 @@
|
|
20
21
|
class="<%= class_name %> <%= icon_class_name %>
|
21
22
|
<%= 'v-actionable' if comp.events %>
|
22
23
|
<%= color_classname(comp) %>"
|
24
|
+
<%= "data-#{data}" if data %>
|
23
25
|
style = "<%= color_style(comp) %>
|
24
26
|
<%= "font-size: #{comp.size}" if comp.size %>"
|
25
27
|
<%= 'tabindex="1"' if class_name.include?('mdc-text-field__icon') && comp.events %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div id="<%= comp.id %>"
|
2
|
-
class="mdc-text-field
|
2
|
+
class="mdc-text-field v-text-field
|
3
3
|
<%= 'mdc-text-field--with-trailing-icon' if comp.icon %>
|
4
4
|
<%= 'mdc-text-field--fullwidth' if comp.full_width %>
|
5
5
|
<%= 'is-invalid is-dirty' if comp.error %>">
|
@@ -8,7 +8,8 @@
|
|
8
8
|
name="<%= comp.name %>"
|
9
9
|
type="<%= comp.password ? 'password' : 'text' %>"
|
10
10
|
value="<%= comp.value %>"
|
11
|
-
class="mdc-text-field__input
|
11
|
+
class="mdc-text-field__input
|
12
|
+
<%= 'mdc-text-field--trailing' if comp.icon %>"
|
12
13
|
aria-controls="<%= comp.id %>-input-helper-text"
|
13
14
|
<%= 'required' if comp.required %>
|
14
15
|
<%= 'invalid' if comp.error %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= erb :"components/datetime", :locals => {comp: comp} %>
|
data/views/mdc/layout.erb
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
<!-- Place favicon.ico in the root directory -->
|
15
15
|
<!--MDC-->
|
16
16
|
<link rel="stylesheet" href="<%= env['SCRIPT_NAME'] %>/bundle.css">
|
17
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
|
17
18
|
<script src="<%= env['SCRIPT_NAME'] %>/bundle.js"></script>
|
18
19
|
|
19
20
|
</head>
|
data/views/mdc/package-lock.json
CHANGED
@@ -3098,6 +3098,11 @@
|
|
3098
3098
|
"pinkie-promise": "2.0.1"
|
3099
3099
|
}
|
3100
3100
|
},
|
3101
|
+
"flatpickr": {
|
3102
|
+
"version": "4.4.6",
|
3103
|
+
"resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.4.6.tgz",
|
3104
|
+
"integrity": "sha512-5b4aJtMBiyXyg5paf3lZ872t1Qjt7Qv4SNqChKh2AvP+OYaC1jrutty0goW6WvvkASoamzeFEFbPJIBdHqxNRA=="
|
3105
|
+
},
|
3101
3106
|
"flatten": {
|
3102
3107
|
"version": "1.0.2",
|
3103
3108
|
"resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz",
|
data/views/mdc/package.json
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
"start": "webpack"
|
4
4
|
},
|
5
5
|
"devDependencies": {
|
6
|
-
"@material/button": "^0.34.1",
|
7
6
|
"css-loader": "^0.28.11",
|
8
7
|
"extract-loader": "^2.0.1",
|
9
8
|
"l": "^0.6.0",
|
@@ -34,6 +33,7 @@
|
|
34
33
|
"@material/textfield": "^0.34.1",
|
35
34
|
"@material/toolbar": "^0.34.1",
|
36
35
|
"@material/typography": "^0.34.0",
|
36
|
+
"flatpickr": "^4.4.6",
|
37
37
|
"material-design-lite": "^1.3.0"
|
38
38
|
}
|
39
39
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voom-presenters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Edens
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ice_nine
|
@@ -219,7 +219,6 @@ files:
|
|
219
219
|
- Gemfile
|
220
220
|
- Gemfile.lock
|
221
221
|
- LICENSE
|
222
|
-
- LICENSE.txt
|
223
222
|
- README.md
|
224
223
|
- ROADMAP.md
|
225
224
|
- Rakefile
|
@@ -229,6 +228,8 @@ files:
|
|
229
228
|
- app/demo/components/buttons.pom
|
230
229
|
- app/demo/components/cards.pom
|
231
230
|
- app/demo/components/chips.pom
|
231
|
+
- app/demo/components/date_fields.pom
|
232
|
+
- app/demo/components/datetime_fields.pom
|
232
233
|
- app/demo/components/dialogs.pom
|
233
234
|
- app/demo/components/drawers.pom
|
234
235
|
- app/demo/components/expansion_panels.pom
|
@@ -250,20 +251,26 @@ files:
|
|
250
251
|
- app/demo/components/tables.pom
|
251
252
|
- app/demo/components/text_areas.pom
|
252
253
|
- app/demo/components/text_fields.pom
|
254
|
+
- app/demo/components/time_fields.pom
|
253
255
|
- app/demo/components/toggles.pom
|
254
256
|
- app/demo/components/tooltips.pom
|
255
|
-
- app/demo/event/actions.rb
|
256
|
-
- app/demo/event/actions/dialog/show_dialog.pom
|
257
|
-
- app/demo/event/actions/dialog/trigger.pom
|
258
|
-
- app/demo/event/actions/nav/drawer.pom
|
259
|
-
- app/demo/event/actions/nav/menu.pom
|
260
|
-
- app/demo/event/autocomplete.pom
|
261
|
-
- app/demo/event/field_level.pom
|
262
|
-
- app/demo/event/form_level.pom
|
263
|
-
- app/demo/event/nav/drawer.pom
|
264
|
-
- app/demo/event/nav/menu.pom
|
265
|
-
- app/demo/event/new_text.pom
|
266
257
|
- app/demo/events.pom
|
258
|
+
- app/demo/events/actions/autocomplete.pom
|
259
|
+
- app/demo/events/actions/deletes.pom
|
260
|
+
- app/demo/events/actions/dialog.pom
|
261
|
+
- app/demo/events/actions/dialogs/show_dialog.pom
|
262
|
+
- app/demo/events/actions/dialogs/trigger.pom
|
263
|
+
- app/demo/events/actions/loads.pom
|
264
|
+
- app/demo/events/actions/posts.pom
|
265
|
+
- app/demo/events/actions/replace_text.pom
|
266
|
+
- app/demo/events/actions/replaces.pom
|
267
|
+
- app/demo/events/actions/snackbar.pom
|
268
|
+
- app/demo/events/actions/toggle_visiblity.pom
|
269
|
+
- app/demo/events/actions/updates.pom
|
270
|
+
- app/demo/events/field_level.pom
|
271
|
+
- app/demo/events/form_level.pom
|
272
|
+
- app/demo/events/nav/drawer.pom
|
273
|
+
- app/demo/formatting_tokens.pom
|
267
274
|
- app/demo/helpers/indented_grid.rb
|
268
275
|
- app/demo/index.pom
|
269
276
|
- app/demo/markdown.pom
|
@@ -299,7 +306,9 @@ files:
|
|
299
306
|
- lib/voom/presenters/dsl/components/checkbox.rb
|
300
307
|
- lib/voom/presenters/dsl/components/chip.rb
|
301
308
|
- lib/voom/presenters/dsl/components/content.rb
|
302
|
-
- lib/voom/presenters/dsl/components/
|
309
|
+
- lib/voom/presenters/dsl/components/date_field.rb
|
310
|
+
- lib/voom/presenters/dsl/components/datetime_base.rb
|
311
|
+
- lib/voom/presenters/dsl/components/datetime_field.rb
|
303
312
|
- lib/voom/presenters/dsl/components/dialog.rb
|
304
313
|
- lib/voom/presenters/dsl/components/drawer.rb
|
305
314
|
- lib/voom/presenters/dsl/components/event.rb
|
@@ -327,6 +336,7 @@ files:
|
|
327
336
|
- lib/voom/presenters/dsl/components/mixins/chips.rb
|
328
337
|
- lib/voom/presenters/dsl/components/mixins/common.rb
|
329
338
|
- lib/voom/presenters/dsl/components/mixins/content.rb
|
339
|
+
- lib/voom/presenters/dsl/components/mixins/date_time_fields.rb
|
330
340
|
- lib/voom/presenters/dsl/components/mixins/dialogs.rb
|
331
341
|
- lib/voom/presenters/dsl/components/mixins/event.rb
|
332
342
|
- lib/voom/presenters/dsl/components/mixins/expansion_panels.rb
|
@@ -350,6 +360,7 @@ files:
|
|
350
360
|
- lib/voom/presenters/dsl/components/table.rb
|
351
361
|
- lib/voom/presenters/dsl/components/text_area.rb
|
352
362
|
- lib/voom/presenters/dsl/components/text_field.rb
|
363
|
+
- lib/voom/presenters/dsl/components/time_field.rb
|
353
364
|
- lib/voom/presenters/dsl/components/toggle_base.rb
|
354
365
|
- lib/voom/presenters/dsl/components/tooltip.rb
|
355
366
|
- lib/voom/presenters/dsl/components/typography.rb
|
@@ -361,11 +372,12 @@ files:
|
|
361
372
|
- lib/voom/presenters/errors/parameter_validation.rb
|
362
373
|
- lib/voom/presenters/errors/unprocessable.rb
|
363
374
|
- lib/voom/presenters/helpers.rb
|
364
|
-
- lib/voom/presenters/helpers/currency.rb
|
365
375
|
- lib/voom/presenters/helpers/date.rb
|
366
376
|
- lib/voom/presenters/helpers/errors.rb
|
367
377
|
- lib/voom/presenters/helpers/inflector.rb
|
368
378
|
- lib/voom/presenters/helpers/rails.rb
|
379
|
+
- lib/voom/presenters/helpers/rails/currency.rb
|
380
|
+
- lib/voom/presenters/helpers/rails/model_table.rb
|
369
381
|
- lib/voom/presenters/helpers/route.rb
|
370
382
|
- lib/voom/presenters/helpers/time.rb
|
371
383
|
- lib/voom/presenters/settings.rb
|
@@ -404,7 +416,7 @@ files:
|
|
404
416
|
- views/mdc/assets/js/components/cards.js
|
405
417
|
- views/mdc/assets/js/components/checkboxes.js
|
406
418
|
- views/mdc/assets/js/components/chips.js
|
407
|
-
- views/mdc/assets/js/components/
|
419
|
+
- views/mdc/assets/js/components/datetime.js
|
408
420
|
- views/mdc/assets/js/components/dialogs.js
|
409
421
|
- views/mdc/assets/js/components/events.js
|
410
422
|
- views/mdc/assets/js/components/events/autocomplete.js
|
@@ -453,6 +465,7 @@ files:
|
|
453
465
|
- views/mdc/assets/scss/components/table-pagination.scss
|
454
466
|
- views/mdc/assets/scss/components/textfield.scss
|
455
467
|
- views/mdc/assets/scss/components/typography.scss
|
468
|
+
- views/mdc/assets/scss/components/vendor/flatpickr.min.css
|
456
469
|
- views/mdc/assets/scss/material.blue_grey-orange.min.css
|
457
470
|
- views/mdc/assets/scss/styles.scss
|
458
471
|
- views/mdc/assets/scss/theme.scss
|
@@ -475,7 +488,8 @@ files:
|
|
475
488
|
- views/mdc/components/checkbox.erb
|
476
489
|
- views/mdc/components/chip.erb
|
477
490
|
- views/mdc/components/content.erb
|
478
|
-
- views/mdc/components/
|
491
|
+
- views/mdc/components/date.erb
|
492
|
+
- views/mdc/components/datetime.erb
|
479
493
|
- views/mdc/components/dialog.erb
|
480
494
|
- views/mdc/components/display.erb
|
481
495
|
- views/mdc/components/event.erb
|
@@ -518,6 +532,7 @@ files:
|
|
518
532
|
- views/mdc/components/table/row.erb
|
519
533
|
- views/mdc/components/text_area.erb
|
520
534
|
- views/mdc/components/text_field.erb
|
535
|
+
- views/mdc/components/time.erb
|
521
536
|
- views/mdc/components/title.erb
|
522
537
|
- views/mdc/components/tooltip.erb
|
523
538
|
- views/mdc/components/typography.erb
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Russell Edens
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
@@ -1,19 +0,0 @@
|
|
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
|
-
|
data/app/demo/event/actions.rb
DELETED
@@ -1,86 +0,0 @@
|
|
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
|
@@ -1,27 +0,0 @@
|
|
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
|