Skip to content

Commit 5cbf15b

Browse files
Merge pull request #249 from basemate/improve_generators
Add indentation & class_name to templates Thanks for the review, mate! @jonasjabari I am merging this to shift the discussion towards @marcoroth's other PRs touching this topic!
2 parents 3bfbae8 + 3cf4422 commit 5cbf15b

File tree

2 files changed

+49
-30
lines changed

2 files changed

+49
-30
lines changed
Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
class Apps::<%= class_name %> < Matestack::Ui::App
22

3-
# OPTIONAL: Prepare data that gets used on every page of this app
4-
# def prepare
5-
# API calls and db queries go here
6-
# end
3+
# OPTIONAL: Prepare data that gets used on every page of this app
4+
# def prepare
5+
# API calls and db queries go here
6+
# end
77

8-
# MANDATORY: This is where your matestack pages get yielded
9-
def response
10-
components {
11-
page_content
12-
}
13-
end
8+
# MANDATORY: This is where your matestack pages get yielded
9+
def response
10+
components {
11+
heading text: 'Welcome to your <%= class_name %> app'
12+
page_content
13+
}
14+
end
1415

15-
# OPTIONAL: Use partials to render stuff like layout components
16-
# def partial_one
17-
# partial {
18-
# # your components go here
19-
# }
20-
# end
16+
# OPTIONAL: Use partials to render stuff like layout components
17+
# def partial_example
18+
# partial {
19+
# # your components go here
20+
# }
21+
# end
2122

22-
# OPTIONAL: Slots come after partials
23-
# def slots
24-
# end
23+
# OPTIONAL: Slots come after partials
24+
# def slot_example
25+
# slot {
26+
# # your components go here
27+
# }
28+
# end
2529

2630
end
Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
class Pages::<% unless @namespace.nil? %><%= @namespace.camelize %>::<% end %><% unless @app_name.nil? %><%= @app_name.camelize %>::<% end %><%= class_name %> < Matestack::Ui::Page
22

3-
# OPTIONAL: Prepare data for the response method
4-
# def prepare
5-
# API calls and db queries go here
6-
# end
7-
8-
# MANDATORY: This is where the matestack magic happens
9-
def response
10-
components {
11-
plain 'Hello, mate!'
12-
}
13-
end
3+
# OPTIONAL: Prepare data for the response method
4+
# def prepare
5+
# API calls and db queries go here
6+
# end
7+
8+
# MANDATORY: This is where the matestack magic happens
9+
def response
10+
components {
11+
heading text: 'Welcome to your <%= class_name %> page'
12+
page_content
13+
}
14+
end
15+
16+
# OPTIONAL: Use partials to render stuff like layout components
17+
# def partial_example
18+
# partial {
19+
# # your components go here
20+
# }
21+
# end
22+
23+
# OPTIONAL: Slots come after partials
24+
# def slot_example
25+
# slot {
26+
# # your components go here
27+
# }
28+
# end
1429

1530
end

0 commit comments

Comments
 (0)