active_admin-acts_as_list 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,62 +1,60 @@
1
- if defined?(ActiveAdmin)
2
- module ActsAsList
3
- module ActiveAdminHelper
4
- def sortable_columns
5
- column "▲▲".html_safe do |resource|
6
- link_to("▲▲".html_safe, self.send(:"move_to_top_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.first?
7
- end
8
- column "▲".html_safe do |resource|
9
- link_to("▲".html_safe, self.send(:"move_up_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.first?
10
- end
11
- column "▼".html_safe do |resource|
12
- link_to("▼".html_safe, self.send(:"move_down_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.last?
13
- end
14
- column "▼▼".html_safe do |resource|
15
- link_to("▼▼".html_safe, self.send(:"move_to_bottom_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.last?
16
- end
1
+ module ActsAsList
2
+ module ActiveAdminHelper
3
+ def sortable_columns
4
+ column "▲▲".html_safe do |resource|
5
+ link_to("▲▲".html_safe, self.send(:"move_to_top_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.first?
6
+ end
7
+ column "▲".html_safe do |resource|
8
+ link_to("▲".html_safe, self.send(:"move_up_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.first?
9
+ end
10
+ column "▼".html_safe do |resource|
11
+ link_to("▼".html_safe, self.send(:"move_down_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.last?
12
+ end
13
+ column "▼▼".html_safe do |resource|
14
+ link_to("▼▼".html_safe, self.send(:"move_to_bottom_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.last?
15
+ end
16
+ end
17
+
18
+ def sortable_member_actions
19
+ member_action :move_to_top do
20
+ if resource.first?
21
+ redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_to_top', :resource => resource_class.to_s.camelize.constantize.model_name.human )
22
+ return
23
+ end
24
+
25
+ resource.move_to_top
26
+ redirect_to :back, :notice => I18n.t('acts_as_list.moved_to_top', :resource => resource_class.to_s.camelize.constantize.model_name.human )
17
27
  end
18
28
 
19
- def sortable_member_actions
20
- member_action :move_to_top do
21
- if resource.first?
22
- redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_to_top', :resource => resource_class.to_s.camelize.constantize.model_name.human )
23
- return
24
- end
25
-
26
- resource.move_to_top
27
- redirect_to :back, :notice => I18n.t('acts_as_list.moved_to_top', :resource => resource_class.to_s.camelize.constantize.model_name.human )
28
- end
29
+ member_action :move_to_bottom do
30
+ if resource.last?
31
+ redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_to_bottom', :resource => resource_class.to_s.camelize.constantize.model_name.human )
32
+ return
33
+ end
29
34
 
30
- member_action :move_to_bottom do
31
- if resource.last?
32
- redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_to_bottom', :resource => resource_class.to_s.camelize.constantize.model_name.human )
33
- return
34
- end
35
-
36
- resource.move_to_bottom
37
- redirect_to :back, :notice => I18n.t('acts_as_list.moved_to_bottom', :resource => resource_class.to_s.camelize.constantize.model_name.human )
38
- end
39
-
40
- member_action :move_up do
41
- if resource.first?
42
- redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
43
- return
44
- end
45
-
46
- resource.move_higher
47
- redirect_to :back, :notice => I18n.t('acts_as_list.moved_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
48
- end
35
+ resource.move_to_bottom
36
+ redirect_to :back, :notice => I18n.t('acts_as_list.moved_to_bottom', :resource => resource_class.to_s.camelize.constantize.model_name.human )
37
+ end
49
38
 
50
- member_action :move_down do
51
- if resource.last?
52
- redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
53
- return
54
- end
55
-
56
- resource.move_lower
57
- redirect_to :back, :notice => I18n.t('acts_as_list.moved_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
58
- end
39
+ member_action :move_up do
40
+ if resource.first?
41
+ redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
42
+ return
43
+ end
44
+
45
+ resource.move_higher
46
+ redirect_to :back, :notice => I18n.t('acts_as_list.moved_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )
59
47
  end
48
+
49
+ member_action :move_down do
50
+ if resource.last?
51
+ redirect_to :back, :notice => I18n.t('acts_as_list.illegal_move_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
52
+ return
53
+ end
54
+
55
+ resource.move_lower
56
+ redirect_to :back, :notice => I18n.t('acts_as_list.moved_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )
57
+ end
60
58
  end
61
- end
62
- end
59
+ end
60
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveAdminActsAsList
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: active_admin-acts_as_list
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Roberto Vasquez Angel