sortabl 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7baca944a6f0e4b3e4c0e29515c4815b2ec536b5
4
- data.tar.gz: 31383da19f0286990e1221152403a7de85d78c02
3
+ metadata.gz: d1490175b83dc4c1ecf163ed9d46d0d07a9f4f08
4
+ data.tar.gz: 5320c74587adf23634d65b16b89cb600e6d03f82
5
5
  SHA512:
6
- metadata.gz: 7933a2a368fd102bed12e92897e3ccc3c695843e6f298a4af341915a1172d3fbf8509057824fb06e937b671727630a1876e6100720b46087d717e8f7500ee56c
7
- data.tar.gz: 7e59e61941464ab223a82df9ffa7efa128bb0d4347f74f890a7701349a952444390b2111e6b5c5fdc27255501118436f43bb2833eb18fb489a2b0a7a743558b0
6
+ metadata.gz: 01c673da47ab2844dd0ad60fb7feaae55f6e50d8cdb1c3c0d4c84e920311b8dc6346a17c59e92453b44d43e3bfa8ba9c27c5aafe2b509b9109e0bdbb89d93835
7
+ data.tar.gz: b0ce7e421845e877429781953677cfb8890aa68d02ff174c32051b5392c9d4389130012edb0810f5ef8e712020f77c0e12553363d8d1ffc4e11dbececf62d170
data/README.md CHANGED
@@ -18,13 +18,13 @@ gem 'sortabl'
18
18
  @posts = Post.sortabl(sort_by: params[:sort])
19
19
  ```
20
20
 
21
- And that's it! Records will be sorted by permitted parameter `:sort`. If parameter `:sort` isn't permitted, records will be sorted by primary key. The `default` key can be also set as argument. Like:
21
+ And that's it! Records will be sorted by permitted parameter `:sort`. If parameter `:sort` isn't permitted, records will be sorted by primary key. If you don't want to sort by primary key by default, you can set another one by:
22
22
 
23
23
  ```ruby
24
- @posts = Post.sortable(sort_by: params[:sort], default: :author)
24
+ @posts = Post.sortabl(sort_by: params[:sort], default: :author)
25
25
  ```
26
26
 
27
- Permitted values can be every attribute of model class followed by `_asc` or `_desc`. For example: `sort: :author_asc`
27
+ Permitted values can be an attribute of model class, followed by `_asc` or `_desc`. For example: `sort: :author_asc`
28
28
  If there's an attribute permitted which doesn't exist in model, it falls back to sort by `default` key. Attributes can be limited with `only` and `except`. For example:
29
29
 
30
30
  ```ruby
@@ -41,7 +41,7 @@ There's also a view helper for rendering table heads:
41
41
  ```erb
42
42
  <table>
43
43
  <thead>
44
- <%= render_th 'Author', :author, id: 'author-column', class: 'author-column' %>
44
+ <%= sortabl_th 'Author', :author, id: 'author-column', class: 'author-column' %>
45
45
  </thead>
46
46
  <tbody>
47
47
  ...
@@ -6,7 +6,7 @@ module Sortabl
6
6
  # Uses fontawesome as default icons
7
7
  # <th 'data-sortable': 'attribute_direction'>Name <i class='fa fa-...'></th>
8
8
  #
9
- def render_th name, attribute, *args
9
+ def sortabl_th name, attribute, *args
10
10
 
11
11
  # To provide full path with all given params
12
12
  # make a copy of incoming params and override sort_param only
@@ -1,3 +1,3 @@
1
1
  module Sortabl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sortabl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frederic Walch