Skip to content

Commit d677004

Browse files
committed
finalized preparation of repo/gem split, various refactorings, prepared version bumps
1 parent ea24a5b commit d677004

31 files changed

+164
-158
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
matestack-ui-core (2.1.1)
4+
matestack-ui-core (3.0.0)
55
rails (>= 5.2)
66

77
GEM

lib/matestack/ui/app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Matestack::Ui::App = Matestack::Ui::Core::App
1+
Matestack::Ui::App = Matestack::Ui::Core::Layout

lib/matestack/ui/core.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ module Core
1414
require "#{base_path}/base"
1515
require "#{base_path}/component"
1616
require "#{base_path}/page"
17-
require "#{base_path}/app"
17+
require "#{base_path}/layout"
1818
require "#{base_path}/helper"
1919

2020
# require abbreveations for apps, pages and components
21-
require "matestack/ui/app"
21+
require "matestack/ui/app" # deprecated
22+
require "matestack/ui/layout"
2223
require "matestack/ui/page"
2324
require "matestack/ui/component"
2425

@@ -35,8 +36,8 @@ module VueJs
3536
require "#{vue_js_base_path}/utils"
3637
require "#{vue_js_base_path}/vue_attributes"
3738
require "#{vue_js_base_path}/vue"
38-
require "#{vue_js_base_path}/app"
39-
require "#{vue_js_base_path}/page"
39+
require "#{vue_js_base_path}/components/app"
40+
require "#{vue_js_base_path}/components/page_switch"
4041
require "#{vue_js_base_path}/components/toggle"
4142
require "#{vue_js_base_path}/components/onclick"
4243
require "#{vue_js_base_path}/components/transition"
@@ -70,3 +71,4 @@ module VueJs
7071

7172
# require abbreveations for apps, pages and components
7273
require "matestack/ui/vue_js_component"
74+
require "matestack/ui/isolated_component"

lib/matestack/ui/core/helper.rb

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ module Matestack
22
module Ui
33
module Core
44
module Helper
5-
5+
66
def self.included(base)
77
base.extend ClassMethods
88
end
9-
9+
1010
module ClassMethods
1111
def inherited(subclass)
12-
subclass.matestack_app(@matestack_app)
12+
subclass.matestack_layout(@matestack_layout)
1313
super
1414
end
15-
16-
def matestack_app(app = nil)
17-
@matestack_app = app ? app : @matestack_app
15+
16+
def matestack_layout(layout = nil)
17+
@matestack_layout = layout ? layout : @matestack_layout
1818
end
1919
end
20-
20+
2121
def render(*args)
2222
setup_context
2323
if args.first.is_a?(Class) && args.first.ancestors.include?(Base)
@@ -30,62 +30,62 @@ def render(*args)
3030
end
3131

3232
options = args.second || {}
33-
app = options.delete(:matestack_app) || self.class.matestack_app
33+
layout = options.delete(:matestack_layout) || self.class.matestack_layout
3434
page = args.first
3535

3636
if controller_layout == false
37-
layout = app ? app.layout : false
37+
root_layout = layout ? layout.layout : false
3838
else
3939
if controller_layout.nil?
40-
layout = "application"
40+
root_layout = "application"
4141
else
42-
layout = controller_layout
42+
root_layout = controller_layout
4343
end
4444
end
45-
46-
if app && params[:only_page].nil? && params[:component_key].nil? && params[:component_class].nil?
47-
render_app app, page, options, layout
45+
46+
if layout && params[:only_page].nil? && params[:component_key].nil? && params[:component_class].nil?
47+
render_layout layout, page, options, root_layout
4848
else
4949
if params[:component_key] && params[:component_class].nil?
50-
render_component app, page, params[:component_key], options
50+
render_component layout, page, params[:component_key], options
5151
elsif params[:component_class]
5252
if params[:component_key]
5353
render_component nil, params[:component_class].constantize, params[:component_key], JSON.parse(params[:public_options] || '{}')
54-
else
54+
else
5555
render html: params[:component_class].constantize.(public_options: JSON.parse(params[:public_options] || '{}'))
5656
end
5757
else
5858
if params[:only_page]
5959
render_page page, options, false
6060
else
61-
render_page page, options, layout
61+
render_page page, options, root_layout
6262
end
6363
end
6464
end
6565
else
6666
super
6767
end
6868
end
69-
70-
def render_app(app, page, options, layout)
71-
render html: app.new(options) { page.new(options) }.render_content.html_safe, layout: layout
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
7272
end
73-
74-
def render_page(page, options, layout)
75-
render html: page.new(options).render_content.html_safe, layout: layout
73+
74+
def render_page(page, options, root_layout)
75+
render html: page.new(options).render_content.html_safe, layout: root_layout
7676
end
77-
78-
def render_component(app, page, component_key, options)
79-
app ? app.new(options) { page.new(options) } : page.new(options) # create page structure in order to later access registered async components
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
8080
render html: Matestack::Ui::Core::Context.async_components[component_key].render_content.html_safe, layout: false
8181
end
82-
82+
8383
def setup_context
8484
Matestack::Ui::Core::Context.params = self.params
8585
Matestack::Ui::Core::Context.controller = (self.class <= ActionController::Base) ? self : @_controller
8686
end
87-
87+
8888
end
8989
end
9090
end
91-
end
91+
end

lib/matestack/ui/core/app.rb renamed to lib/matestack/ui/core/layout.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Matestack
22
module Ui
33
module Core
4-
class App < Base
4+
class Layout < Base
55

66
def initialize(options = {})
77
@controller = Context.controller

lib/matestack/ui/core/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Matestack
22
module Ui
33
module Core
4-
VERSION = '2.1.1'
4+
VERSION = '3.0.0'
55
end
66
end
77
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Matestack::Ui::IsolatedComponent = Matestack::Ui::VueJs::Components::Isolated

lib/matestack/ui/layout.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Matestack::Ui::Layout = Matestack::Ui::Core::Layout

lib/matestack/ui/page.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Matestack::Ui::Page = Matestack::Ui::Core::Page
1+
Matestack::Ui::Page = Matestack::Ui::Core::Page

lib/matestack/ui/vue_js/app.rb

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)