Class: Fuel::PostsController
- Inherits:
-
FuelController
- Object
- ApplicationController
- FuelController
- FuelController
- Fuel::PostsController
- Includes:
- ActionView::Helpers::TextHelper
- Defined in:
- app/controllers/fuel/posts_controller.rb
Instance Method Summary collapse
Methods inherited from FuelController
Instance Method Details
#define_title ⇒ Object
7 8 9 |
# File 'app/controllers/fuel/posts_controller.rb', line 7 def define_title @blog_title = Fuel.configuration.blog_title end |
#index ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/fuel/posts_controller.rb', line 11 def index @posts = Fuel::Post.recent_published_posts.page(params[:page]) @title = Fuel.configuration.blog_title @description = Fuel.configuration.blog_description respond_to do |format| format.html format.json { render json: @posts, :methods => [:avatar_url, :featured_image_url] } end end |
#preview ⇒ Object
34 35 36 37 38 39 |
# File 'app/controllers/fuel/posts_controller.rb', line 34 def preview @content = params[:content] respond_to do |format| format.js end end |
#redirect ⇒ Object
41 42 43 44 |
# File 'app/controllers/fuel/posts_controller.rb', line 41 def redirect post = Fuel::Post.find_by_slug(params[:id]) || Fuel::Post.find_by_id(params[:id]) return redirect_to fuel.post_path(post) end |
#show ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/fuel/posts_controller.rb', line 22 def show @post = Fuel::Post.find_by_slug(params[:id]) || Fuel::Post.find_by_id(params[:id]) || not_found @title = truncate_on_space(@post.seo_title || @post.title, 70) @description = @post.seo_description @disqus_name = Fuel.configuration.disqus_name respond_to do |format| format.html format.json { render json: @post, :methods => [:avatar_url, :featured_image_url] } end end |