Last active
February 27, 2021 06:38
-
-
Save patrixr/a77caf8affbd7044f92ad75167034927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page :home do | |
header do | |
add_link 'Home', to: :home | |
add_link 'Posts', to: :posts | |
end | |
section :description, layout: :horizontal do | |
section :image do | |
add_image '/some/image' | |
end | |
section :text do | |
add_paragraph %{ Lorem ipsum something something } | |
end | |
end | |
section :contact do | |
form :contact_form do | |
text_input :fullname | |
email_input :email | |
textarea_input :message | |
submit do |data, ctx| | |
# the code of this block will be executed on the server | |
something(data[:email]) | |
something(data[:message]) | |
ctx.redirect :thank_you_page | |
end | |
end | |
end | |
end | |
page :post, params: [:id] do |params| | |
header do | |
add_link 'Home', to: :home | |
add_link 'Posts', to: :posts | |
end | |
section :content do | |
add_paragraph do | |
Database.getPost(params[:id]).text # dynamic content | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment