Sha256: 2db9c598f12aa986d6cd275f71dbb87487b8b090c4f96c11c69dc5407453d75f

Contents?: true

Size: 978 Bytes

Versions: 21

Compression:

Stored size: 978 Bytes

Contents

class PagesController < ApplicationController
  include Applicat::Mvc::Controller::Resource
  
  load_and_authorize_resource
  
  respond_to :html, :js, :json
  
  def index
    @pages = Page.order_by(name: 'ASC')
  end
  
  def show
    @page = Page.find(params[:id])
  end
  
  def new
    @page = Page.new
  end
  
  def create
    @page = Page.new(params[:page])
    @page.user = current_user
    
    if @page.save
      redirect_to @page, notice: t('general.form.successfully_created')
    else
      render :new
    end
  end
  
  def edit
    @page = Page.find(params[:id])
  end
  
  def update
    @page = Page.find(params[:id])
    
    if @page.update_attributes(params[:page])
      redirect_to @page, notice: t('general.form.successfully_updated')
    else
      render :edit
    end
  end

  def destroy
    @page = Page.find(params[:id])
    @page.destroy
    redirect_to pages_url, notice: t('general.form.destroyed')
  end
  
  def resource
    @page
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
voluntary-0.7.1 app/controllers/pages_controller.rb
voluntary-0.7.0 app/controllers/pages_controller.rb
voluntary-0.6.0 app/controllers/pages_controller.rb
voluntary-0.5.2 app/controllers/pages_controller.rb
voluntary-0.5.1 app/controllers/pages_controller.rb
voluntary-0.5.0 app/controllers/pages_controller.rb
voluntary-0.4.0 app/controllers/pages_controller.rb
voluntary-0.3.0 app/controllers/pages_controller.rb
voluntary-0.2.4 app/controllers/pages_controller.rb
voluntary-0.2.3 app/controllers/pages_controller.rb
voluntary-0.2.2 app/controllers/pages_controller.rb
voluntary-0.2.1 app/controllers/pages_controller.rb
voluntary-0.2.0 app/controllers/pages_controller.rb
voluntary-0.1.0 app/controllers/pages_controller.rb
voluntary-0.1.0.rc4 app/controllers/pages_controller.rb
voluntary-0.1.0.rc3 app/controllers/pages_controller.rb
voluntary-0.1.0.rc2 app/controllers/pages_controller.rb
voluntary-0.1.0.rc1 app/controllers/pages_controller.rb
voluntary-0.0.3 app/controllers/pages_controller.rb
voluntary-0.0.2 app/controllers/pages_controller.rb