Sha256: 9aa080e42666eb0a62867d255829f3fe3160d3096a7364531f70510e55eb1cd3
Contents?: true
Size: 1.75 KB
Versions: 6
Compression:
Stored size: 1.75 KB
Contents
module Amalgam class Admin::PagesController < Admin::BaseController def index @pages = Page.all respond_to do |format| format.html format.json { render :json => @pages } end end # GET /pages/1 # GET /pages/1.json def show @page = Page.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @page } end end # GET /pages/new # GET /pages/new.json def new @parent = Page.find(params[:parent_id]) if params[:parent_id].present? @page = @parent? @parent.children.new : Page.new respond_to do |format| format.html # new.html.erb format.js {render :partial => 'inline_form'} end end def edit @page = Page.find(params[:id]) end def create params[:page][:group_ids] ||= [] @page = Page.new(params[:page]) respond_to do |format| if @page.save format.html { redirect_to admin_pages_path(:anchor => "node-#{@page.id}"), :notice => 'Page was successfully created.' } else format.html { render :action => "new" } end format.js end end def update params[:page][:group_ids] ||= [] @page = Page.find(params[:id]) respond_to do |format| if @page.update_attributes(params[:page]) format.html { redirect_to :back, :notice => 'Page was successfully updated.' } else format.html { render :action=> "edit" } end format.js end end def destroy @page = Page.find(params[:id]) @page.destroy respond_to do |format| format.html { redirect_to admin_pages_url } format.js end end end end
Version data entries
6 entries across 6 versions & 1 rubygems