matestack-ui-core 2.0.0 → 3.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +15 -478
- data/lib/matestack/ui/core/base.rb +24 -7
- data/lib/matestack/ui/core/context.rb +2 -2
- data/lib/matestack/ui/core/helper.rb +29 -29
- data/lib/matestack/ui/core/{app.rb → layout.rb} +6 -17
- data/lib/matestack/ui/core/page.rb +0 -50
- data/lib/matestack/ui/core/tag_helper.rb +17 -10
- data/lib/matestack/ui/core/version.rb +1 -1
- data/lib/matestack/ui/core.rb +2 -45
- data/lib/matestack/ui/layout.rb +1 -0
- data/lib/matestack/ui/page.rb +1 -1
- metadata +7 -68
- data/lib/matestack/ui/app.rb +0 -1
- data/lib/matestack/ui/core/vue_attributes.rb +0 -13
- data/lib/matestack/ui/vue_js/app/app.js +0 -40
- data/lib/matestack/ui/vue_js/app/location.js +0 -9
- data/lib/matestack/ui/vue_js/app/store.js +0 -103
- data/lib/matestack/ui/vue_js/components/action.js +0 -151
- data/lib/matestack/ui/vue_js/components/action.rb +0 -46
- data/lib/matestack/ui/vue_js/components/async.js +0 -110
- data/lib/matestack/ui/vue_js/components/async.rb +0 -84
- data/lib/matestack/ui/vue_js/components/cable.js +0 -100
- data/lib/matestack/ui/vue_js/components/cable.rb +0 -69
- data/lib/matestack/ui/vue_js/components/collection/content.js +0 -97
- data/lib/matestack/ui/vue_js/components/collection/content.rb +0 -32
- data/lib/matestack/ui/vue_js/components/collection/filter.js +0 -45
- data/lib/matestack/ui/vue_js/components/collection/filter.rb +0 -29
- data/lib/matestack/ui/vue_js/components/collection/filter_reset.rb +0 -19
- data/lib/matestack/ui/vue_js/components/collection/helper.rb +0 -128
- data/lib/matestack/ui/vue_js/components/collection/next.rb +0 -19
- data/lib/matestack/ui/vue_js/components/collection/order.js +0 -46
- data/lib/matestack/ui/vue_js/components/collection/order.rb +0 -28
- data/lib/matestack/ui/vue_js/components/collection/order_toggle.rb +0 -21
- data/lib/matestack/ui/vue_js/components/collection/order_toggle_indicator.rb +0 -30
- data/lib/matestack/ui/vue_js/components/collection/page.rb +0 -21
- data/lib/matestack/ui/vue_js/components/collection/previous.rb +0 -19
- data/lib/matestack/ui/vue_js/components/form/base.rb +0 -167
- data/lib/matestack/ui/vue_js/components/form/checkbox.js +0 -15
- data/lib/matestack/ui/vue_js/components/form/checkbox.rb +0 -105
- data/lib/matestack/ui/vue_js/components/form/checkbox_mixin.js +0 -83
- data/lib/matestack/ui/vue_js/components/form/context.rb +0 -15
- data/lib/matestack/ui/vue_js/components/form/form.js +0 -275
- data/lib/matestack/ui/vue_js/components/form/form.rb +0 -64
- data/lib/matestack/ui/vue_js/components/form/input.js +0 -15
- data/lib/matestack/ui/vue_js/components/form/input.rb +0 -37
- data/lib/matestack/ui/vue_js/components/form/input_mixin.js +0 -58
- data/lib/matestack/ui/vue_js/components/form/radio.js +0 -15
- data/lib/matestack/ui/vue_js/components/form/radio.rb +0 -76
- data/lib/matestack/ui/vue_js/components/form/radio_mixin.js +0 -65
- data/lib/matestack/ui/vue_js/components/form/select.js +0 -15
- data/lib/matestack/ui/vue_js/components/form/select.rb +0 -88
- data/lib/matestack/ui/vue_js/components/form/select_mixin.js +0 -61
- data/lib/matestack/ui/vue_js/components/form/textarea.js +0 -15
- data/lib/matestack/ui/vue_js/components/form/textarea.rb +0 -37
- data/lib/matestack/ui/vue_js/components/form/textarea_mixin.js +0 -44
- data/lib/matestack/ui/vue_js/components/isolated.js +0 -108
- data/lib/matestack/ui/vue_js/components/isolated.rb +0 -86
- data/lib/matestack/ui/vue_js/components/mixin.js +0 -22
- data/lib/matestack/ui/vue_js/components/onclick.js +0 -19
- data/lib/matestack/ui/vue_js/components/onclick.rb +0 -37
- data/lib/matestack/ui/vue_js/components/toggle.js +0 -71
- data/lib/matestack/ui/vue_js/components/toggle.rb +0 -38
- data/lib/matestack/ui/vue_js/components/transition.js +0 -42
- data/lib/matestack/ui/vue_js/components/transition.rb +0 -40
- data/lib/matestack/ui/vue_js/components.rb +0 -94
- data/lib/matestack/ui/vue_js/event_hub.js +0 -5
- data/lib/matestack/ui/vue_js/helpers/query_params_helper.js +0 -56
- data/lib/matestack/ui/vue_js/index.js +0 -52
- data/lib/matestack/ui/vue_js/initialize.rb +0 -5
- data/lib/matestack/ui/vue_js/page/content.js +0 -23
- data/lib/matestack/ui/vue_js/vue.rb +0 -63
- data/lib/matestack/ui/vue_js_component.rb +0 -2
@@ -2,22 +2,22 @@ module Matestack
|
|
2
2
|
module Ui
|
3
3
|
module Core
|
4
4
|
module Helper
|
5
|
-
|
5
|
+
|
6
6
|
def self.included(base)
|
7
7
|
base.extend ClassMethods
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
module ClassMethods
|
11
11
|
def inherited(subclass)
|
12
|
-
subclass.
|
12
|
+
subclass.matestack_layout(@matestack_layout)
|
13
13
|
super
|
14
14
|
end
|
15
|
-
|
16
|
-
def
|
17
|
-
@
|
15
|
+
|
16
|
+
def matestack_layout(layout = nil)
|
17
|
+
@matestack_layout = layout ? layout : @matestack_layout
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def render(*args)
|
22
22
|
setup_context
|
23
23
|
if args.first.is_a?(Class) && args.first.ancestors.include?(Base)
|
@@ -30,35 +30,35 @@ module Matestack
|
|
30
30
|
end
|
31
31
|
|
32
32
|
options = args.second || {}
|
33
|
-
|
33
|
+
layout = options.delete(:matestack_layout) || self.class.matestack_layout
|
34
34
|
page = args.first
|
35
35
|
|
36
36
|
if controller_layout == false
|
37
|
-
|
37
|
+
root_layout = layout ? layout.layout : false
|
38
38
|
else
|
39
39
|
if controller_layout.nil?
|
40
|
-
|
40
|
+
root_layout = "application"
|
41
41
|
else
|
42
|
-
|
42
|
+
root_layout = controller_layout
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
46
|
-
if
|
47
|
-
|
45
|
+
|
46
|
+
if layout && params[:only_page].nil? && params[:component_key].nil? && params[:component_class].nil?
|
47
|
+
render_layout layout, page, options, root_layout
|
48
48
|
else
|
49
49
|
if params[:component_key] && params[:component_class].nil?
|
50
|
-
render_component
|
50
|
+
render_component layout, page, params[:component_key], options
|
51
51
|
elsif params[:component_class]
|
52
52
|
if params[:component_key]
|
53
53
|
render_component nil, params[:component_class].constantize, params[:component_key], JSON.parse(params[:public_options] || '{}')
|
54
|
-
else
|
54
|
+
else
|
55
55
|
render html: params[:component_class].constantize.(public_options: JSON.parse(params[:public_options] || '{}'))
|
56
56
|
end
|
57
57
|
else
|
58
58
|
if params[:only_page]
|
59
59
|
render_page page, options, false
|
60
60
|
else
|
61
|
-
render_page page, options,
|
61
|
+
render_page page, options, root_layout
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -66,26 +66,26 @@ module Matestack
|
|
66
66
|
super
|
67
67
|
end
|
68
68
|
end
|
69
|
-
|
70
|
-
def
|
71
|
-
render html:
|
69
|
+
|
70
|
+
def render_layout(layout, page, options, root_layout)
|
71
|
+
render html: layout.new(options) { page.new(options) }.render_content.html_safe, layout: root_layout
|
72
72
|
end
|
73
|
-
|
74
|
-
def render_page(page, options,
|
75
|
-
render html: page.new(options).render_content.html_safe, layout:
|
73
|
+
|
74
|
+
def render_page(page, options, root_layout)
|
75
|
+
render html: page.new(options).render_content.html_safe, layout: root_layout
|
76
76
|
end
|
77
|
-
|
78
|
-
def render_component(
|
79
|
-
|
77
|
+
|
78
|
+
def render_component(layout, page, component_key, options)
|
79
|
+
layout ? layout.new(options) { page.new(options) } : page.new(options) # create page structure in order to later access registered async components
|
80
80
|
render html: Matestack::Ui::Core::Context.async_components[component_key].render_content.html_safe, layout: false
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
def setup_context
|
84
84
|
Matestack::Ui::Core::Context.params = self.params
|
85
85
|
Matestack::Ui::Core::Context.controller = (self.class <= ActionController::Base) ? self : @_controller
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
-
end
|
91
|
+
end
|
@@ -1,36 +1,25 @@
|
|
1
1
|
module Matestack
|
2
2
|
module Ui
|
3
3
|
module Core
|
4
|
-
class
|
5
|
-
|
4
|
+
class Layout < Base
|
5
|
+
|
6
6
|
def initialize(options = {})
|
7
7
|
@controller = Context.controller
|
8
|
-
Context.
|
8
|
+
Context.layout = self
|
9
9
|
super(nil, nil, options)
|
10
10
|
end
|
11
11
|
|
12
|
-
def component_attributes
|
13
|
-
{
|
14
|
-
is: 'matestack-ui-core-app',
|
15
|
-
'inline-template': true,
|
16
|
-
}
|
17
|
-
end
|
18
|
-
|
19
|
-
def loading_state_element
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
12
|
# layout class method to specify if a rails layout should be used
|
24
13
|
def self.inherited(subclass)
|
25
14
|
subclass.layout(@layout)
|
26
15
|
super
|
27
16
|
end
|
28
|
-
|
17
|
+
|
29
18
|
def self.layout(layout = nil)
|
30
19
|
@layout = layout ? layout : @layout
|
31
20
|
end
|
32
|
-
|
21
|
+
|
33
22
|
end
|
34
23
|
end
|
35
24
|
end
|
36
|
-
end
|
25
|
+
end
|
@@ -7,56 +7,6 @@ module Matestack
|
|
7
7
|
super(nil, nil, options)
|
8
8
|
end
|
9
9
|
|
10
|
-
def create_children
|
11
|
-
self.page do
|
12
|
-
self.response
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def page
|
17
|
-
if params[:only_page]
|
18
|
-
div class: 'matestack-page-root' do
|
19
|
-
yield
|
20
|
-
end
|
21
|
-
else
|
22
|
-
Base.new(:component, component_attributes) do
|
23
|
-
div class: 'matestack-page-container', 'v-bind:class': '{ "loading": loading === true }' do
|
24
|
-
if Matestack::Ui::Core::Context.app.respond_to? :loading_state_element
|
25
|
-
div class: 'loading-state-element-wrapper', 'v-bind:class': '{ "loading": loading === true }' do
|
26
|
-
Matestack::Ui::Core::Context.app.loading_state_element
|
27
|
-
end
|
28
|
-
end
|
29
|
-
div class: 'matestack-page-wrapper', 'v-bind:class': '{ "loading": loading === true }' do
|
30
|
-
div 'v-if': 'asyncPageTemplate == null' do
|
31
|
-
div class: 'matestack-page-root' do
|
32
|
-
yield
|
33
|
-
end
|
34
|
-
end
|
35
|
-
div 'v-if': 'asyncPageTemplate != null' do
|
36
|
-
div class: 'matestack-page-root' do
|
37
|
-
Base.new('v-runtime-template', ':template': 'asyncPageTemplate')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def component_attributes
|
47
|
-
{
|
48
|
-
is: 'matestack-ui-core-page-content',
|
49
|
-
ref: 'some-id',
|
50
|
-
':params': params.to_json,
|
51
|
-
':component-config': {
|
52
|
-
#TODO Remove?!
|
53
|
-
show_on: 'a-event',
|
54
|
-
hide_on: 'test'
|
55
|
-
}.to_json,
|
56
|
-
'inline-template': true
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
10
|
end
|
61
11
|
end
|
62
12
|
end
|
@@ -24,8 +24,12 @@ module Matestack
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def plain(text)
|
28
|
-
|
27
|
+
def plain(text=nil, options=nil, &block)
|
28
|
+
if block_given?
|
29
|
+
Matestack::Ui::Core::Base.new(nil, yield, options)
|
30
|
+
else
|
31
|
+
Matestack::Ui::Core::Base.new(nil, text, options)
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
def unescape(text)
|
@@ -33,14 +37,6 @@ module Matestack
|
|
33
37
|
end
|
34
38
|
alias unescaped unescape
|
35
39
|
|
36
|
-
def matestack(&block)
|
37
|
-
div(id: 'matestack-ui') do
|
38
|
-
Base.new(:component, component_attributes) do
|
39
|
-
div(class: 'matestack-app-wrapper', &block)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
40
|
# override image in order to implement automatically using rails assets path
|
45
41
|
def img(text = nil, options = {}, &block)
|
46
42
|
# if :src attribut given try to replace automatically
|
@@ -88,6 +84,17 @@ module Matestack
|
|
88
84
|
plain render options
|
89
85
|
end
|
90
86
|
|
87
|
+
def detached(text=nil, options=nil, &block)
|
88
|
+
options = {} if options.nil?
|
89
|
+
options[:detach_from_parent] = true
|
90
|
+
Matestack::Ui::Core::Base.new(nil, text, options, &block)
|
91
|
+
end
|
92
|
+
|
93
|
+
def detached_to_s(text=nil, options=nil, &block)
|
94
|
+
detached(text, options, &block).to_str
|
95
|
+
end
|
96
|
+
alias matestack_to_s detached_to_s
|
97
|
+
|
91
98
|
end
|
92
99
|
end
|
93
100
|
end
|
data/lib/matestack/ui/core.rb
CHANGED
@@ -12,55 +12,12 @@ end
|
|
12
12
|
require "#{base_path}/context"
|
13
13
|
require "#{base_path}/properties"
|
14
14
|
require "#{base_path}/base"
|
15
|
-
require "#{base_path}/vue_attributes"
|
16
15
|
require "#{base_path}/component"
|
17
16
|
require "#{base_path}/page"
|
18
|
-
require "#{base_path}/
|
17
|
+
require "#{base_path}/layout"
|
19
18
|
require "#{base_path}/helper"
|
20
19
|
|
21
20
|
# require abbreveations for apps, pages and components
|
22
|
-
require "matestack/ui/
|
21
|
+
require "matestack/ui/layout"
|
23
22
|
require "matestack/ui/page"
|
24
23
|
require "matestack/ui/component"
|
25
|
-
|
26
|
-
# VueJs Components
|
27
|
-
vue_js_base_path = 'matestack/ui/vue_js'
|
28
|
-
module Matestack
|
29
|
-
module Ui
|
30
|
-
module VueJs
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
require "#{vue_js_base_path}/vue"
|
37
|
-
require "#{vue_js_base_path}/components/toggle"
|
38
|
-
require "#{vue_js_base_path}/components/onclick"
|
39
|
-
require "#{vue_js_base_path}/components/transition"
|
40
|
-
require "#{vue_js_base_path}/components/async"
|
41
|
-
require "#{vue_js_base_path}/components/action"
|
42
|
-
require "#{vue_js_base_path}/components/cable"
|
43
|
-
require "#{vue_js_base_path}/components/isolated"
|
44
|
-
require "#{vue_js_base_path}/components/form/context"
|
45
|
-
require "#{vue_js_base_path}/components/form/base"
|
46
|
-
require "#{vue_js_base_path}/components/form/form"
|
47
|
-
require "#{vue_js_base_path}/components/form/input"
|
48
|
-
require "#{vue_js_base_path}/components/form/textarea"
|
49
|
-
require "#{vue_js_base_path}/components/form/checkbox"
|
50
|
-
require "#{vue_js_base_path}/components/form/radio"
|
51
|
-
require "#{vue_js_base_path}/components/form/select"
|
52
|
-
require "#{vue_js_base_path}/components/collection/helper"
|
53
|
-
require "#{vue_js_base_path}/components/collection/content"
|
54
|
-
require "#{vue_js_base_path}/components/collection/filter"
|
55
|
-
require "#{vue_js_base_path}/components/collection/filter_reset"
|
56
|
-
require "#{vue_js_base_path}/components/collection/next"
|
57
|
-
require "#{vue_js_base_path}/components/collection/order"
|
58
|
-
require "#{vue_js_base_path}/components/collection/order_toggle"
|
59
|
-
require "#{vue_js_base_path}/components/collection/order_toggle_indicator"
|
60
|
-
require "#{vue_js_base_path}/components/collection/page"
|
61
|
-
require "#{vue_js_base_path}/components/collection/previous"
|
62
|
-
require "#{vue_js_base_path}/components"
|
63
|
-
require "#{vue_js_base_path}/initialize"
|
64
|
-
|
65
|
-
# require abbreveations for apps, pages and components
|
66
|
-
require "matestack/ui/vue_js_component"
|
@@ -0,0 +1 @@
|
|
1
|
+
Matestack::Ui::Layout = Matestack::Ui::Core::Layout
|
data/lib/matestack/ui/page.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Matestack::Ui::Page = Matestack::Ui::Core::Page
|
1
|
+
Matestack::Ui::Page = Matestack::Ui::Core::Page
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matestack-ui-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Jabari
|
8
|
-
- Nils Henning
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
@@ -31,7 +30,6 @@ description: Matestack provides a collection of open source gems made for Ruby o
|
|
31
30
|
Rails app.
|
32
31
|
email:
|
33
32
|
- jonas@matestack.io
|
34
|
-
- nils@matestack.io
|
35
33
|
executables: []
|
36
34
|
extensions: []
|
37
35
|
extra_rdoc_files: []
|
@@ -39,79 +37,20 @@ files:
|
|
39
37
|
- LICENSE
|
40
38
|
- README.md
|
41
39
|
- Rakefile
|
42
|
-
- lib/matestack/ui/app.rb
|
43
40
|
- lib/matestack/ui/component.rb
|
44
41
|
- lib/matestack/ui/core.rb
|
45
|
-
- lib/matestack/ui/core/app.rb
|
46
42
|
- lib/matestack/ui/core/base.rb
|
47
43
|
- lib/matestack/ui/core/component.rb
|
48
44
|
- lib/matestack/ui/core/context.rb
|
49
45
|
- lib/matestack/ui/core/helper.rb
|
46
|
+
- lib/matestack/ui/core/layout.rb
|
50
47
|
- lib/matestack/ui/core/page.rb
|
51
48
|
- lib/matestack/ui/core/properties.rb
|
52
49
|
- lib/matestack/ui/core/slots.rb
|
53
50
|
- lib/matestack/ui/core/tag_helper.rb
|
54
51
|
- lib/matestack/ui/core/version.rb
|
55
|
-
- lib/matestack/ui/
|
52
|
+
- lib/matestack/ui/layout.rb
|
56
53
|
- lib/matestack/ui/page.rb
|
57
|
-
- lib/matestack/ui/vue_js/app/app.js
|
58
|
-
- lib/matestack/ui/vue_js/app/location.js
|
59
|
-
- lib/matestack/ui/vue_js/app/store.js
|
60
|
-
- lib/matestack/ui/vue_js/components.rb
|
61
|
-
- lib/matestack/ui/vue_js/components/action.js
|
62
|
-
- lib/matestack/ui/vue_js/components/action.rb
|
63
|
-
- lib/matestack/ui/vue_js/components/async.js
|
64
|
-
- lib/matestack/ui/vue_js/components/async.rb
|
65
|
-
- lib/matestack/ui/vue_js/components/cable.js
|
66
|
-
- lib/matestack/ui/vue_js/components/cable.rb
|
67
|
-
- lib/matestack/ui/vue_js/components/collection/content.js
|
68
|
-
- lib/matestack/ui/vue_js/components/collection/content.rb
|
69
|
-
- lib/matestack/ui/vue_js/components/collection/filter.js
|
70
|
-
- lib/matestack/ui/vue_js/components/collection/filter.rb
|
71
|
-
- lib/matestack/ui/vue_js/components/collection/filter_reset.rb
|
72
|
-
- lib/matestack/ui/vue_js/components/collection/helper.rb
|
73
|
-
- lib/matestack/ui/vue_js/components/collection/next.rb
|
74
|
-
- lib/matestack/ui/vue_js/components/collection/order.js
|
75
|
-
- lib/matestack/ui/vue_js/components/collection/order.rb
|
76
|
-
- lib/matestack/ui/vue_js/components/collection/order_toggle.rb
|
77
|
-
- lib/matestack/ui/vue_js/components/collection/order_toggle_indicator.rb
|
78
|
-
- lib/matestack/ui/vue_js/components/collection/page.rb
|
79
|
-
- lib/matestack/ui/vue_js/components/collection/previous.rb
|
80
|
-
- lib/matestack/ui/vue_js/components/form/base.rb
|
81
|
-
- lib/matestack/ui/vue_js/components/form/checkbox.js
|
82
|
-
- lib/matestack/ui/vue_js/components/form/checkbox.rb
|
83
|
-
- lib/matestack/ui/vue_js/components/form/checkbox_mixin.js
|
84
|
-
- lib/matestack/ui/vue_js/components/form/context.rb
|
85
|
-
- lib/matestack/ui/vue_js/components/form/form.js
|
86
|
-
- lib/matestack/ui/vue_js/components/form/form.rb
|
87
|
-
- lib/matestack/ui/vue_js/components/form/input.js
|
88
|
-
- lib/matestack/ui/vue_js/components/form/input.rb
|
89
|
-
- lib/matestack/ui/vue_js/components/form/input_mixin.js
|
90
|
-
- lib/matestack/ui/vue_js/components/form/radio.js
|
91
|
-
- lib/matestack/ui/vue_js/components/form/radio.rb
|
92
|
-
- lib/matestack/ui/vue_js/components/form/radio_mixin.js
|
93
|
-
- lib/matestack/ui/vue_js/components/form/select.js
|
94
|
-
- lib/matestack/ui/vue_js/components/form/select.rb
|
95
|
-
- lib/matestack/ui/vue_js/components/form/select_mixin.js
|
96
|
-
- lib/matestack/ui/vue_js/components/form/textarea.js
|
97
|
-
- lib/matestack/ui/vue_js/components/form/textarea.rb
|
98
|
-
- lib/matestack/ui/vue_js/components/form/textarea_mixin.js
|
99
|
-
- lib/matestack/ui/vue_js/components/isolated.js
|
100
|
-
- lib/matestack/ui/vue_js/components/isolated.rb
|
101
|
-
- lib/matestack/ui/vue_js/components/mixin.js
|
102
|
-
- lib/matestack/ui/vue_js/components/onclick.js
|
103
|
-
- lib/matestack/ui/vue_js/components/onclick.rb
|
104
|
-
- lib/matestack/ui/vue_js/components/toggle.js
|
105
|
-
- lib/matestack/ui/vue_js/components/toggle.rb
|
106
|
-
- lib/matestack/ui/vue_js/components/transition.js
|
107
|
-
- lib/matestack/ui/vue_js/components/transition.rb
|
108
|
-
- lib/matestack/ui/vue_js/event_hub.js
|
109
|
-
- lib/matestack/ui/vue_js/helpers/query_params_helper.js
|
110
|
-
- lib/matestack/ui/vue_js/index.js
|
111
|
-
- lib/matestack/ui/vue_js/initialize.rb
|
112
|
-
- lib/matestack/ui/vue_js/page/content.js
|
113
|
-
- lib/matestack/ui/vue_js/vue.rb
|
114
|
-
- lib/matestack/ui/vue_js_component.rb
|
115
54
|
homepage: https://matestack.io
|
116
55
|
licenses:
|
117
56
|
- MIT
|
@@ -128,11 +67,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
67
|
version: '0'
|
129
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
69
|
requirements:
|
131
|
-
- - "
|
70
|
+
- - ">"
|
132
71
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
72
|
+
version: 1.3.1
|
134
73
|
requirements: []
|
135
|
-
rubygems_version: 3.1.
|
74
|
+
rubygems_version: 3.1.4
|
136
75
|
signing_key:
|
137
76
|
specification_version: 4
|
138
77
|
summary: Escape the frontend hustle & easily create interactive web apps in pure Ruby.
|
data/lib/matestack/ui/app.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Matestack::Ui::App = Matestack::Ui::Core::App
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import Vue from 'vue/dist/vue.esm'
|
2
|
-
import VRuntimeTemplate from "v-runtime-template"
|
3
|
-
import Vuex from 'vuex'
|
4
|
-
|
5
|
-
import isNavigatingToAnotherPage from "./location"
|
6
|
-
import matestackEventHub from '../event_hub'
|
7
|
-
|
8
|
-
const componentDef = {
|
9
|
-
props: ['appConfig', 'params'],
|
10
|
-
data: function(){
|
11
|
-
return {}
|
12
|
-
},
|
13
|
-
computed: Vuex.mapState({
|
14
|
-
asyncTemplate: state => state.pageTemplate,
|
15
|
-
currentPathName: state => state.currentPathName,
|
16
|
-
currentSearch: state => state.currentSearch,
|
17
|
-
currentOrigin: state => state.currentOrigin,
|
18
|
-
}),
|
19
|
-
mounted: function(){
|
20
|
-
const self = this;
|
21
|
-
window.addEventListener("popstate", (event) => {
|
22
|
-
if (isNavigatingToAnotherPage({
|
23
|
-
origin: self.currentOrigin,
|
24
|
-
pathName: self.currentPathName,
|
25
|
-
search: self.currentSearch
|
26
|
-
}, document.location)){
|
27
|
-
matestackEventHub.$emit("page_loading_triggered", document.location.pathname + document.location.search);
|
28
|
-
this.$store.commit('setPageLoading', true);
|
29
|
-
self.$store.dispatch("navigateTo", { url: document.location.pathname + document.location.search, backwards: true } );
|
30
|
-
}
|
31
|
-
})
|
32
|
-
},
|
33
|
-
components: {
|
34
|
-
VRuntimeTemplate: VRuntimeTemplate
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
let component = Vue.component('matestack-ui-core-app', componentDef)
|
39
|
-
|
40
|
-
export default componentDef
|
@@ -1,9 +0,0 @@
|
|
1
|
-
const isNavigatingToAnotherPage = function(currentLocation, targetLocation) {
|
2
|
-
|
3
|
-
// omits hash by design
|
4
|
-
return currentLocation.pathName !== targetLocation.pathname ||
|
5
|
-
currentLocation.origin !== targetLocation.origin ||
|
6
|
-
currentLocation.search !== targetLocation.search
|
7
|
-
}
|
8
|
-
|
9
|
-
export default isNavigatingToAnotherPage
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import Vue from 'vue/dist/vue.esm'
|
2
|
-
import Vuex from 'vuex'
|
3
|
-
import axios from 'axios'
|
4
|
-
import matestackEventHub from '../event_hub'
|
5
|
-
|
6
|
-
Vue.use(Vuex)
|
7
|
-
|
8
|
-
const store = new Vuex.Store({
|
9
|
-
state: {
|
10
|
-
pageTemplate: null,
|
11
|
-
pageLoading: false,
|
12
|
-
currentPathName: document.location.pathname,
|
13
|
-
currentSearch: document.location.search,
|
14
|
-
currentOrigin: document.location.origin
|
15
|
-
},
|
16
|
-
mutations: {
|
17
|
-
setPageTemplate (state, serverResponse){
|
18
|
-
state.pageTemplate = serverResponse
|
19
|
-
},
|
20
|
-
setPageLoading (state, boolean){
|
21
|
-
state.pageLoading = boolean
|
22
|
-
},
|
23
|
-
setCurrentLocation (state, current){
|
24
|
-
state.currentPathName = current.path
|
25
|
-
state.currentSearch = current.search
|
26
|
-
state.currentOrigin = current.origin
|
27
|
-
},
|
28
|
-
resetPageTemplate (state) {
|
29
|
-
state.pageTemplate = null;
|
30
|
-
},
|
31
|
-
pageScrollTop (state) {
|
32
|
-
//https://stackoverflow.com/a/35940276/13886137
|
33
|
-
const getScrollParent = function(node) {
|
34
|
-
if (node == null) {
|
35
|
-
return null
|
36
|
-
}
|
37
|
-
if (node.scrollHeight > node.clientHeight) {
|
38
|
-
return node
|
39
|
-
} else {
|
40
|
-
return getScrollParent(node.parentNode)
|
41
|
-
}
|
42
|
-
}
|
43
|
-
var scrollParent = getScrollParent(document.getElementsByClassName("matestack-page-root")[0])
|
44
|
-
if(scrollParent){
|
45
|
-
scrollParent.scrollTop = 0;
|
46
|
-
}
|
47
|
-
// getScrollParent(document.getElementsByClassName("matestack-page-root")[0]).scrollTop = 0
|
48
|
-
}
|
49
|
-
},
|
50
|
-
actions: {
|
51
|
-
navigateTo ({ commit, state }, { url, backwards }) {
|
52
|
-
const self = this
|
53
|
-
commit('setPageLoading', true)
|
54
|
-
matestackEventHub.$emit("page_loading", url);
|
55
|
-
if (typeof matestackUiCoreTransitionStart !== 'undefined') {
|
56
|
-
matestackUiCoreTransitionStart(url);
|
57
|
-
}
|
58
|
-
if (!window.history.pushState) {
|
59
|
-
document.location.href = url;
|
60
|
-
return;
|
61
|
-
}
|
62
|
-
return new Promise((resolve, reject) => {
|
63
|
-
axios({
|
64
|
-
method: "get",
|
65
|
-
url: url,
|
66
|
-
headers: {
|
67
|
-
'X-CSRF-Token': document.getElementsByName("csrf-token")[0].getAttribute('content')
|
68
|
-
},
|
69
|
-
params: {"only_page": true}
|
70
|
-
})
|
71
|
-
.then(function(response){
|
72
|
-
if (backwards){
|
73
|
-
window.history.replaceState({matestackApp: true, url: url}, null, url);
|
74
|
-
} else {
|
75
|
-
window.history.pushState({matestackApp: true, url: url}, null, url);
|
76
|
-
}
|
77
|
-
setTimeout(function () {
|
78
|
-
resolve(response["data"]);
|
79
|
-
commit('setPageTemplate', response["data"])
|
80
|
-
commit('setCurrentLocation', { path: url.split("?")[0], search: document.location.search, origin: document.location.origin })
|
81
|
-
commit('setPageLoading', false)
|
82
|
-
commit('pageScrollTop')
|
83
|
-
matestackEventHub.$emit("page_loaded", url);
|
84
|
-
if (typeof matestackUiCoreTransitionSuccess !== 'undefined') {
|
85
|
-
matestackUiCoreTransitionSuccess(url);
|
86
|
-
}
|
87
|
-
}, 5);
|
88
|
-
})
|
89
|
-
.catch(function(error){
|
90
|
-
setTimeout(function () {
|
91
|
-
resolve(error)
|
92
|
-
matestackEventHub.$emit("page_loading_error", error);
|
93
|
-
if (typeof matestackUiCoreTransitionError !== 'undefined') {
|
94
|
-
matestackUiCoreTransitionError(url);
|
95
|
-
}
|
96
|
-
}, 5);
|
97
|
-
})
|
98
|
-
})
|
99
|
-
}
|
100
|
-
}
|
101
|
-
})
|
102
|
-
|
103
|
-
export default store
|