shuber-sortable 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +7 -0
- data/lib/sortable.rb +1 -1
- data/test/sortable_test.rb +6 -4
- metadata +2 -3
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2009-05-14 - Sean Huber (shuber@huberry.com)
|
2
|
+
* Remove MIT-LICENSE from gemspec - github complaining for some reason
|
3
|
+
|
4
|
+
2009-05-13 - Sean Huber (shuber@huberry.com)
|
5
|
+
* Fix bug - item_at_offset method was not scoping correctly
|
6
|
+
* Rename MIT_LICENSE to MIT-LICENSE
|
7
|
+
|
1
8
|
2009-01-17 - Sean Huber (shuber@huberry.com)
|
2
9
|
* Update code documentation
|
3
10
|
* Make the sortable_scope_changes instance method public
|
data/lib/sortable.rb
CHANGED
@@ -204,7 +204,7 @@ module Huberry
|
|
204
204
|
# Returns nil if an item at the specified offset could not be found
|
205
205
|
def item_at_offset(offset, list_name = nil)
|
206
206
|
options = evaluate_sortable_options(list_name)
|
207
|
-
in_list?(list_name) ? self.class.send("find_by_#{options[:column]}".to_sym, send(options[:column]) + offset) : nil
|
207
|
+
in_list?(list_name) ? self.class.send("find_by_#{options[:column]}".to_sym, send(options[:column]) + offset, :conditions => options[:conditions]) : nil
|
208
208
|
end
|
209
209
|
|
210
210
|
# Returns the last item in a list associated with the current item
|
data/test/sortable_test.rb
CHANGED
@@ -105,14 +105,16 @@ class SortableTest < Test::Unit::TestCase
|
|
105
105
|
|
106
106
|
def test_item_at_offset_should_return_previous_item
|
107
107
|
@todo = Todo.create
|
108
|
-
@todo_2 = Todo.create
|
109
|
-
|
108
|
+
@todo_2 = Todo.create :project_id => 1
|
109
|
+
@todo_3 = Todo.create
|
110
|
+
assert_equal @todo, @todo_3.item_at_offset(-1, :client)
|
110
111
|
end
|
111
112
|
|
112
113
|
def test_item_at_offset_should_return_next_item
|
113
114
|
@todo = Todo.create
|
114
|
-
@todo_2 = Todo.create
|
115
|
-
|
115
|
+
@todo_2 = Todo.create :project_id => 1
|
116
|
+
@todo_3 = Todo.create
|
117
|
+
assert_equal @todo_3, @todo.item_at_offset(1, :client)
|
116
118
|
end
|
117
119
|
|
118
120
|
def test_item_at_offset_should_return_nil_for_non_existent_offset
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shuber-sortable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Huber
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -25,7 +25,6 @@ files:
|
|
25
25
|
- CHANGELOG
|
26
26
|
- init.rb
|
27
27
|
- lib/sortable.rb
|
28
|
-
- MIT-LICENSE
|
29
28
|
- Rakefile
|
30
29
|
- README.rdoc
|
31
30
|
has_rdoc: false
|