Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jiren Patel
committed
Apr 30, 2012
1 parent
2fb7b3d
commit ef9d004
Showing
13 changed files
with
90 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
class FeathersController < ApplicationController | ||
http_basic_authenticate_with :name => "feather", :password => "password" | ||
layout 'feather_layout' | ||
before_filter :find_page | ||
http_basic_authenticate_with name: 'feather', password: 'password', except: :published | ||
before_filter :find_page, only: [:page, :preivew] | ||
|
||
<% @pages.each do |page| %> | ||
def <%= page %> | ||
layout 'feather_layout', except: [:preivew, :published] | ||
|
||
def index | ||
@pages = FeatherPage.all | ||
end | ||
|
||
def page | ||
if request.put? or request.post? | ||
@feather_page.attributes = params[:feather_page] | ||
@feather_page.name = "<%= page %>" | ||
@feather_page.name = params[:type] | ||
@feather_page.save | ||
end | ||
render action: @feather_page.name | ||
end | ||
|
||
def preivew | ||
render inline: @feather_page.content, type: 'html', layout: @feather_page.layout | ||
end | ||
|
||
def published | ||
@feather_page = FeatherPage.where(name: params[:type], status: 'published').first | ||
render inline: @feather_page.content, type: 'html', layout: @feather_page.layout | ||
end | ||
<% end %> | ||
|
||
def find_page | ||
status = params[:feather_page] ? params[:feather_page][:status] : (params[:status] || 'draft') | ||
@feather_page = FeatherPage.where(:name => params[:action], :status => status) | ||
@feather_page = FeatherPage.where(name: params[:type], status: status) | ||
@feather_page = @feather_page.first || @feather_page.new | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="row"> | ||
<ol> | ||
<%% @pages.each do |page| %> | ||
<li> | ||
<strong> | ||
<%%= link_to "#{page.name.humanize}(#{page.status})", feather_page_path(page.name, page.status) %> | ||
</strong> | ||
</li> | ||
<%% end %> | ||
</ol> | ||
</div> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
FeatherCms::Config.init do |c| | ||
c.template_store_path = 'public/system/templates' | ||
c.template_store_type = :<%= @storage %> | ||
#c.cache_max_limit = 50 #default : 20 | ||
#c.template_extenstion = 'html' #default : html | ||
end |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
class FeatherPage < ActiveRecord::Base | ||
include FeatherCms | ||
template_content_field :content | ||
end |