sort_order 0.1.1 → 0.1.2
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/features/sort_order.feature
CHANGED
@@ -10,6 +10,9 @@ Scenario: Sort Order
|
|
10
10
|
When I output the columns as sql (current only)
|
11
11
|
Then I should get the following string: users.first_name ASC
|
12
12
|
|
13
|
+
When I output the columns as sql (current only without table)
|
14
|
+
Then I should get the following string: first_name ASC
|
15
|
+
|
13
16
|
When I output each as a parameter
|
14
17
|
Then I should get the following list: first_name 1, last_name 1, email 0
|
15
18
|
|
@@ -12,7 +12,9 @@ When /^I output (.+) as (.+)$/ do |item, format|
|
|
12
12
|
when ['the columns', 'sql']
|
13
13
|
@sort_order.to_sql
|
14
14
|
when ['the columns', 'sql (current only)']
|
15
|
-
@sort_order.to_sql(:current => true)
|
15
|
+
@sort_order.to_sql(:current => true)
|
16
|
+
when ['the columns', 'sql (current only without table)']
|
17
|
+
@sort_order.to_sql(:current => true, :table => false)
|
16
18
|
when ['the columns', 'parameters']
|
17
19
|
@sort_order.to_params
|
18
20
|
when ['the columns', 'parameters (current only)']
|
data/lib/sort_order.rb
CHANGED
data/lib/sort_order/column.rb
CHANGED
data/lib/sort_order/columns.rb
CHANGED
@@ -18,8 +18,8 @@ module SortOrder
|
|
18
18
|
@current ||= first
|
19
19
|
end
|
20
20
|
|
21
|
-
def current=(token)
|
22
|
-
@current = merge(token)
|
21
|
+
def current=(token=nil)
|
22
|
+
@current = merge(token) if token.present?
|
23
23
|
end
|
24
24
|
|
25
25
|
def current?(other)
|
@@ -44,9 +44,6 @@ module SortOrder
|
|
44
44
|
if old_col = find(new_col.name)
|
45
45
|
old_col.direction = new_col.direction
|
46
46
|
return old_col
|
47
|
-
else
|
48
|
-
self << new_col
|
49
|
-
return new_col
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
@@ -6,7 +6,7 @@ module SortOrder
|
|
6
6
|
column = sort_order.find(name.to_s)
|
7
7
|
column = sort_order.current if sort_order.current?(column)
|
8
8
|
label ||= column.label
|
9
|
-
link_to label, {:order => column.to_param(:flip => true)}
|
9
|
+
link_to label, {:order => column.to_param(:flip => true)}, :rel => column.to_param(:flip => true), :class => "flip-column flip-column-#{column.direction.to_param(true)}"
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
data/sort_order.gemspec
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
+
## all of the comments. Some sections require modification, and others can
|
3
|
+
## be deleted if you don't need them. Once you understand the contents of
|
4
|
+
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
+
## You can find comprehensive Gem::Specification documentation, at
|
6
|
+
## http://docs.rubygems.org/read/chapter/20
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
+
s.rubygems_version = '1.3.5'
|
11
|
+
|
12
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
+
## the sub! line in the Rakefile
|
15
|
+
s.name = 'sort_order'
|
16
|
+
s.version = '0.1.2'
|
17
|
+
s.date = '2010-05-24'
|
18
|
+
s.rubyforge_project = 'sort_order'
|
19
|
+
|
20
|
+
## Make sure your summary is short. The description may be as long
|
21
|
+
## as you like.
|
22
|
+
s.summary = "Manipulate column sort orders."
|
23
|
+
s.description = "Manipulate column sort orders..."
|
24
|
+
|
25
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
26
|
+
## better to set the email to an email list or something. If you don't have
|
27
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
28
|
+
s.authors = ["Alex Neill"]
|
29
|
+
s.email = 'alex@rawnet.com'
|
30
|
+
# s.homepage = 'http://rawnet.github.com/sort_order'
|
31
|
+
|
32
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
33
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
34
|
+
s.require_paths = %w[lib]
|
35
|
+
|
36
|
+
## This sections is only necessary if you have C extensions.
|
37
|
+
# s.require_paths << 'ext'
|
38
|
+
# s.extensions = %w[ext/extconf.rb]
|
39
|
+
|
40
|
+
## If your gem includes any executables, list them here.
|
41
|
+
# s.executables = ["name"]
|
42
|
+
# s.default_executable = 'name'
|
43
|
+
|
44
|
+
## Specify any RDoc options here. You'll want to add your README and
|
45
|
+
## LICENSE files to the extra_rdoc_files list.
|
46
|
+
# s.rdoc_options = ["--charset=UTF-8"]
|
47
|
+
# s.extra_rdoc_files = %w[README LICENSE]
|
48
|
+
|
49
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
50
|
+
## that are needed for an end user to actually USE your code.
|
51
|
+
# s.add_dependency('DEPNAME', [">= 1.1.0", "< 2.0.0"])
|
52
|
+
|
53
|
+
## List your development dependencies here. Development dependencies are
|
54
|
+
## those that are only needed during development
|
55
|
+
# s.add_development_dependency('DEVDEPNAME', [">= 1.1.0", "< 2.0.0"])
|
56
|
+
|
57
|
+
## Leave this section as-is. It will be automatically generated from the
|
58
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
59
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
60
|
+
# = MANIFEST =
|
61
|
+
s.files = %w[
|
62
|
+
features/sort_order.feature
|
63
|
+
features/step_definitions/sort_order_steps.rb
|
64
|
+
features/support/env.rb
|
65
|
+
init.rb
|
66
|
+
lib/sort_order.rb
|
67
|
+
lib/sort_order/column.rb
|
68
|
+
lib/sort_order/column/direction.rb
|
69
|
+
lib/sort_order/column/field.rb
|
70
|
+
lib/sort_order/columns.rb
|
71
|
+
lib/sort_order/controller_helper.rb
|
72
|
+
lib/sort_order/view_helper.rb
|
73
|
+
rails/init.rb
|
74
|
+
sort_order.gemspec
|
75
|
+
]
|
76
|
+
# = MANIFEST =
|
77
|
+
|
78
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
79
|
+
## matches what you actually use.
|
80
|
+
# s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
81
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alex Neill
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-24 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/sort_order/controller_helper.rb
|
40
40
|
- lib/sort_order/view_helper.rb
|
41
41
|
- rails/init.rb
|
42
|
+
- sort_order.gemspec
|
42
43
|
has_rdoc: true
|
43
44
|
homepage:
|
44
45
|
licenses: []
|