diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-12 13:53:28 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-02-12 13:53:28 +0100 |
commit | c9066760fd1f5f2f892ce2be5cf2a83bb5210246 (patch) | |
tree | 82ecdd528e803ccd1b469dc13482e06cf8ea0b8e /app/controllers/softkeys_controller.rb | |
parent | 0b97717b2171820dea41de8df705f8f0e4b71464 (diff) | |
parent | fb66a5e5a4c5d5f9eac4a5e8de6a286482cb55d5 (diff) |
Release a new beta.5.1-beta4
Diffstat (limited to 'app/controllers/softkeys_controller.rb')
-rw-r--r-- | app/controllers/softkeys_controller.rb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/app/controllers/softkeys_controller.rb b/app/controllers/softkeys_controller.rb index d2a2bb9..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 @@ -61,7 +62,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 |