This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/admin/roles_controller.rb

55 lines
1.1 KiB
Ruby

class Admin::RolesController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
def index
@attributes = Role.all.entries
render :template => 'admin/attributes/index'
end
def show
#@attribute = Role.find(params[:id])
end
def new
@attribute = Role.new
end
def edit
@attribute = Role.find(params[:id])
@i18n_variable = @attribute.i18n_variable
end
def create
@attribute = Role.new(params[:role])
@attribute.save
redirect_to :action => :index
end
def update
@attribute = Role.find(params[:id])
@attribute.update_attributes(params[:role])
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/attributes/toggle_enable' }
end
end
def destroy
@attribute = Role.find(params[:id])
@attribute.destroy
redirect_to :action => :index
end
protected
def set_attribute
@attribute_type = 'role'
end
end