will_sortate 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/will_sortate/models/active_record_model_extension.rb +1 -1
- data/lib/will_sortate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2975faabedcffeb39f22571f893133f4267d5aba
|
|
4
|
+
data.tar.gz: 7d8a9b6c01f8ad8e2bde9eaf3a96c70d9bb229a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfd24feedcd392c67b74da8ca17299aebae8dace011102aa63c54a2b2199eb781ae0dc9808671c42f9b219a9e88d8274a35211a96cd498b6c40f6c002e50860e
|
|
7
|
+
data.tar.gz: d1d2e720fdc7320fb5e31c6b494ad3e75c34b03b12764547482b0cff5aa1d5b50dc5381eaa51d837fd2b3979739bdb70379843d0e6a88ec7a0205b2e665b1b50
|
data/README.md
CHANGED
|
@@ -31,7 +31,10 @@ The sort argument indicates the column and order direction, so `my_field_asc` wi
|
|
|
31
31
|
### In your views
|
|
32
32
|
|
|
33
33
|
```erb
|
|
34
|
-
<%= sortate_link_to @shorties, :
|
|
34
|
+
<%= sortate_link_to 'One Field', @shorties, :one_field, options %>
|
|
35
|
+
<%= sortate_link_to @shorties, :my_field, options do %>
|
|
36
|
+
My Field
|
|
37
|
+
<% end %>
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
The options argument is optional and will be passed to the underlying link_to. In addition you can pass in the options hash:
|
|
@@ -41,7 +44,7 @@ The options argument is optional and will be passed to the underlying link_to. I
|
|
|
41
44
|
E.g.:
|
|
42
45
|
|
|
43
46
|
```erb
|
|
44
|
-
<%= sortate_link_to @shorties, :my_field, class: 'sort_link', default_sort_order: 'desc' %>
|
|
47
|
+
<%= sortate_link_to 'My Field', @shorties, :my_field, class: 'sort_link', default_sort_order: 'desc' %>
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
## TODO
|
|
@@ -3,7 +3,7 @@ module WillSortate
|
|
|
3
3
|
attr_reader :sortated_field, :sortated_order
|
|
4
4
|
|
|
5
5
|
def sortate order_by, default_order_by
|
|
6
|
-
regexp = /(\w+)_(asc|desc)$/
|
|
6
|
+
regexp = /([\w\.-]+)_(asc|desc)$/
|
|
7
7
|
md = order_by.try(:match, regexp) || default_order_by.match(regexp)
|
|
8
8
|
raise "OrderBy argument has to be specified in the format :field_:direction" unless md
|
|
9
9
|
|
data/lib/will_sortate/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: will_sortate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicola Racco
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-06-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|