matestack-ui-core 1.5.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +17 -5
- data/README.md +78 -115
- data/Rakefile +0 -2
- data/lib/matestack/ui/app.rb +1 -0
- data/lib/matestack/ui/component.rb +1 -0
- data/lib/matestack/ui/core.rb +58 -10
- data/lib/matestack/ui/core/app.rb +36 -0
- data/lib/matestack/ui/core/base.rb +109 -0
- data/lib/matestack/ui/core/component.rb +8 -0
- data/lib/matestack/ui/core/context.rb +17 -0
- data/lib/matestack/ui/core/helper.rb +91 -0
- data/lib/matestack/ui/core/page.rb +63 -0
- data/lib/matestack/ui/core/properties.rb +105 -0
- data/lib/matestack/ui/core/slots.rb +15 -0
- data/lib/matestack/ui/core/tag_helper.rb +94 -0
- data/lib/matestack/ui/core/version.rb +1 -1
- data/lib/matestack/ui/core/vue_attributes.rb +13 -0
- data/lib/matestack/ui/page.rb +1 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js}/app/app.js +2 -3
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js}/app/location.js +0 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js}/app/store.js +1 -1
- data/lib/matestack/ui/vue_js/components.rb +94 -0
- data/lib/matestack/ui/vue_js/components/action.js +151 -0
- data/lib/matestack/ui/vue_js/components/action.rb +46 -0
- data/{app/concepts/matestack/ui/core/async → lib/matestack/ui/vue_js/components}/async.js +22 -22
- data/lib/matestack/ui/vue_js/components/async.rb +84 -0
- data/{app/concepts/matestack/ui/core/cable → lib/matestack/ui/vue_js/components}/cable.js +14 -14
- data/lib/matestack/ui/vue_js/components/cable.rb +69 -0
- data/{app/concepts/matestack/ui/core/collection/content → lib/matestack/ui/vue_js/components/collection}/content.js +21 -22
- data/lib/matestack/ui/vue_js/components/collection/content.rb +32 -0
- data/lib/matestack/ui/vue_js/components/collection/filter.js +45 -0
- data/lib/matestack/ui/vue_js/components/collection/filter.rb +29 -0
- data/lib/matestack/ui/vue_js/components/collection/filter_reset.rb +19 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js/components}/collection/helper.rb +66 -65
- data/lib/matestack/ui/vue_js/components/collection/next.rb +19 -0
- data/lib/matestack/ui/vue_js/components/collection/order.js +46 -0
- data/lib/matestack/ui/vue_js/components/collection/order.rb +28 -0
- data/lib/matestack/ui/vue_js/components/collection/order_toggle.rb +21 -0
- data/lib/matestack/ui/vue_js/components/collection/order_toggle_indicator.rb +30 -0
- data/lib/matestack/ui/vue_js/components/collection/page.rb +21 -0
- data/lib/matestack/ui/vue_js/components/collection/previous.rb +19 -0
- data/lib/matestack/ui/vue_js/components/form/base.rb +167 -0
- data/{app/concepts/matestack/ui/core/form/checkbox → lib/matestack/ui/vue_js/components/form}/checkbox.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/checkbox.rb +105 -0
- data/{app/concepts/matestack/ui/core/form/checkbox/mixin.js → lib/matestack/ui/vue_js/components/form/checkbox_mixin.js} +5 -2
- data/lib/matestack/ui/vue_js/components/form/context.rb +15 -0
- data/{app/concepts/matestack/ui/core → lib/matestack/ui/vue_js/components}/form/form.js +53 -53
- data/lib/matestack/ui/vue_js/components/form/form.rb +64 -0
- data/{app/concepts/matestack/ui/core/form/input → lib/matestack/ui/vue_js/components/form}/input.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/input.rb +37 -0
- data/{app/concepts/matestack/ui/core/form/input/mixin.js → lib/matestack/ui/vue_js/components/form/input_mixin.js} +5 -2
- data/{app/concepts/matestack/ui/core/form/radio → lib/matestack/ui/vue_js/components/form}/radio.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/radio.rb +76 -0
- data/{app/concepts/matestack/ui/core/form/radio/mixin.js → lib/matestack/ui/vue_js/components/form/radio_mixin.js} +4 -1
- data/{app/concepts/matestack/ui/core/form/select → lib/matestack/ui/vue_js/components/form}/select.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/select.rb +88 -0
- data/{app/concepts/matestack/ui/core/form/select/mixin.js → lib/matestack/ui/vue_js/components/form/select_mixin.js} +5 -2
- data/{app/concepts/matestack/ui/core/form/textarea → lib/matestack/ui/vue_js/components/form}/textarea.js +2 -2
- data/lib/matestack/ui/vue_js/components/form/textarea.rb +37 -0
- data/{app/concepts/matestack/ui/core/form/textarea/mixin.js → lib/matestack/ui/vue_js/components/form/textarea_mixin.js} +5 -2
- data/{app/concepts/matestack/ui/core/isolated → lib/matestack/ui/vue_js/components}/isolated.js +19 -19
- data/lib/matestack/ui/vue_js/components/isolated.rb +86 -0
- data/{app/concepts/matestack/ui/core/component/component.js → lib/matestack/ui/vue_js/components/mixin.js} +2 -2
- data/{app/concepts/matestack/ui/core/onclick → lib/matestack/ui/vue_js/components}/onclick.js +3 -4
- data/lib/matestack/ui/vue_js/components/onclick.rb +37 -0
- data/{app/concepts/matestack/ui/core/toggle → lib/matestack/ui/vue_js/components}/toggle.js +17 -17
- data/lib/matestack/ui/vue_js/components/toggle.rb +38 -0
- data/{app/concepts/matestack/ui/core/transition → lib/matestack/ui/vue_js/components}/transition.js +6 -6
- data/lib/matestack/ui/vue_js/components/transition.rb +40 -0
- data/lib/matestack/ui/vue_js/event_hub.js +5 -0
- data/{app/concepts/matestack/ui/core/js/helpers/query-params-helper.js → lib/matestack/ui/vue_js/helpers/query_params_helper.js} +0 -0
- data/lib/matestack/ui/vue_js/index.js +52 -0
- data/lib/matestack/ui/vue_js/initialize.rb +5 -0
- data/{app/concepts/matestack/ui/core/page/content → lib/matestack/ui/vue_js/page}/content.js +1 -1
- data/lib/matestack/ui/vue_js/vue.rb +63 -0
- data/lib/matestack/ui/vue_js_component.rb +2 -0
- metadata +75 -404
- data/app/concepts/matestack/ui/core/abbr/abbr.haml +0 -5
- data/app/concepts/matestack/ui/core/abbr/abbr.rb +0 -5
- data/app/concepts/matestack/ui/core/action/action.haml +0 -3
- data/app/concepts/matestack/ui/core/action/action.js +0 -152
- data/app/concepts/matestack/ui/core/action/action.rb +0 -80
- data/app/concepts/matestack/ui/core/actionview/dynamic.haml +0 -6
- data/app/concepts/matestack/ui/core/actionview/dynamic.rb +0 -28
- data/app/concepts/matestack/ui/core/actionview/static.haml +0 -1
- data/app/concepts/matestack/ui/core/actionview/static.rb +0 -28
- data/app/concepts/matestack/ui/core/address/address.haml +0 -5
- data/app/concepts/matestack/ui/core/address/address.rb +0 -5
- data/app/concepts/matestack/ui/core/app/app.haml +0 -3
- data/app/concepts/matestack/ui/core/app/app.rb +0 -51
- data/app/concepts/matestack/ui/core/area/area.haml +0 -1
- data/app/concepts/matestack/ui/core/area/area.rb +0 -6
- data/app/concepts/matestack/ui/core/article/article.haml +0 -5
- data/app/concepts/matestack/ui/core/article/article.rb +0 -5
- data/app/concepts/matestack/ui/core/aside/aside.haml +0 -3
- data/app/concepts/matestack/ui/core/aside/aside.rb +0 -4
- data/app/concepts/matestack/ui/core/async/async.haml +0 -6
- data/app/concepts/matestack/ui/core/async/async.rb +0 -37
- data/app/concepts/matestack/ui/core/async/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/b/b.haml +0 -5
- data/app/concepts/matestack/ui/core/b/b.rb +0 -5
- data/app/concepts/matestack/ui/core/bdi/bdi.haml +0 -5
- data/app/concepts/matestack/ui/core/bdi/bdi.rb +0 -5
- data/app/concepts/matestack/ui/core/bdo/bdo.haml +0 -5
- data/app/concepts/matestack/ui/core/bdo/bdo.rb +0 -6
- data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +0 -5
- data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +0 -6
- data/app/concepts/matestack/ui/core/br/br.haml +0 -5
- data/app/concepts/matestack/ui/core/br/br.rb +0 -5
- data/app/concepts/matestack/ui/core/button/button.haml +0 -5
- data/app/concepts/matestack/ui/core/button/button.rb +0 -7
- data/app/concepts/matestack/ui/core/cable/cable.haml +0 -4
- data/app/concepts/matestack/ui/core/cable/cable.rb +0 -28
- data/app/concepts/matestack/ui/core/cable/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/caption/caption.haml +0 -5
- data/app/concepts/matestack/ui/core/caption/caption.rb +0 -5
- data/app/concepts/matestack/ui/core/cite/cite.haml +0 -5
- data/app/concepts/matestack/ui/core/cite/cite.rb +0 -5
- data/app/concepts/matestack/ui/core/code/code.haml +0 -5
- data/app/concepts/matestack/ui/core/code/code.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/content/content.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/content/next/next.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/next/next.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +0 -7
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/content/previous/previous.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/filter/filter.js +0 -48
- data/app/concepts/matestack/ui/core/collection/filter/filter.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +0 -28
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/filter/reset/reset.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/filter/select/select.haml +0 -10
- data/app/concepts/matestack/ui/core/collection/filter/select/select.rb +0 -30
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/filter/submit/submit.rb +0 -5
- data/app/concepts/matestack/ui/core/collection/order/order.js +0 -56
- data/app/concepts/matestack/ui/core/collection/order/order.rb +0 -16
- data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +0 -17
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +0 -3
- data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +0 -4
- data/app/concepts/matestack/ui/core/component/anonym-dynamic-component.js +0 -10
- data/app/concepts/matestack/ui/core/component/base.rb +0 -430
- data/app/concepts/matestack/ui/core/component/children.haml +0 -2
- data/app/concepts/matestack/ui/core/component/dynamic.haml +0 -6
- data/app/concepts/matestack/ui/core/component/dynamic.rb +0 -47
- data/app/concepts/matestack/ui/core/component/dynamic_without_rerender.haml +0 -2
- data/app/concepts/matestack/ui/core/component/static.rb +0 -7
- data/app/concepts/matestack/ui/core/data/data.haml +0 -5
- data/app/concepts/matestack/ui/core/data/data.rb +0 -6
- data/app/concepts/matestack/ui/core/datalist/datalist.haml +0 -3
- data/app/concepts/matestack/ui/core/datalist/datalist.rb +0 -4
- data/app/concepts/matestack/ui/core/dd/dd.haml +0 -5
- data/app/concepts/matestack/ui/core/dd/dd.rb +0 -5
- data/app/concepts/matestack/ui/core/del/del.haml +0 -5
- data/app/concepts/matestack/ui/core/del/del.rb +0 -6
- data/app/concepts/matestack/ui/core/details/details.haml +0 -3
- data/app/concepts/matestack/ui/core/details/details.rb +0 -5
- data/app/concepts/matestack/ui/core/dfn/dfn.haml +0 -5
- data/app/concepts/matestack/ui/core/dfn/dfn.rb +0 -6
- data/app/concepts/matestack/ui/core/dialog/dialog.haml +0 -5
- data/app/concepts/matestack/ui/core/dialog/dialog.rb +0 -6
- data/app/concepts/matestack/ui/core/div/div.haml +0 -3
- data/app/concepts/matestack/ui/core/div/div.rb +0 -4
- data/app/concepts/matestack/ui/core/dl/dl.haml +0 -5
- data/app/concepts/matestack/ui/core/dl/dl.rb +0 -5
- data/app/concepts/matestack/ui/core/dt/dt.haml +0 -5
- data/app/concepts/matestack/ui/core/dt/dt.rb +0 -5
- data/app/concepts/matestack/ui/core/em/em.haml +0 -5
- data/app/concepts/matestack/ui/core/em/em.rb +0 -5
- data/app/concepts/matestack/ui/core/fieldset/fieldset.haml +0 -5
- data/app/concepts/matestack/ui/core/fieldset/fieldset.rb +0 -6
- data/app/concepts/matestack/ui/core/figure/figure.haml +0 -3
- data/app/concepts/matestack/ui/core/figure/figure.rb +0 -4
- data/app/concepts/matestack/ui/core/footer/footer.haml +0 -3
- data/app/concepts/matestack/ui/core/footer/footer.rb +0 -4
- data/app/concepts/matestack/ui/core/form/checkbox/base.rb +0 -120
- data/app/concepts/matestack/ui/core/form/checkbox/checkbox.rb +0 -16
- data/app/concepts/matestack/ui/core/form/form.haml +0 -2
- data/app/concepts/matestack/ui/core/form/form.rb +0 -104
- data/app/concepts/matestack/ui/core/form/has_errors.rb +0 -54
- data/app/concepts/matestack/ui/core/form/has_input_html_attributes.rb +0 -13
- data/app/concepts/matestack/ui/core/form/input/base.rb +0 -75
- data/app/concepts/matestack/ui/core/form/input/input.rb +0 -17
- data/app/concepts/matestack/ui/core/form/radio/base.rb +0 -90
- data/app/concepts/matestack/ui/core/form/radio/radio.rb +0 -16
- data/app/concepts/matestack/ui/core/form/select/base.rb +0 -98
- data/app/concepts/matestack/ui/core/form/select/select.rb +0 -19
- data/app/concepts/matestack/ui/core/form/submit/base.rb +0 -12
- data/app/concepts/matestack/ui/core/form/submit/submit.js +0 -19
- data/app/concepts/matestack/ui/core/form/submit/submit.rb +0 -15
- data/app/concepts/matestack/ui/core/form/textarea/base.rb +0 -49
- data/app/concepts/matestack/ui/core/form/textarea/textarea.rb +0 -17
- data/app/concepts/matestack/ui/core/form/utils.rb +0 -47
- data/app/concepts/matestack/ui/core/header/header.haml +0 -3
- data/app/concepts/matestack/ui/core/header/header.rb +0 -4
- data/app/concepts/matestack/ui/core/heading/heading.haml +0 -5
- data/app/concepts/matestack/ui/core/heading/heading.rb +0 -5
- data/app/concepts/matestack/ui/core/hr/hr.haml +0 -1
- data/app/concepts/matestack/ui/core/hr/hr.rb +0 -4
- data/app/concepts/matestack/ui/core/icon/icon.haml +0 -5
- data/app/concepts/matestack/ui/core/icon/icon.rb +0 -5
- data/app/concepts/matestack/ui/core/iframe/iframe.haml +0 -5
- data/app/concepts/matestack/ui/core/iframe/iframe.rb +0 -7
- data/app/concepts/matestack/ui/core/img/img.haml +0 -1
- data/app/concepts/matestack/ui/core/img/img.rb +0 -15
- data/app/concepts/matestack/ui/core/input/input.haml +0 -1
- data/app/concepts/matestack/ui/core/input/input.rb +0 -9
- data/app/concepts/matestack/ui/core/ins/ins.haml +0 -5
- data/app/concepts/matestack/ui/core/ins/ins.rb +0 -6
- data/app/concepts/matestack/ui/core/isolated/children_wrapper.haml +0 -2
- data/app/concepts/matestack/ui/core/isolated/isolated.haml +0 -10
- data/app/concepts/matestack/ui/core/isolated/isolated.rb +0 -59
- data/app/concepts/matestack/ui/core/js/core.js +0 -66
- data/app/concepts/matestack/ui/core/js/event-hub.js +0 -5
- data/app/concepts/matestack/ui/core/kbd/kbd.haml +0 -5
- data/app/concepts/matestack/ui/core/kbd/kbd.rb +0 -5
- data/app/concepts/matestack/ui/core/label/label.haml +0 -5
- data/app/concepts/matestack/ui/core/label/label.rb +0 -6
- data/app/concepts/matestack/ui/core/legend/legend.haml +0 -5
- data/app/concepts/matestack/ui/core/legend/legend.rb +0 -5
- data/app/concepts/matestack/ui/core/li/li.haml +0 -5
- data/app/concepts/matestack/ui/core/li/li.rb +0 -6
- data/app/concepts/matestack/ui/core/link/link.haml +0 -5
- data/app/concepts/matestack/ui/core/link/link.rb +0 -23
- data/app/concepts/matestack/ui/core/main/main.haml +0 -3
- data/app/concepts/matestack/ui/core/main/main.rb +0 -4
- data/app/concepts/matestack/ui/core/map/map.haml +0 -3
- data/app/concepts/matestack/ui/core/map/map.rb +0 -5
- data/app/concepts/matestack/ui/core/mark/mark.haml +0 -5
- data/app/concepts/matestack/ui/core/mark/mark.rb +0 -5
- data/app/concepts/matestack/ui/core/meter/meter.haml +0 -4
- data/app/concepts/matestack/ui/core/meter/meter.rb +0 -5
- data/app/concepts/matestack/ui/core/nav/nav.haml +0 -3
- data/app/concepts/matestack/ui/core/nav/nav.rb +0 -4
- data/app/concepts/matestack/ui/core/noscript/noscript.haml +0 -5
- data/app/concepts/matestack/ui/core/noscript/noscript.rb +0 -5
- data/app/concepts/matestack/ui/core/object/object.haml +0 -1
- data/app/concepts/matestack/ui/core/object/object.rb +0 -5
- data/app/concepts/matestack/ui/core/ol/ol.haml +0 -3
- data/app/concepts/matestack/ui/core/ol/ol.rb +0 -5
- data/app/concepts/matestack/ui/core/onclick/onclick.haml +0 -2
- data/app/concepts/matestack/ui/core/onclick/onclick.rb +0 -6
- data/app/concepts/matestack/ui/core/optgroup/optgroup.haml +0 -3
- data/app/concepts/matestack/ui/core/optgroup/optgroup.rb +0 -5
- data/app/concepts/matestack/ui/core/option/option.haml +0 -5
- data/app/concepts/matestack/ui/core/option/option.rb +0 -6
- data/app/concepts/matestack/ui/core/output/output.haml +0 -5
- data/app/concepts/matestack/ui/core/output/output.rb +0 -6
- data/app/concepts/matestack/ui/core/page/content/content.rb +0 -28
- data/app/concepts/matestack/ui/core/page/page.haml +0 -3
- data/app/concepts/matestack/ui/core/page/page.rb +0 -30
- data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +0 -5
- data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +0 -5
- data/app/concepts/matestack/ui/core/param/param.haml +0 -1
- data/app/concepts/matestack/ui/core/param/param.rb +0 -5
- data/app/concepts/matestack/ui/core/partial/partial.haml +0 -2
- data/app/concepts/matestack/ui/core/partial/partial.rb +0 -4
- data/app/concepts/matestack/ui/core/picture/picture.haml +0 -3
- data/app/concepts/matestack/ui/core/picture/picture.rb +0 -4
- data/app/concepts/matestack/ui/core/plain/plain.rb +0 -9
- data/app/concepts/matestack/ui/core/pre/pre.haml +0 -5
- data/app/concepts/matestack/ui/core/pre/pre.rb +0 -5
- data/app/concepts/matestack/ui/core/progress/progress.haml +0 -3
- data/app/concepts/matestack/ui/core/progress/progress.rb +0 -5
- data/app/concepts/matestack/ui/core/q/q.haml +0 -5
- data/app/concepts/matestack/ui/core/q/q.rb +0 -6
- data/app/concepts/matestack/ui/core/rp/rp.haml +0 -5
- data/app/concepts/matestack/ui/core/rp/rp.rb +0 -5
- data/app/concepts/matestack/ui/core/rt/rt.haml +0 -5
- data/app/concepts/matestack/ui/core/rt/rt.rb +0 -5
- data/app/concepts/matestack/ui/core/ruby/ruby.haml +0 -5
- data/app/concepts/matestack/ui/core/ruby/ruby.rb +0 -5
- data/app/concepts/matestack/ui/core/s/s.haml +0 -5
- data/app/concepts/matestack/ui/core/s/s.rb +0 -6
- data/app/concepts/matestack/ui/core/samp/samp.haml +0 -5
- data/app/concepts/matestack/ui/core/samp/samp.rb +0 -5
- data/app/concepts/matestack/ui/core/section/section.haml +0 -3
- data/app/concepts/matestack/ui/core/section/section.rb +0 -4
- data/app/concepts/matestack/ui/core/select/select.haml +0 -3
- data/app/concepts/matestack/ui/core/select/select.rb +0 -7
- data/app/concepts/matestack/ui/core/slot/slot.haml +0 -2
- data/app/concepts/matestack/ui/core/slot/slot.rb +0 -4
- data/app/concepts/matestack/ui/core/small/small.haml +0 -5
- data/app/concepts/matestack/ui/core/small/small.rb +0 -5
- data/app/concepts/matestack/ui/core/span/span.haml +0 -5
- data/app/concepts/matestack/ui/core/span/span.rb +0 -5
- data/app/concepts/matestack/ui/core/strong/strong.haml +0 -5
- data/app/concepts/matestack/ui/core/strong/strong.rb +0 -5
- data/app/concepts/matestack/ui/core/sub/sub.haml +0 -5
- data/app/concepts/matestack/ui/core/sub/sub.rb +0 -5
- data/app/concepts/matestack/ui/core/summary/summary.haml +0 -5
- data/app/concepts/matestack/ui/core/summary/summary.rb +0 -5
- data/app/concepts/matestack/ui/core/sup/sup.haml +0 -5
- data/app/concepts/matestack/ui/core/sup/sup.rb +0 -5
- data/app/concepts/matestack/ui/core/table/table.haml +0 -3
- data/app/concepts/matestack/ui/core/table/table.rb +0 -4
- data/app/concepts/matestack/ui/core/tbody/tbody.haml +0 -3
- data/app/concepts/matestack/ui/core/tbody/tbody.rb +0 -4
- data/app/concepts/matestack/ui/core/td/td.haml +0 -5
- data/app/concepts/matestack/ui/core/td/td.rb +0 -6
- data/app/concepts/matestack/ui/core/template/template.haml +0 -3
- data/app/concepts/matestack/ui/core/template/template.rb +0 -4
- data/app/concepts/matestack/ui/core/textarea/textarea.haml +0 -5
- data/app/concepts/matestack/ui/core/textarea/textarea.rb +0 -10
- data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +0 -3
- data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +0 -4
- data/app/concepts/matestack/ui/core/th/th.haml +0 -5
- data/app/concepts/matestack/ui/core/th/th.rb +0 -6
- data/app/concepts/matestack/ui/core/thead/thead.haml +0 -3
- data/app/concepts/matestack/ui/core/thead/thead.rb +0 -4
- data/app/concepts/matestack/ui/core/time/time.haml +0 -3
- data/app/concepts/matestack/ui/core/time/time.rb +0 -5
- data/app/concepts/matestack/ui/core/toggle/toggle.haml +0 -2
- data/app/concepts/matestack/ui/core/toggle/toggle.rb +0 -13
- data/app/concepts/matestack/ui/core/tr/tr.haml +0 -3
- data/app/concepts/matestack/ui/core/tr/tr.rb +0 -4
- data/app/concepts/matestack/ui/core/transition/transition.haml +0 -5
- data/app/concepts/matestack/ui/core/transition/transition.rb +0 -38
- data/app/concepts/matestack/ui/core/u/u.haml +0 -5
- data/app/concepts/matestack/ui/core/u/u.rb +0 -6
- data/app/concepts/matestack/ui/core/ul/ul.haml +0 -3
- data/app/concepts/matestack/ui/core/ul/ul.rb +0 -4
- data/app/concepts/matestack/ui/core/unescaped/unescaped.rb +0 -9
- data/app/concepts/matestack/ui/core/var/var.haml +0 -5
- data/app/concepts/matestack/ui/core/var/var.rb +0 -5
- data/app/concepts/matestack/ui/core/video/video.haml +0 -3
- data/app/concepts/matestack/ui/core/video/video.rb +0 -13
- data/app/concepts/matestack/ui/core/view/view.haml +0 -1
- data/app/concepts/matestack/ui/core/view/view.rb +0 -30
- data/app/concepts/matestack/ui/core/wbr/wbr.haml +0 -5
- data/app/concepts/matestack/ui/core/wbr/wbr.rb +0 -5
- data/app/concepts/matestack/ui/core/youtube/youtube.haml +0 -1
- data/app/concepts/matestack/ui/core/youtube/youtube.rb +0 -28
- data/app/helpers/matestack/ui/core/application_helper.rb +0 -111
- data/app/javascript/matestack-ui-core/index.js +0 -32
- data/app/javascript/matestack-ui-core/styles/index.scss +0 -5
- data/app/javascript/packs/matestack-ui-core.js +0 -8
- data/app/lib/matestack/ui/app.rb +0 -1
- data/app/lib/matestack/ui/component.rb +0 -1
- data/app/lib/matestack/ui/core/has_view_context.rb +0 -16
- data/app/lib/matestack/ui/core/html_attributes.rb +0 -43
- data/app/lib/matestack/ui/core/properties.rb +0 -161
- data/app/lib/matestack/ui/core/rendering/default_renderer_class_determiner.rb +0 -33
- data/app/lib/matestack/ui/core/rendering/main_renderer.rb +0 -203
- data/app/lib/matestack/ui/dynamic_actionview_component.rb +0 -1
- data/app/lib/matestack/ui/dynamic_component.rb +0 -1
- data/app/lib/matestack/ui/isolated_component.rb +0 -1
- data/app/lib/matestack/ui/page.rb +0 -1
- data/app/lib/matestack/ui/static_actionview_component.rb +0 -1
- data/app/lib/matestack/ui/static_component.rb +0 -1
- data/app/lib/matestack/ui/vue_js_component.rb +0 -1
- data/config/routes.rb +0 -2
- data/lib/generators/matestack/app/USAGE +0 -21
- data/lib/generators/matestack/app/app_generator.rb +0 -25
- data/lib/generators/matestack/app/templates/app/controllers/%file_name%_controller.rb.tt +0 -5
- data/lib/generators/matestack/app/templates/app/matestack/apps/%file_name%.rb.tt +0 -28
- data/lib/generators/matestack/component/USAGE +0 -20
- data/lib/generators/matestack/component/component_generator.rb +0 -29
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.haml.tt +0 -5
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.js.tt +0 -17
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.rb.tt +0 -11
- data/lib/generators/matestack/component/templates/app/matestack/components/%namespace%/%file_name%.scss.tt +0 -1
- data/lib/generators/matestack/core/component/USAGE +0 -16
- data/lib/generators/matestack/core/component/component_generator.rb +0 -23
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.haml.tt +0 -5
- data/lib/generators/matestack/core/component/templates/app/concepts/matestack/ui/core/%file_name%/%file_name%.rb.tt +0 -4
- data/lib/generators/matestack/core/component/templates/docs/components/%file_name%.md.tt +0 -45
- data/lib/generators/matestack/core/component/templates/spec/usage/components/%file_name%_spec.rb +0 -31
- data/lib/generators/matestack/page/USAGE +0 -28
- data/lib/generators/matestack/page/page_generator.rb +0 -54
- data/lib/generators/matestack/page/templates/app/matestack/pages/%app_name%/%namespace%/%file_name%.rb.tt +0 -29
- data/lib/matestack/ui/core/cell.rb +0 -31
- data/lib/matestack/ui/core/component/registry.rb +0 -47
- data/lib/matestack/ui/core/components.rb +0 -271
- data/lib/matestack/ui/core/dsl.rb +0 -6
- data/lib/matestack/ui/core/engine.rb +0 -35
- data/lib/tasks/matestack/ui/core_tasks.rake +0 -4
- data/vendor/assets/javascripts/dist/manifest.json +0 -18
- data/vendor/assets/javascripts/dist/manifest.json.br +0 -0
- data/vendor/assets/javascripts/dist/manifest.json.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.css +0 -3
- data/vendor/assets/javascripts/dist/matestack-ui-core.css.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.js +0 -17734
- data/vendor/assets/javascripts/dist/matestack-ui-core.js.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.css +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js +0 -3
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.LICENSE.txt +0 -11
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.gz +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map +0 -1
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.br +0 -0
- data/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map.gz +0 -0
- data/vendor/assets/javascripts/matestack-ui-core.js.erb +0 -2
- data/vendor/assets/stylesheets/dist +0 -1
- data/vendor/assets/stylesheets/matestack-ui-core.css.erb +0 -2
@@ -1,111 +0,0 @@
|
|
1
|
-
module Matestack
|
2
|
-
module Ui
|
3
|
-
module Core
|
4
|
-
# We're called ApplicationHelper but all we do so far is rendering.
|
5
|
-
module ApplicationHelper
|
6
|
-
|
7
|
-
# Allow the definition of a controller wide get_matestack_app_class
|
8
|
-
#
|
9
|
-
# class SomeController < ActionController::Base
|
10
|
-
# matestack_app MyAppClass
|
11
|
-
# #...
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
def self.included(base)
|
15
|
-
base.extend(ClassMethods)
|
16
|
-
end
|
17
|
-
|
18
|
-
module ClassMethods
|
19
|
-
def matestack_app _class
|
20
|
-
@matestack_app_class = _class
|
21
|
-
end
|
22
|
-
|
23
|
-
def get_matestack_app_class
|
24
|
-
if defined?(@matestack_app_class)
|
25
|
-
@matestack_app_class
|
26
|
-
else
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
# Matestack allows you to use `render` to render matestack pages.
|
34
|
-
#
|
35
|
-
# render Pages::Member::Bookings::Index
|
36
|
-
# render matestack: Pages::Member::Bookings::Index
|
37
|
-
#
|
38
|
-
def render(*args)
|
39
|
-
if (matestack_class = args.first).is_a?(Class) && (matestack_class < Matestack::Ui::Page)
|
40
|
-
options_hash = args[1].is_a?(Hash) ? args[1] : {}
|
41
|
-
Rendering::MainRenderer.render(self, matestack_class, options_hash)
|
42
|
-
elsif (options = args.first).is_a?(Hash) &&
|
43
|
-
(matestack_arg = options[:matestack]) &&
|
44
|
-
matestack_arg.is_a?(Class) &&
|
45
|
-
(matestack_arg < Matestack::Ui::Page)
|
46
|
-
Rendering::MainRenderer.render(self, matestack_arg, options)
|
47
|
-
else
|
48
|
-
if params[:component_class].present? && !((options = args.first).is_a?(Hash) && options[:html].present?)
|
49
|
-
Rendering::MainRenderer.render(self, Matestack::Ui::Page, {})
|
50
|
-
else
|
51
|
-
super
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# TODO: maybe/Axe remove this?
|
57
|
-
# Matestack allows implicit rendering. The matestack page class name is inferred from the
|
58
|
-
# controller path and action name.
|
59
|
-
#
|
60
|
-
# class Clients::BookingsController < ApplicationController
|
61
|
-
# def index
|
62
|
-
# @bookings = Booking.all
|
63
|
-
# # looks for Pages::Clients::Bookings::Index
|
64
|
-
# end
|
65
|
-
#
|
66
|
-
# def show
|
67
|
-
# @booking = Booking.find params[:id]
|
68
|
-
# # looks for Pages::Clients::Bookings::Show
|
69
|
-
# end
|
70
|
-
# end
|
71
|
-
#
|
72
|
-
# In this example, `clients/bookings#index` will render `Pages::Clients::Bookings::Index`,
|
73
|
-
# `clients/bookings#show` will render `Pages::Clients::Bookings::Show`.
|
74
|
-
#
|
75
|
-
# Custom action names translate also into page names.
|
76
|
-
#
|
77
|
-
# class Clients::BookingsController < ApplicationController
|
78
|
-
# def step1
|
79
|
-
# # looks for Pages::Clients::Bookings::Step1
|
80
|
-
# end
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# In this example, the `clients/bookings#step1` action will render
|
84
|
-
# `Pages::Clients::Bookings::Step1`.
|
85
|
-
#
|
86
|
-
def default_render(*args)
|
87
|
-
matestack_page_class =
|
88
|
-
Rendering::DefaultRendererClassDeterminer.determine_class(controller_path, action_name)
|
89
|
-
if matestack_page_class
|
90
|
-
render matestack_page_class
|
91
|
-
else
|
92
|
-
super
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# Kept around for compatibility. Probably worth removing.
|
97
|
-
def responder_for(*args)
|
98
|
-
render(*args)
|
99
|
-
end
|
100
|
-
|
101
|
-
def matestack_component(component, options = {}, &block)
|
102
|
-
controller = (self.class <= ActionController::Base) ? self : @_controller
|
103
|
-
context = (options[:matestack_context] ||= {}).merge(controller: controller)
|
104
|
-
Matestack::Ui::Core::Component::Base
|
105
|
-
.new(options.merge(context: context, matestack_context: context))
|
106
|
-
.send(component, options.merge(context: context, matestack_context: context), &block).to_s
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import Vue from 'vue/dist/vue.esm'
|
2
|
-
import Vuex from 'vuex'
|
3
|
-
import axios from 'axios'
|
4
|
-
|
5
|
-
// Import from app/concepts/matestack/ui/core:
|
6
|
-
import matestackEventHub from '../../../app/concepts/matestack/ui/core/js/event-hub'
|
7
|
-
import componentMixin from '../../../app/concepts/matestack/ui/core/component/component'
|
8
|
-
import formInputMixin from '../../../app/concepts/matestack/ui/core/form/input/mixin'
|
9
|
-
import formSelectMixin from '../../../app/concepts/matestack/ui/core/form/select/mixin'
|
10
|
-
import formRadioMixin from '../../../app/concepts/matestack/ui/core/form/radio/mixin'
|
11
|
-
import formCheckboxMixin from '../../../app/concepts/matestack/ui/core/form/checkbox/mixin'
|
12
|
-
import formTextareaMixin from '../../../app/concepts/matestack/ui/core/form/textarea/mixin'
|
13
|
-
import matestackUiCore from '../../../app/concepts/matestack/ui/core/js/core'
|
14
|
-
|
15
|
-
import styles from './styles/index.scss'
|
16
|
-
|
17
|
-
const MatestackUiCore = {
|
18
|
-
Vue,
|
19
|
-
Vuex,
|
20
|
-
axios,
|
21
|
-
matestackEventHub,
|
22
|
-
componentMixin,
|
23
|
-
formInputMixin,
|
24
|
-
formSelectMixin,
|
25
|
-
formCheckboxMixin,
|
26
|
-
formTextareaMixin,
|
27
|
-
formRadioMixin
|
28
|
-
}
|
29
|
-
|
30
|
-
window.MatestackUiCore = MatestackUiCore
|
31
|
-
|
32
|
-
export default MatestackUiCore
|
@@ -1,8 +0,0 @@
|
|
1
|
-
// // Add polyfills for the asset pipeline
|
2
|
-
// // https://github.com/matestack/matestack-ui-core/issues/238#issuecomment-583905838
|
3
|
-
//
|
4
|
-
// import 'core-js/stable'
|
5
|
-
// import 'regenerator-runtime/runtime'
|
6
|
-
|
7
|
-
import '../matestack-ui-core/index'
|
8
|
-
export default MatestackUiCore
|
data/app/lib/matestack/ui/app.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Matestack::Ui::App = Matestack::Ui::Core::App::App
|
@@ -1 +0,0 @@
|
|
1
|
-
Matestack::Ui::Component = Matestack::Ui::Core::Component::Static
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::HasViewContext
|
2
|
-
def initialize(*args)
|
3
|
-
super
|
4
|
-
@view_context = @options.dig(:context, :view_context)
|
5
|
-
unless @view_context
|
6
|
-
@view_context = @options.dig(:matestack_context, :controller)&.view_context
|
7
|
-
end
|
8
|
-
end
|
9
|
-
def method_missing(*args, &block)
|
10
|
-
if @view_context.respond_to? args.first
|
11
|
-
@view_context.send(*args, &block)
|
12
|
-
else
|
13
|
-
raise NameError, "NameError: undefined method or local variable `#{args.first}' for #{self.class.name}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::HtmlAttributes
|
2
|
-
|
3
|
-
HTML_GLOBAL_ATTRIBUTES = [
|
4
|
-
:accesskey, :class, :contenteditable, :data, :dir, :draggable,
|
5
|
-
:hidden, :id, :lang, :spellcheck, :style, :tabindex, :title, :translate
|
6
|
-
]
|
7
|
-
|
8
|
-
HTML_EVENT_ATTRIBUTES = [
|
9
|
-
:onafterprint, :onbeforeprint, :onbeforeunload, :onerror, :onhashchange, :onload, :onmessage,
|
10
|
-
:onoffline, :ononline, :onpagehide, :onpageshow, :onpopstate, :onresize, :onstorage, :onunload
|
11
|
-
]
|
12
|
-
|
13
|
-
def self.included(base)
|
14
|
-
base.class_eval do
|
15
|
-
extend ClassMethods
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
module ClassMethods
|
20
|
-
|
21
|
-
def inherited(subclass)
|
22
|
-
super
|
23
|
-
subclass.html_attributes *self.allowed_html_attributes
|
24
|
-
end
|
25
|
-
|
26
|
-
def html_attributes(*attributes)
|
27
|
-
attributes.each do |attribute|
|
28
|
-
allowed_html_attributes.push(attribute)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def allowed_html_attributes
|
33
|
-
@allowed_html_attributes.flatten!&.uniq! if defined? @allowed_html_attributes
|
34
|
-
@allowed_html_attributes ||= []
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def html_attributes
|
40
|
-
options.slice(*self.class.allowed_html_attributes).merge((options[:attributes] || {}))
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,161 +0,0 @@
|
|
1
|
-
module Matestack::Ui::Core::Properties
|
2
|
-
|
3
|
-
class PropertyMissingException < StandardError
|
4
|
-
end
|
5
|
-
|
6
|
-
class PropertyOverwritingExistingMethodException < StandardError
|
7
|
-
end
|
8
|
-
|
9
|
-
# prepend the initializer and add class methods
|
10
|
-
def self.included(base)
|
11
|
-
base.class_eval do
|
12
|
-
extend ClassMethods
|
13
|
-
end
|
14
|
-
base.send :prepend, Initializer
|
15
|
-
end
|
16
|
-
|
17
|
-
# initializer calls super and creates instance methods for defined required and optional properties afterwards
|
18
|
-
module Initializer
|
19
|
-
def initialize(model=nil, options={})
|
20
|
-
options = model.dup if options.empty? && model.is_a?(Hash)
|
21
|
-
# required_hooks(options)
|
22
|
-
# optional_hooks(options)
|
23
|
-
set_values(options) unless options[:skip_set_values]
|
24
|
-
super
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
module ClassMethods
|
29
|
-
|
30
|
-
def inherited(subclass)
|
31
|
-
super
|
32
|
-
# self.new(nil, skip_set_values: true)
|
33
|
-
subclass.property_keys *self.all_property_keys
|
34
|
-
subclass.all_required_properties.concat(self.all_required_properties)
|
35
|
-
subclass.created_properties.concat(self.created_properties)
|
36
|
-
end
|
37
|
-
|
38
|
-
# contains all property keys, or property hashes regardless of wheter they are optional or required
|
39
|
-
# used in order to initialize values of properties correctly for subclasses and make properties inheritable
|
40
|
-
def all_property_keys
|
41
|
-
@all_properties.flatten!&.uniq! if defined? @all_properties
|
42
|
-
@all_properties ||= []
|
43
|
-
end
|
44
|
-
|
45
|
-
def all_required_properties
|
46
|
-
@all_required_properties ||= []
|
47
|
-
end
|
48
|
-
|
49
|
-
def created_properties
|
50
|
-
@created_properties ||= []
|
51
|
-
end
|
52
|
-
|
53
|
-
# add property keys to array containing all property keys
|
54
|
-
def property_keys(*attributes)
|
55
|
-
attributes.each do |attribute|
|
56
|
-
if attribute.is_a?(Hash)
|
57
|
-
attribute.each do |temp|
|
58
|
-
all_property_keys.push({ "#{temp.first}": temp.last})
|
59
|
-
end
|
60
|
-
else
|
61
|
-
all_property_keys.push(attribute)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
# define optinoal properties for custom components with `optional :foo, :bar`
|
67
|
-
def optional(*properties)
|
68
|
-
property_keys *properties
|
69
|
-
add_properties_to_list(optional_properties, properties)
|
70
|
-
optional_hooks
|
71
|
-
end
|
72
|
-
|
73
|
-
# define required properties for custom components with `requires :title, :foo, :bar`
|
74
|
-
def requires(*properties)
|
75
|
-
property_keys *properties
|
76
|
-
add_properties_to_list(requires_properties, properties)
|
77
|
-
required_hooks
|
78
|
-
end
|
79
|
-
|
80
|
-
def add_properties_to_list(list, properties)
|
81
|
-
properties.each do |property|
|
82
|
-
if property.is_a? Hash
|
83
|
-
property.each { |tmp_property| list.push(tmp_property) }
|
84
|
-
else
|
85
|
-
list.push(property)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# array of properties created from the component
|
91
|
-
def optional_properties
|
92
|
-
@optional_properties ||= []
|
93
|
-
end
|
94
|
-
|
95
|
-
# array of required properties from the component
|
96
|
-
def requires_properties
|
97
|
-
@requires_properties ||= []
|
98
|
-
end
|
99
|
-
|
100
|
-
def optional_hooks
|
101
|
-
self.optional_properties.compact.each do |prop|
|
102
|
-
prop = extract_property_key({}, prop)
|
103
|
-
define_getter_and_setter_for_property(prop)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def required_hooks
|
108
|
-
self.requires_properties.compact.each do |prop|
|
109
|
-
prop = extract_property_key({}, prop)
|
110
|
-
self.all_required_properties.push(prop).uniq!
|
111
|
-
define_getter_and_setter_for_property(prop)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def extract_property_key(options, prop)
|
116
|
-
if prop.is_a?(Array) || prop.is_a?(Hash)
|
117
|
-
hash = prop.flatten
|
118
|
-
prop = hash.last[:as]
|
119
|
-
end
|
120
|
-
prop
|
121
|
-
end
|
122
|
-
|
123
|
-
def define_getter_and_setter_for_property(prop)
|
124
|
-
self.created_properties.push(prop)
|
125
|
-
self.send(:define_method, prop) do
|
126
|
-
self.instance_variable_get(:"@#{prop}")
|
127
|
-
end
|
128
|
-
self.send(:define_method, :"#{prop}=") do |value|
|
129
|
-
self.instance_variable_set(:"@#{prop}", value)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def method_added(name)
|
134
|
-
if all_property_keys.include?(name) && !created_properties.include?(name)
|
135
|
-
raise PropertyOverwritingExistingMethodException, "Property \"#{name}\" would overwrite already defined instance method for #{self}"
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def set_values(options)
|
141
|
-
self.class.all_property_keys.compact.each do |prop|
|
142
|
-
value_key = prop
|
143
|
-
prop = extract_property_key(options, prop)
|
144
|
-
if self.class.all_required_properties.include?(prop) && options[prop].nil?
|
145
|
-
raise PropertyMissingException, "Required property #{prop} is missing for #{self.class}"
|
146
|
-
end
|
147
|
-
send(:"#{prop}=", options[prop])
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
# returns property key and sets alias if hash with as option is given
|
152
|
-
def extract_property_key(options, prop)
|
153
|
-
if prop.is_a?(Array) || prop.is_a?(Hash)
|
154
|
-
hash = prop.flatten
|
155
|
-
options[hash.last[:as]] = options[hash.first]
|
156
|
-
prop = hash.last[:as]
|
157
|
-
end
|
158
|
-
prop
|
159
|
-
end
|
160
|
-
|
161
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# Handles the default rendering mechanism
|
2
|
-
#
|
3
|
-
# Not really compatible with the new flexible naming schemes
|
4
|
-
module Matestack::Ui::Core::Rendering::DefaultRendererClassDeterminer
|
5
|
-
module_function
|
6
|
-
|
7
|
-
def determine_class(controller_path, action_name)
|
8
|
-
possible_default_render_matestack_page_class_names(controller_path, action_name).each do |class_name|
|
9
|
-
begin
|
10
|
-
return matestack_class = class_name.constantize
|
11
|
-
rescue NameError
|
12
|
-
end
|
13
|
-
end
|
14
|
-
return nil
|
15
|
-
end
|
16
|
-
|
17
|
-
def possible_default_render_matestack_page_class_names(controller_path, action_name)
|
18
|
-
possible_default_render_matestack_page_paths(controller_path, action_name).collect { |page_path|
|
19
|
-
page_path.split("/").collect { |str| str.camelcase }.join("::")
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
def possible_default_render_matestack_page_paths(controller_path, action_name)
|
24
|
-
paths = []
|
25
|
-
paths << "pages/#{controller_path}/#{action_name}"
|
26
|
-
paths << "pages/#{controller_path}" if action_name == "index"
|
27
|
-
paths << "pages/#{controller_path.singularize}" if action_name == "show"
|
28
|
-
paths << "#{controller_path}/#{action_name}_page"
|
29
|
-
paths << "#{controller_path}_page" if action_name == "index"
|
30
|
-
paths << "#{controller_path.singularize}_page" if action_name == "show"
|
31
|
-
paths
|
32
|
-
end
|
33
|
-
end
|
@@ -1,203 +0,0 @@
|
|
1
|
-
# The main renderer that is usually called to determine how to perform rendering
|
2
|
-
module Matestack::Ui::Core::Rendering::MainRenderer
|
3
|
-
module_function
|
4
|
-
|
5
|
-
EMPTY_JSON = "{}"
|
6
|
-
|
7
|
-
# Instead of rendering without an app class, we always have an "empty" app class
|
8
|
-
# to fall back to
|
9
|
-
DEFAULT_APP_CLASS = Matestack::Ui::Core::App::App
|
10
|
-
|
11
|
-
def render(controller_instance, page_class, options)
|
12
|
-
app_class = resolve_app_class(controller_instance, options)
|
13
|
-
|
14
|
-
params = controller_instance.params
|
15
|
-
|
16
|
-
context = create_context_hash(controller_instance)
|
17
|
-
|
18
|
-
if params[:only_page]
|
19
|
-
# standalone page rendering, used when performing a transition
|
20
|
-
page_instance = page_class.new(controller_instance: controller_instance, context: context)
|
21
|
-
render_matestack_object(controller_instance, page_instance)
|
22
|
-
elsif (params[:component_key].present? && params[:component_class].blank?)
|
23
|
-
# async component rerendering from non isolated context
|
24
|
-
app_instance = app_class.new(page_class, controller_instance, context)
|
25
|
-
component_key = params[:component_key]
|
26
|
-
page_instance = page_class.new(controller_instance: controller_instance, context: context)
|
27
|
-
render_component(component_key, app_instance, controller_instance, context)
|
28
|
-
elsif (params[:component_class].present? && params[:component_key].blank?)
|
29
|
-
# isolated component rendering
|
30
|
-
component_class = params[:component_class]
|
31
|
-
page_instance = page_class.new(controller_instance: controller_instance, context: context)
|
32
|
-
public_options = JSON.parse(params[:public_options]).with_indifferent_access rescue nil
|
33
|
-
render_isolated_component(component_class, page_instance, controller_instance, context, public_options)
|
34
|
-
elsif (params[:component_class].present? && params[:component_key].present?)
|
35
|
-
# async component rerendering from isolated context
|
36
|
-
component_class_name = params[:component_class]
|
37
|
-
component_key = params[:component_key]
|
38
|
-
page_instance = page_class.new(controller_instance: controller_instance, context: context)
|
39
|
-
if params[:public_options].present?
|
40
|
-
public_options = JSON.parse(params[:public_options]).with_indifferent_access
|
41
|
-
else
|
42
|
-
public_options = nil
|
43
|
-
end
|
44
|
-
component_class = resolve_isolated_component(component_class_name)
|
45
|
-
if component_class
|
46
|
-
component_instance = component_class.new(public_options: public_options, context: context)
|
47
|
-
if component_instance.authorized?
|
48
|
-
render_component(component_key, component_instance, controller_instance, context)
|
49
|
-
else
|
50
|
-
raise "not authorized"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
else
|
54
|
-
if app_class == false
|
55
|
-
page_instance = page_class.new(controller_instance: controller_instance, context: context)
|
56
|
-
render_matestack_object(controller_instance, page_instance, layout: true)
|
57
|
-
else
|
58
|
-
app_instance = app_class.new(page_class, controller_instance, context)
|
59
|
-
render_matestack_object(controller_instance, app_instance, layout: true)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# needs refactoring!
|
65
|
-
# we shouldn't pass in the parts of the controller_instance and the instance itself
|
66
|
-
def create_context_hash(controller_instance)
|
67
|
-
{
|
68
|
-
view_context: controller_instance.view_context,
|
69
|
-
params: controller_instance.params,
|
70
|
-
request: controller_instance.request,
|
71
|
-
controller: controller_instance # if this is not included here, rails route helpers will fail with undefined method `url_options' for nil:NilClass in some cases
|
72
|
-
}
|
73
|
-
end
|
74
|
-
|
75
|
-
def render_matestack_object(controller_instance, object, opts = {}, render_method = :show)
|
76
|
-
object.prepare
|
77
|
-
object.response if object.respond_to? :response
|
78
|
-
rendering_options = {html: object.call(render_method)}.merge!(opts)
|
79
|
-
controller_instance.render rendering_options
|
80
|
-
end
|
81
|
-
|
82
|
-
def render_component(component_key, app_or_page_instance, controller_instance, context)
|
83
|
-
matched_component = nil
|
84
|
-
|
85
|
-
app_or_page_instance.matestack_set_skip_defer(false)
|
86
|
-
|
87
|
-
app_or_page_instance.prepare
|
88
|
-
app_or_page_instance.response
|
89
|
-
|
90
|
-
matched_component = dig_for_component(component_key, app_or_page_instance)
|
91
|
-
|
92
|
-
unless matched_component.nil?
|
93
|
-
render_matestack_object(controller_instance, matched_component, {}, :render_content)
|
94
|
-
else
|
95
|
-
# some 404 probably
|
96
|
-
raise Exception, "Async component with id #{component_key} could not be found while rerendering."
|
97
|
-
end
|
98
|
-
rescue Exception => e
|
99
|
-
Rails.logger.warn e
|
100
|
-
render json: {}, status: :not_found
|
101
|
-
end
|
102
|
-
|
103
|
-
def dig_for_component component_key, component_instance
|
104
|
-
matched_component = nil
|
105
|
-
|
106
|
-
component_instance.children.each do |child|
|
107
|
-
if child.respond_to?(:get_component_key)
|
108
|
-
if child.get_component_key == component_key
|
109
|
-
matched_component = child
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
if matched_component.nil?
|
115
|
-
component_instance.children.each do |child|
|
116
|
-
if child.children.any?
|
117
|
-
matched_component = dig_for_component(component_key, child)
|
118
|
-
break if !matched_component.nil?
|
119
|
-
end
|
120
|
-
end
|
121
|
-
return matched_component
|
122
|
-
else
|
123
|
-
return matched_component
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
# TODO: too many arguments maybe get some of them together?
|
129
|
-
def render_isolated_component(component_class_name, page_instance, controller_instance, context, public_options = nil)
|
130
|
-
component_class = resolve_isolated_component(component_class_name)
|
131
|
-
|
132
|
-
if component_class
|
133
|
-
component_instance = component_class.new(public_options: public_options, context: context)
|
134
|
-
if component_instance.authorized?
|
135
|
-
render_matestack_object(controller_instance, component_instance, {}, :render_isolated_content)
|
136
|
-
else
|
137
|
-
# some 4xx? 404?
|
138
|
-
raise "not authorized"
|
139
|
-
end
|
140
|
-
else
|
141
|
-
# some 404 probably
|
142
|
-
raise "component not found"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def resolve_component(name)
|
147
|
-
constant = const_get(name)
|
148
|
-
# change to specific AsyncComponent parent class
|
149
|
-
if constant < Matestack::Ui::Core::Async::Async
|
150
|
-
constant
|
151
|
-
else
|
152
|
-
nil
|
153
|
-
end
|
154
|
-
rescue NameError
|
155
|
-
nil
|
156
|
-
end
|
157
|
-
|
158
|
-
def resolve_isolated_component(name)
|
159
|
-
constant = const_get(name)
|
160
|
-
if constant < Matestack::Ui::Core::Isolated::Isolated
|
161
|
-
constant
|
162
|
-
else
|
163
|
-
nil
|
164
|
-
end
|
165
|
-
rescue NameError
|
166
|
-
nil
|
167
|
-
end
|
168
|
-
|
169
|
-
|
170
|
-
def resolve_app_class(controller_instance, options)
|
171
|
-
app_class = DEFAULT_APP_CLASS
|
172
|
-
|
173
|
-
controller_level_app_class = controller_instance.class.get_matestack_app_class
|
174
|
-
action_level_app_class = options[:matestack_app]
|
175
|
-
|
176
|
-
if !controller_level_app_class.nil?
|
177
|
-
if controller_level_app_class == false
|
178
|
-
app_class = false
|
179
|
-
else
|
180
|
-
if controller_level_app_class.is_a?(Class) && (controller_level_app_class < Matestack::Ui::App)
|
181
|
-
app_class = controller_level_app_class
|
182
|
-
else
|
183
|
-
raise "#{controller_level_app_class} is not a valid Matestack::Ui::App class"
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
if !action_level_app_class.nil?
|
188
|
-
if action_level_app_class == false
|
189
|
-
app_class = false
|
190
|
-
else
|
191
|
-
matestack_app_class = action_level_app_class
|
192
|
-
if action_level_app_class.is_a?(Class) && (action_level_app_class < Matestack::Ui::App)
|
193
|
-
app_class = action_level_app_class
|
194
|
-
else
|
195
|
-
raise "#{action_level_app_class} is not a valid Matestack::Ui::App class"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
return app_class
|
201
|
-
end
|
202
|
-
|
203
|
-
end
|