From 75fb68c4d1eb647a268890c080da2dc3875c0e77 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 29 Jan 2013 16:44:47 +0100 Subject: Get rid of @current_user. The use of current_user is better. --- app/controllers/softkeys_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/softkeys_controller.rb') diff --git a/app/controllers/softkeys_controller.rb b/app/controllers/softkeys_controller.rb index d2a2bb9..8f363cd 100644 --- a/app/controllers/softkeys_controller.rb +++ b/app/controllers/softkeys_controller.rb @@ -61,7 +61,7 @@ class SoftkeysController < ApplicationController @softkey_functions = [] SoftkeyFunction.accessible_by(current_ability, :read).each do |softkey_function| - if GuiFunction.display?("softkey_function_#{softkey_function.name.downcase}_field_in_softkey_form", @current_user) + if GuiFunction.display?("softkey_function_#{softkey_function.name.downcase}_field_in_softkey_form", current_user) @softkey_functions << softkey_function end end -- cgit v1.2.3 From 66a53a49705c269d73f9d51bb0d4a51283049c71 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 4 Feb 2013 13:00:45 +0100 Subject: Changed softkey table to be sortable. #150 --- app/controllers/softkeys_controller.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'app/controllers/softkeys_controller.rb') diff --git a/app/controllers/softkeys_controller.rb b/app/controllers/softkeys_controller.rb index 8f363cd..c9e8c20 100644 --- a/app/controllers/softkeys_controller.rb +++ b/app/controllers/softkeys_controller.rb @@ -1,9 +1,9 @@ class SoftkeysController < ApplicationController - load_and_authorize_resource :sip_account - load_and_authorize_resource :softkey, :through => [:sip_account] + load_and_authorize_resource :sip_account, :except => [:sort] + load_and_authorize_resource :softkey, :through => [:sip_account], :except => [:sort] before_filter :set_available_call_forwards_and_softkey_functions, :only => [ :new, :edit, :update ] - before_filter :spread_breadcrumbs + before_filter :spread_breadcrumbs, :except => [:sort] def index end @@ -44,16 +44,17 @@ class SoftkeysController < ApplicationController redirect_to sip_account_softkeys_path(@softkey.sip_account), :notice => t('softkeys.controller.successfuly_destroyed') end - def move_higher - @softkey.move_higher - redirect_to :back - end + def sort + sip_account = Softkey.find(params[:softkey].first).sip_account + + params[:softkey].each do |softkey_id| + sip_account.softkeys.find(softkey_id).move_to_bottom + end - def move_lower - @softkey.move_lower - redirect_to :back + render nothing: true end + private def set_available_call_forwards_and_softkey_functions -- cgit v1.2.3