Skip to content
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

Creating a new page with custom template (task 1) and having menu partia... #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@
# @which_fake_page = "Rendering a fake page with a variable"
# end


page "/source/new.html", :layout => "template"


###
#Sitemaps
###


ready do
sitemap.pages.group_by {|p| p.data["source"] }.each do |source, pages|
page "/source/#{source}.html", :proxy => "new.html" do
@source = source
@pages = pages
end
end
end


###
# Helpers
###
Expand Down Expand Up @@ -82,4 +101,4 @@

# Or use a different image path
# set :http_path, "/Content/images/"
end
end
14 changes: 14 additions & 0 deletions source/layouts/template.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Sample Template</title>
</head>
<body>
<header><%= render "partials/header" %></header>
<%= render :partial => "partials/menu" %>

<%= yeild %>

<footer><%= render :partial => "partials/footer" %></footer>
</body>
</html>
3 changes: 3 additions & 0 deletions source/new.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>Welcome to EntIO LLC</h1>

<p>This is a sample page which uses a custom template</p>
1 change: 1 addition & 0 deletions source/partials/_footer.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h3>this is sample footer</h3>
1 change: 1 addition & 0 deletions source/partials/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>This is sample header</h1>
1 change: 1 addition & 0 deletions source/partials/_menu.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= current_resource %>