File tree Expand file tree Collapse file tree 4 files changed +4
-62
lines changed
admin/app/controllers/solidus_admin Expand file tree Collapse file tree 4 files changed +4
-62
lines changed Original file line number Diff line number Diff line change 2
2
3
3
module SolidusAdmin
4
4
class OptionTypesController < SolidusAdmin ::ResourcesController
5
- before_action :load_option_type , only : [ :move ]
6
-
7
- def move
8
- @option_type . insert_at ( params [ :position ] . to_i )
9
-
10
- respond_to do |format |
11
- format . js { head :no_content }
12
- end
13
- end
5
+ include SolidusAdmin ::Moveable
14
6
15
7
private
16
8
@@ -29,10 +21,5 @@ def resources_collection = Spree::OptionType.unscoped
29
21
def resources_sorting_options
30
22
{ position : :asc }
31
23
end
32
-
33
- def load_option_type
34
- @option_type = Spree ::OptionType . find ( params [ :id ] )
35
- authorize! action_name , @option_type
36
- end
37
24
end
38
25
end
Original file line number Diff line number Diff line change 2
2
3
3
module SolidusAdmin
4
4
class OptionValuesController < SolidusAdmin ::ResourcesController
5
- before_action :load_option_value , only : [ :move ]
6
-
7
- def move
8
- @option_value . insert_at ( params [ :position ] . to_i )
9
-
10
- respond_to do |format |
11
- format . js { head :no_content }
12
- end
13
- end
5
+ include SolidusAdmin ::Moveable
14
6
15
7
private
16
8
17
9
def resource_class = Spree ::OptionValue
18
-
19
- def load_option_value
20
- @option_value = Spree ::OptionValue . find ( params [ :id ] )
21
- authorize! action_name , @option_value
22
- end
23
10
end
24
11
end
Original file line number Diff line number Diff line change 3
3
module SolidusAdmin
4
4
class PaymentMethodsController < SolidusAdmin ::BaseController
5
5
include SolidusAdmin ::ControllerHelpers ::Search
6
-
7
- before_action :load_payment_method , only : [ :move ]
6
+ include SolidusAdmin ::Moveable
8
7
9
8
search_scope ( :all )
10
9
search_scope ( :active , default : true , &:active )
@@ -25,14 +24,6 @@ def index
25
24
end
26
25
end
27
26
28
- def move
29
- @payment_method . insert_at ( params [ :position ] . to_i )
30
-
31
- respond_to do |format |
32
- format . js { head :no_content }
33
- end
34
- end
35
-
36
27
def destroy
37
28
@payment_methods = Spree ::PaymentMethod . where ( id : params [ :id ] )
38
29
@@ -41,12 +32,5 @@ def destroy
41
32
flash [ :notice ] = t ( '.success' )
42
33
redirect_back_or_to payment_methods_path , status : :see_other
43
34
end
44
-
45
- private
46
-
47
- def load_payment_method
48
- @payment_method = Spree ::PaymentMethod . find_by! ( id : params [ :id ] )
49
- authorize! action_name , @payment_method
50
- end
51
35
end
52
36
end
Original file line number Diff line number Diff line change 3
3
module SolidusAdmin
4
4
class TaxonomiesController < SolidusAdmin ::BaseController
5
5
include SolidusAdmin ::ControllerHelpers ::Search
6
-
7
- before_action :load_taxonomy , only : [ :move ]
6
+ include SolidusAdmin ::Moveable
8
7
9
8
def index
10
9
taxonomies = apply_search_to (
@@ -19,14 +18,6 @@ def index
19
18
end
20
19
end
21
20
22
- def move
23
- @taxonomy . insert_at ( params [ :position ] . to_i )
24
-
25
- respond_to do |format |
26
- format . js { head :no_content }
27
- end
28
- end
29
-
30
21
def destroy
31
22
@taxonomies = Spree ::Taxonomy . where ( id : params [ :id ] )
32
23
@@ -35,12 +26,5 @@ def destroy
35
26
flash [ :notice ] = t ( '.success' )
36
27
redirect_back_or_to taxonomies_path , status : :see_other
37
28
end
38
-
39
- private
40
-
41
- def load_taxonomy
42
- @taxonomy = Spree ::Taxonomy . find ( params [ :id ] )
43
- authorize! action_name , @taxonomy
44
- end
45
29
end
46
30
end
You can’t perform that action at this time.
0 commit comments