Sha256: 746fd429883a3fced9f7403291c5ffdbc24df5e4bee97b136af482aaaf38121e
Contents?: true
Size: 1.33 KB
Versions: 17
Compression:
Stored size: 1.33 KB
Contents
class Admin::PublicationsController < ApplicationController before_filter :authenticate_user! if Object.const_defined?('Devise') def index @publications = Publication.all.order_by(:name.asc) end def show @publication = Publication.find(params[:id]) @managed_content = @publication.managed_contents.sort{|a,b| a.headline <=> b.headline} @managed_content = @managed_content.sort{|a,b| a.position.to_i <=> b.position.to_i} if @publication.has_faqs? end def new @publication = Publication.new end def create @publication = Publication.new(params[:publication]) if @publication.save flash[:notice] = "Successfully created a new publication." redirect_to admin_publication_path(@publication) else render :action => 'new' end end def edit @publication = Publication.find(params[:id]) end def update @publication = Publication.find(params[:id]) if @publication.update_attributes(params[:publication]) flash[:notice] = "Successfully updated the publication." redirect_to admin_publication_path(@publication) else render :action => 'edit' end end def destroy @publication = Publication.find(params[:id]) @publication.destroy flash[:notice] = "Successfully destroyed the publication." redirect_to admin_publications_path end end
Version data entries
17 entries across 17 versions & 1 rubygems