Permalink
Browse files

1. Modifed the README to include the template type example

2. Addded template_type in config.rb
3. Modified the feather_cms controller methods to render according to the template_type
4. Added 'html' and 'haml' as template_types in the initializer
5. Modified the migration to include the template_type
  • Loading branch information...
1 parent 29d2c94 commit cff4fea41f100f370bceeeeb0900f04649a16785 kiran committed Jun 8, 2012
View
@@ -24,6 +24,10 @@ This has basic HTTP authentication setup.The default username and password are f
http_basic_authenticate_with name: 'feather', password: 'password', except: :published
+Template types can be added in the feather_cms initializer
+
+ eg. c.template_types = ["html", "haml"]
+
# Features
* Creates a route for each static page.
@@ -5,7 +5,6 @@ class << self
attr_accessor :template_store_type
@@config = {
- :template_store_path => 'templates',
:use_version => true,
:template_extenstion => 'html'
}
@@ -15,7 +14,6 @@ def init(&block)
template_store_type = :db
FeatherCms::TemplateCache.init
- Dir.mkdir(template_store_path) unless Dir.exists?(template_store_path)
if defined?(Rails)
@@config[:layouts] = Dir.entries(Rails.root.to_s + '/app/views/layouts').reject do |i|
@@ -28,7 +26,7 @@ def layouts
@@config[:layouts]
end
- [:template_store_path, :template_extenstion, :authentication].each do |attr|
+ [:template_extenstion, :authentication, :template_types].each do |attr|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def #{attr}=(value)
@@config[:#{attr}] = value
@@ -24,12 +24,12 @@ def page
end
def preivew
- render inline: @feather_page.content, type: 'html', layout: @feather_page.layout
+ render inline: @feather_page.content, type: @feather_page.template_type, 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
+ render inline: @feather_page.content, type: @feather_page.template_type, layout: @feather_page.layout
end
def find_page
@@ -28,6 +28,10 @@
<%%= f.select :layout, FeatherCms::Config.layouts %>
</div>
</div>
+ <label class="control-label" for="layout">Template Type</label>
+ <div class="controls">
+ <%%= f.select :template_type, FeatherCms::Config.template_types %>
+ </div>
<div class="control-group">
<label class="control-label" for="textarea">Content</label>
<div class="controls">
@@ -5,4 +5,5 @@
#c.authentication = :authenticate_user!
#c.template_extenstion = 'html' #default : html
+ c.template_types = ["html", "haml"]
end
@@ -5,6 +5,7 @@ def change
t.string :status, :default => 'draft'
t.text :content
t.string :layout, :default => 'application'
+ t.string :template_type, :default => 'html'
t.timestamps
end
end
@@ -1,5 +1,5 @@
class FeatherPage < ActiveRecord::Base
include FeatherCms
- attr_accessible :status, :layout, :content
+ attr_accessible :status, :layout, :content, :template_type
end

0 comments on commit cff4fea

Please sign in to comment.