Orbit/app/controllers/admin/user_role_models_controller.rb

60 lines
1.5 KiB
Ruby
Raw Normal View History

2011-02-01 07:12:23 +00:00
class Admin::UserRoleModelsController < ApplicationController
layout "admin"
2011-02-01 07:12:23 +00:00
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
def index
@user_attribute_models = UserRoleModel.all.entries
render :template => 'admin/user_attribute_models/index'
end
def show
#@user_attribute_model = UserRoleModel.find(params[:id])
end
def new
@user_attribute_model = UserRoleModel.new
render :template => 'admin/user_attribute_models/new'
end
def edit
@user_attribute_model = UserRoleModel.find(params[:id])
@i18n_variable = @user_attribute_model.i18n_variable
render :template => 'admin/user_attribute_models/edit'
end
def create
@user_attribute_model = UserRoleModel.new(params[:user_role_model])
@user_attribute_model.save
redirect_to :action => :index
end
def update
@user_attribute_model = UserRoleModel.find(params[:id])
@user_attribute_model.update_attributes(params[:user_role_model])
2011-05-02 04:07:31 +00:00
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/user_attribute_models/toggle_enable' }
end
2011-02-01 07:12:23 +00:00
end
def destroy
@user_attribute_model = UserRoleModel.find(params[:id])
@user_attribute_model.destroy
@user_attribute_model.destroy_i18n_variables
redirect_to :action => :index
end
protected
def set_attribute
@attribute = 'role'
end
end