Class: Gluttonberg::Admin::Content::BlogsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Gluttonberg::Admin::Content::BlogsController
- Defined in:
- app/controllers/gluttonberg/admin/content/blogs_controller.rb
Instance Method Summary (collapse)
- - (Object) create
- - (Object) delete
- - (Object) destroy
- - (Object) edit
- - (Object) index
- - (Object) new
- - (Object) update
Instance Method Details
- (Object) create
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 21 def create @blog = Blog.new(params[:gluttonberg_blog]) if @blog.save flash[:notice] = "The blog was successfully created." redirect_to admin_blogs_path else render :edit end end |
- (Object) delete
48 49 50 51 52 53 54 55 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 48 def delete display_delete_confirmation( :title => "Delete Blog '#{@blog.name}'?", :url => admin_blog_path(@blog), :return_url => admin_blogs_path, :warning => "This will delete all the articles that belong to this blog" ) end |
- (Object) destroy
57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 57 def destroy if @blog.delete flash[:notice] = "The blog was successfully deleted." redirect_to admin_blogs_path else flash[:error] = "There was an error deleting the blog." redirect_to admin_blogs_path end end |
- (Object) edit
31 32 33 34 35 36 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 31 def edit unless params[:version].blank? @version = params[:version] @blog.revert_to(@version) end end |
- (Object) index
13 14 15 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 13 def index @blogs = Blog.all.paginate(:per_page => Gluttonberg::Setting.get_setting("number_of_per_page_items"), :page => params[:page]) end |
- (Object) new
17 18 19 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 17 def new @blog = Blog.new end |
- (Object) update
38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/gluttonberg/admin/content/blogs_controller.rb', line 38 def update if @blog.update_attributes(params[:gluttonberg_blog]) flash[:notice] = "The blog was successfully updated." redirect_to admin_blogs_path else flash[:error] = "Sorry, The blog could not be updated." render :edit end end |