radiant-drag_order-extension 0.4.4 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.4
1
+ 0.4.6
@@ -35,7 +35,7 @@ var DragOrderIndex = Class.create({
35
35
  method: 'put',
36
36
  parameters: {
37
37
  'parent_id': this.getPageID(drag.element.up('.page')),
38
- 'children' : this.buildChildrenString(drag.element)
38
+ 'children' : this.buildChildrenString(drag.element.up('.children').immediateDescendants())
39
39
  }
40
40
  });
41
41
  }.bind(this)
@@ -92,15 +92,16 @@ var DragOrderIndex = Class.create({
92
92
  });
93
93
  },
94
94
 
95
- buildChildrenString: function(page) {
95
+ buildChildrenString: function(pages) {
96
96
  var drag_order = this;
97
97
 
98
- var children = drag_order.getPageID(page);
99
-
100
- page.siblings('.page').each(function(page) {
101
- children += ',' + drag_order.getPageID(page);
98
+ var children = '';
99
+ pages.each(function(page) {
100
+ children += drag_order.getPageID(page) + ',';
102
101
  })
103
- return children
102
+ children = children.slice(0,-1);
103
+
104
+ return children;
104
105
  },
105
106
 
106
107
  getPageID: function(page) {
@@ -35,7 +35,10 @@
35
35
  cursor: move
36
36
  left: 9px
37
37
  width: 24px
38
-
38
+ opacity: 0.25
39
+
40
+ &:hover
41
+ opacity: 1
39
42
  img
40
43
  cursor: move
41
44
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-drag_order-extension}
8
- s.version = "0.4.4"
8
+ s.version = "0.4.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dirk Kelly"]
12
- s.date = %q{2010-11-27}
12
+ s.date = %q{2010-11-28}
13
13
  s.description = %q{Radiant DragOrder allows you to reorder pages funly}
14
14
  s.email = %q{dk@dirkkelly.com}
15
15
  s.extra_rdoc_files = [
@@ -41,6 +41,15 @@ describe Admin::PagesController do
41
41
  response.should be_success
42
42
  response.body.should === 'Pages successfully sorted.'
43
43
  end
44
+
45
+ it 'should reorder pages' do
46
+ put :sort, :parent_id => @params[:parent_id], :children => @params[:children], :format => 'js'
47
+
48
+ pages(:one).position.should === 1 # Don't change parent
49
+ pages(:four).position.should === 0 # Start at zero
50
+ pages(:three).position.should === 1
51
+ pages(:two).position.should === 2 # End at 2
52
+ end
44
53
  end
45
54
 
46
55
  end
@@ -11,21 +11,21 @@ class SortPagesDataset < Dataset::Base
11
11
  :title => 'Two',
12
12
  :slug => 'two',
13
13
  :breadcrumb => 'two',
14
- :position => 2,
14
+ :position => 1,
15
15
  :parent => pages(:one)
16
16
 
17
17
  create_record :page, :three,
18
18
  :title => 'Three',
19
19
  :slug => 'three',
20
20
  :breadcrumb => 'three',
21
- :position => 3,
21
+ :position => 2,
22
22
  :parent => pages(:one)
23
23
 
24
24
  create_record :page, :four,
25
25
  :title => 'Four',
26
26
  :slug => 'four',
27
27
  :breadcrumb => 'four',
28
- :position => 4,
28
+ :position => 3,
29
29
  :parent => pages(:one)
30
30
  end
31
31
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-drag_order-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 6
10
+ version: 0.4.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dirk Kelly
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-27 00:00:00 +08:00
18
+ date: 2010-11-28 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency