summaryrefslogtreecommitdiff
path: root/app/controllers/softkeys_controller.rb
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-04 13:11:10 +0100
committerspag <spag@golwen.net>2013-02-04 13:11:10 +0100
commit48e32b241d422a676b3e977dd1af3688f7ebe63d (patch)
treeeb658714cdfd4f46fb805e770c3a0bc975014ee6 /app/controllers/softkeys_controller.rb
parent242470bdb4fa67780e7467c6889b7869dff05d1c (diff)
parent049b3e62c2ad3e0affac17214baa38afb994b6ba (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app/controllers/softkeys_controller.rb')
-rw-r--r--app/controllers/softkeys_controller.rb21
1 files changed, 11 insertions, 10 deletions
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