orbit-basic/app/controllers/admin/infos_controller.rb

50 lines
948 B
Ruby

class Admin::InfosController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
def index
@attributes = Info.all.entries
render :template => 'admin/attributes/index'
end
def show
#@attribute = Info.find(params[:id])
end
def new
@attribute = Info.new
end
def edit
@attribute = Info.find(params[:id])
@i18n_variable = @attribute.i18n_variable
end
def create
@attribute = Info.new(params[:info])
@attribute.save
redirect_to :action => :index
end
def update
@attribute = Info.find(params[:id])
@attribute.update_attributes(params[:info])
end
def destroy
@attribute = Info.find(params[:id])
@attribute.destroy
redirect_to :action => :index
end
protected
def set_attribute
@attribute_type = 'info'
end
end