the_grid 1.1.6 → 1.1.7
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.
- checksums.yaml +8 -8
- data/lib/the_grid/api/command/sort.rb +1 -1
- data/lib/the_grid/version.rb +1 -1
- data/spec/api/command/sort_spec.rb +4 -5
- data/the_grid.gemspec +1 -6
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTM1NmQ4NWY0NzU5NmEyMjg0Y2NiYjAxMGFkNjY3ZmY1OTZhNzJmZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTZkOWU3Y2NlOWY1NTlhM2M1OTBhMTc4M2Y5NTdiOWQzZWJjNzM0MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjE4MGZmZmZiMjRmZTU3ZjJiN2I3ZjE0OGE0MDhiNGU2ZGZkZWIwNWM0MDNk
|
10
|
+
MThhODdlNDI0YTI2YzRlMzM0OTA1YmIyZThiMzdiODE2ZjE4ZDJmNWQ5MGMw
|
11
|
+
MjA0NTgwYjM0MTc1NzY5MGM3ZmJjNWRiNDRiYTNjNDY5ZGVlYTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTk5MDMwY2UwYWRjOGM5ZDFiNjgyNmI0MjUxZjc5OTZkMDBlMDYyODhlMmZh
|
14
|
+
YmFjNWQ2MTUwMzBkMmI1MDg2Njg2YTZhYmI1ZTYzMzFhY2EwNTRjY2VmZTI4
|
15
|
+
N2RjZDdhOWJhMDFmN2M4YzE2YmFkNmM2ZjIwOWM2ZjEwNmM2ODA=
|
@@ -3,7 +3,7 @@ module TheGrid
|
|
3
3
|
def configure(relation, params)
|
4
4
|
{}.tap do |o|
|
5
5
|
o[:field] = params[:field]
|
6
|
-
o[:field] = "#{relation.table_name}.#{o[:field]}" if relation.
|
6
|
+
o[:field] = "#{relation.table_name}.#{o[:field]}" if relation.column_names.include?(params[:field])
|
7
7
|
|
8
8
|
o[:order] = params[:order]
|
9
9
|
o[:order] = 'asc' unless %w{ asc desc }.include?(o[:order])
|
data/lib/the_grid/version.rb
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe TheGrid::Api::Command::Sort do
|
4
|
-
let(:
|
5
|
-
let(:relation) { double(:table_name => table.name, :table => table) }
|
4
|
+
let(:relation) { double(:table_name => "table_for_sort", :column_names => %w{id name}) }
|
6
5
|
let(:options) { {:field => "name", :order => "desc" } }
|
7
6
|
|
8
7
|
after(:each){ subject.execute_on(relation, options) }
|
9
8
|
|
10
9
|
it "sort by asc if order invalid" do
|
11
10
|
options[:order] = 'wrong order'
|
12
|
-
relation.should_receive(:order).with("#{
|
11
|
+
relation.should_receive(:order).with("#{relation.table_name}.#{options[:field]} asc")
|
13
12
|
end
|
14
13
|
|
15
14
|
it "sort by specified order" do
|
16
|
-
relation.should_receive(:order).with("#{
|
15
|
+
relation.should_receive(:order).with("#{relation.table_name}.#{options[:field]} #{options[:order]}")
|
17
16
|
end
|
18
17
|
|
19
18
|
it "does not prepend field with table name if field is an alias" do
|
20
|
-
|
19
|
+
options[:field] = 'title'
|
21
20
|
relation.should_receive(:order).with("#{options[:field]} #{options[:order]}")
|
22
21
|
end
|
23
22
|
end
|
data/the_grid.gemspec
CHANGED
@@ -19,11 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
Tags: json, csv, grid, api, grid builder, activerecord relation builder, relation
|
20
20
|
EOF
|
21
21
|
|
22
|
-
s.post_install_message = <<-_MSG_
|
23
|
-
Columns' definition in json response is changed
|
24
|
-
because javascript does not remember the order of properties in object.
|
25
|
-
_MSG_
|
26
|
-
|
27
22
|
s.files = `git ls-files`.split("\n")
|
28
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
24
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -31,7 +26,7 @@ Gem::Specification.new do |s|
|
|
31
26
|
|
32
27
|
s.add_dependency 'activerecord', '>= 3.0'
|
33
28
|
s.add_dependency 'json'
|
34
|
-
|
29
|
+
|
35
30
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
36
31
|
s.add_development_dependency "rspec", "~> 2.13"
|
37
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_grid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergiy Stotskiy
|
@@ -118,8 +118,7 @@ homepage: http://github.com/stalniy/grid
|
|
118
118
|
licenses:
|
119
119
|
- MIT
|
120
120
|
metadata: {}
|
121
|
-
post_install_message:
|
122
|
-
javascript does not remember the order of properties in object.\n"
|
121
|
+
post_install_message:
|
123
122
|
rdoc_options: []
|
124
123
|
require_paths:
|
125
124
|
- lib
|