Class: Admin::RightsController
- Inherits:
-
BaseController
- Object
- BaseController
- Admin::RightsController
- Defined in:
- app/controllers/admin/rights_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/admin/rights_controller.rb', line 24 def create @right = Right.new(params[:right]) if @right.save flash[:notice] = I18n.t('right.create.success').capitalize return request.xhr? ? (render :nothing => true) : redirect_to([forgeos_core, :admin, @right]) else flash[:error] = I18n.t('right.create.failed').capitalize if request.xhr? render :nothing => true, :json => { :result => 'error' } return false else render :action => 'new' end end end |
#destroy ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/admin/rights_controller.rb', line 55 def destroy if @right.destroy flash[:notice] = I18n.t('right.destroy.success').capitalize else flash[:error] = I18n.t('right.destroy.failed').capitalize end respond_to do |wants| wants.html do redirect_to([forgeos_core, :admin, :rights]) end wants.js end end |
#edit ⇒ Object
21 22 |
# File 'app/controllers/admin/rights_controller.rb', line 21 def edit end |
#index ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/admin/rights_controller.rb', line 4 def index respond_to do |format| format.html # index.html.erb format.json do sort render :layout => false end end end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/admin/rights_controller.rb', line 17 def new @right = Right.new(params[:right]) end |
#show ⇒ Object
14 15 |
# File 'app/controllers/admin/rights_controller.rb', line 14 def show end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/admin/rights_controller.rb', line 40 def update if @right.update_attributes(params[:right]) flash[:notice] = I18n.t('right.update.success').capitalize return request.xhr? ? (render :nothing => true) : redirect_to([forgeos_core, :admin, @right]) else flash[:error] = I18n.t('right.update.failed').capitalize if request.xhr? render :nothing => true, :json => { :result => 'error' } return false else render :action => 'edit' end end end |