Skip to content

add indentation & class_name to templates #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions lib/generators/matestack_app/templates/matestack_app.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
class Apps::<%= class_name %> < Matestack::Ui::App

# OPTIONAL: Prepare data that gets used on every page of this app
# def prepare
# API calls and db queries go here
# end
# OPTIONAL: Prepare data that gets used on every page of this app
# def prepare
# API calls and db queries go here
# end

# MANDATORY: This is where your matestack pages get yielded
def response
components {
page_content
}
end
# MANDATORY: This is where your matestack pages get yielded
def response
components {
heading text: 'Welcome to your <%= class_name %> app'
page_content
}
end

# OPTIONAL: Use partials to render stuff like layout components
# def partial_one
# partial {
# # your components go here
# }
# end
# OPTIONAL: Use partials to render stuff like layout components
# def partial_example
# partial {
# # your components go here
# }
# end

# OPTIONAL: Slots come after partials
# def slots
# end
# OPTIONAL: Slots come after partials
# def slot_example
# slot {
# # your components go here
# }
# end

end
37 changes: 26 additions & 11 deletions lib/generators/matestack_page/templates/matestack_page.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
class Pages::<% unless @namespace.nil? %><%= @namespace.camelize %>::<% end %><% unless @app_name.nil? %><%= @app_name.camelize %>::<% end %><%= class_name %> < Matestack::Ui::Page

# OPTIONAL: Prepare data for the response method
# def prepare
# API calls and db queries go here
# end

# MANDATORY: This is where the matestack magic happens
def response
components {
plain 'Hello, mate!'
}
end
# OPTIONAL: Prepare data for the response method
# def prepare
# API calls and db queries go here
# end

# MANDATORY: This is where the matestack magic happens
def response
components {
heading text: 'Welcome to your <%= class_name %> page'
page_content
}
end

# OPTIONAL: Use partials to render stuff like layout components
# def partial_example
# partial {
# # your components go here
# }
# end

# OPTIONAL: Slots come after partials
# def slot_example
# slot {
# # your components go here
# }
# end

end