active_admin-acts_as_list 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,49 @@
1
1
  = ActiveAdminActsAsList
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ This project rocks and uses MIT-LICENSE.
4
+
5
+ = Prerequisites
6
+
7
+ You need active_admin and acts_as_list.
8
+
9
+
10
+ = Getting started
11
+
12
+ Add ActiveAdminActsAsList to your gemfile.
13
+
14
+ gem 'active_admin-acts-as-list', '~> 0.0.5'
15
+
16
+
17
+ = Usage
18
+
19
+ Assuming you have a Players model:
20
+
21
+ class Player < ActiveRecord::Base
22
+ # acts as list
23
+ acts_as_list
24
+ default_scope :order => 'position ASC'
25
+
26
+ #...
27
+ end
28
+
29
+
30
+ You can add sortable columns, member actions and sorting like this:
31
+
32
+ #app/admin/players.rb
33
+ ActiveAdmin.register Player do
34
+ # Sort players by position
35
+ config.sort_order = 'position'
36
+
37
+ # Add member actions for positioning.
38
+ sortable_member_actions
39
+
40
+ index do
41
+ # This adds columns for moving up, down, top and bottom.
42
+ sortable_columns
43
+
44
+ #...
45
+ column :firstname
46
+ column :lastname
47
+ default_actions
48
+ end
49
+ end
@@ -1,3 +1,6 @@
1
1
  require 'active_admin/acts_as_list/engine'
2
2
  require 'active_admin/acts_as_list/version'
3
- require 'active_admin/acts_as_list/active_admin_helper'
3
+ require 'active_admin/acts_as_list/helper'
4
+
5
+ module ActiveAdminActsAsList
6
+ end
@@ -1,6 +1,6 @@
1
1
  module ActiveAdmin
2
2
  module ActsAsList
3
- module ActiveAdminHelper
3
+ module Helper
4
4
  def sortable_columns
5
5
  column "&#9650;&#9650;".html_safe do |resource|
6
6
  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?
@@ -1,5 +1,5 @@
1
1
  module ActiveAdmin
2
2
  module ActsAsList
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -3,3 +3,5 @@ Connecting to database specified by database.yml
3
3
  Connecting to database specified by database.yml
4
4
  Connecting to database specified by database.yml
5
5
  Connecting to database specified by database.yml
6
+ Connecting to database specified by database.yml
7
+ 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.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Roberto Vasquez Angel
@@ -45,7 +45,7 @@ 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
48
+ - lib/active_admin/acts_as_list/helper.rb
49
49
  - lib/active_admin/acts_as_list/engine.rb
50
50
  - lib/active_admin/acts_as_list/version.rb
51
51
  - lib/tasks/active_admin-acts_as_list_tasks.rake