Skip to content

Commit

Permalink
Allowing static views for page files as well as db-backed ones for users
Browse files Browse the repository at this point in the history
  • Loading branch information
augustf committed Aug 3, 2014
1 parent ba464e6 commit 71141cf
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Expand Up @@ -8,7 +8,7 @@ def index
# GET /pages/1
def show
@page = Page.find(params[:id])
@markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
render "#{@page.title.parameterize}", :layout => true, :locals => { :page => @page } rescue nil
auth!
end

Expand Down
4 changes: 4 additions & 0 deletions app/models/page.rb
@@ -1,3 +1,7 @@
class Page < ActiveRecord::Base

def to_param
"#{id}-#{title.parameterize}"
end

end
12 changes: 12 additions & 0 deletions app/views/pages/concerto-init-d-startup-script.html.erb
@@ -0,0 +1,12 @@
<%
some_markdown = %{
# Init Script Installation

The concerto-init.d script should be copied to /etc/init.d/concerto and installed with update-rc.d and concerto defaults
invoke-rc.d concerto start

}
%>
<% @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true) %>
<%=raw @markdown.render(some_markdown) %>
2 changes: 2 additions & 0 deletions app/views/pages/show.html.erb
@@ -1,3 +1,5 @@
<% @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true) %>

<p id="notice"><%= notice %></p>

<h1><%= @page.title %></h1>
Expand Down
1 change: 0 additions & 1 deletion db/seed_assets/pages.yml
@@ -1,4 +1,3 @@
pages:
- title: "Concerto Init.d Startup Script"
category: Setup
body: "The concerto-init.d script should be installed to /etc/init.d/concerto"

0 comments on commit 71141cf

Please sign in to comment.