active_admin-acts_as_list 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
- require 'active_admin-acts_as_list/active_admin_helper'
2
-
3
- module ActiveAdminActsAsList
4
- end
1
+ require 'active_admin/acts_as_list/engine'
2
+ require 'active_admin/acts_as_list/version'
3
+ require 'active_admin/acts_as_list/active_admin_helper'
@@ -0,0 +1,62 @@
1
+ module 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
17
+ end
18
+
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
+
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
49
+
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
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ module ActiveAdmin
2
+ module ActsAsList
3
+ class Engine < Rails::Engine
4
+ paths["config/locales"] << File.dirname(__FILE__) + '/../../../config/locales'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module ActiveAdmin
2
+ module ActsAsList
3
+ VERSION = "0.0.4"
4
+ end
5
+ end
@@ -1,7 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActiveAdminActsAsListTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, ActiveAdminActsAsList
6
- end
3
+ module ActiveAdmin
4
+ class ActsAsListTest < ActiveSupport::TestCase
5
+ test "truth" do
6
+ assert_kind_of Module, ActiveAdmin::ActsAsList
7
+ end
8
+ end
7
9
  end
@@ -1 +1,5 @@
1
1
  Connecting to database specified by database.yml
2
+ Connecting to database specified by database.yml
3
+ Connecting to database specified by database.yml
4
+ Connecting to database specified by database.yml
5
+ Connecting to database specified by database.yml
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.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Roberto Vasquez Angel
@@ -45,8 +45,9 @@ extra_rdoc_files: []
45
45
 
46
46
  files:
47
47
  - config/locales/active_admin-acts_as_list.de.yml
48
- - lib/active_admin-acts_as_list/active_admin_helper.rb
49
- - lib/active_admin-acts_as_list/version.rb
48
+ - lib/active_admin/acts_as_list/active_admin_helper.rb
49
+ - lib/active_admin/acts_as_list/engine.rb
50
+ - lib/active_admin/acts_as_list/version.rb
50
51
  - lib/tasks/active_admin-acts_as_list_tasks.rake
51
52
  - lib/active_admin-acts_as_list.rb
52
53
  - MIT-LICENSE
@@ -1,60 +0,0 @@
1
- module ActsAsList
2
- module ActiveAdminHelper
3
- def sortable_columns
4
- column "&#9650;&#9650;".html_safe do |resource|
5
- link_to("&#9650;&#9650;".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 "&#9650;".html_safe do |resource|
8
- link_to("&#9650;".html_safe, self.send(:"move_up_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.first?
9
- end
10
- column "&#9660;".html_safe do |resource|
11
- link_to("&#9660;".html_safe, self.send(:"move_down_admin_#{resource.class.model_name.underscore.gsub("/", "_")}_path", resource), :class => "arrow") unless resource.last?
12
- end
13
- column "&#9660;&#9660;".html_safe do |resource|
14
- link_to("&#9660;&#9660;".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 )
27
- end
28
-
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
34
-
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
38
-
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 )
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
58
- end
59
- end
60
- end
@@ -1,3 +0,0 @@
1
- module ActiveAdminActsAsList
2
- VERSION = "0.0.3"
3
- end