Sha256: b9b40f14b2635907b4ac29c5cba7ba92bcf330b0a244660afc0f3faf14d7fae9
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
class FeathersController < ApplicationController http_basic_authenticate_with name: 'feather', password: 'password', except: :published before_filter :find_page, only: [:page, :preivew] 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 = 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 def find_page status = params[:feather_page] ? params[:feather_page][:status] : (params[:status] || 'draft') @feather_page = FeatherPage.where(name: params[:type], status: status) @feather_page = @feather_page.first || @feather_page.new end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
feather_cms-0.0.2 | lib/generators/feather_cms/templates/controller.rb |
feather_cms-0.0.1 | lib/generators/feather_cms/templates/controller.rb |