File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
helpers/matestack/ui/core Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module Matestack
2
2
module Ui
3
3
module Core
4
4
module ApplicationHelper
5
+ include Matestack ::Ui ::Core ::Render
5
6
6
7
def render_page ( page_class , only_page = false )
7
8
page_class . new ( nil , context : {
Original file line number Diff line number Diff line change
1
+ module Matestack ::Ui ::Core ::Render
2
+
3
+ # Matestack allows you to use `render` to render matestack pages.
4
+ #
5
+ # render Pages::Member::Bookings
6
+ # render matestack: Pages::Member::Bookings
7
+ # render matestack: 'member/bookings'
8
+ #
9
+ def render ( *args )
10
+ if ( matestack_class = args . first ) . is_a? ( Class ) && ( matestack_class < Matestack ::Ui ::Page )
11
+ responder_for matestack_class
12
+ elsif ( options = args . first ) . kind_of? ( Hash ) && ( matestack_arg = options [ :matestack ] ) . present?
13
+ if ( matestack_path = matestack_arg ) . kind_of? String
14
+ matestack_path = "pages/#{ matestack_path } " unless matestack_path . start_with? ( "pages/" ) or matestack_path . start_with? ( "components/" )
15
+ matestack_class = matestack_path . split ( "/" ) . collect { |str | str . camelcase } . join ( "::" ) . constantize
16
+ elsif matestack_arg . is_a? ( Class ) && ( matestack_arg < Matestack ::Ui ::Page )
17
+ matestack_class = matestack_arg
18
+ end
19
+ responder_for matestack_class
20
+ else
21
+ super
22
+ end
23
+ end
24
+
25
+ end
You can’t perform that action at this time.
0 commit comments