Class: Fuel::Admin::PostsController
- Inherits:
-
AdminController
- Object
- ApplicationController
- FuelController
- AdminController
- Fuel::Admin::PostsController
- Defined in:
- app/controllers/fuel/admin/posts_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #preview ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from FuelController
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 16 def create @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_post] : post_params update_published_at @post = Fuel::Post.new(@params_hash) if @post.save redirect_to fuel.admin_posts_path, notice: "Your blog post was successfully #{@message}." else render action: "new" end end |
#destroy ⇒ Object
46 47 48 49 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 46 def destroy @post.destroy redirect_to fuel.admin_posts_path, notice: "Post was successfully deleted" end |
#edit ⇒ Object
29 30 31 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 29 def edit end |
#index ⇒ Object
9 10 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 9 def index end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 12 def new @post = Fuel::Post.new end |
#preview ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 51 def preview @content = params[:fuel_post][:content] content = Fuel::Post.new.to_html(@content) html = render_to_string partial: "fuel/admin/posts/content", locals: { content: content } respond_to do |format| format.json { render json: { html: html } } end end |
#show ⇒ Object
61 62 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 61 def show end |
#update ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/fuel/admin/posts_controller.rb', line 33 def update @params_hash = Rails.version[0].to_i < 4 ? params[:fuel_post] : post_params update_published_at @post.attributes = @params_hash if @post.save redirect_to fuel.edit_admin_post_path(@post), notice: "Post was updated and #{@message}" else render "edit" end end |