sort-table 0.1.0
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 +7 -0
- data/lib/sort-table.rb +16 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a75f8c12b1416525248992c9c7f306ee97e2a6f6
|
4
|
+
data.tar.gz: 7cf809e1049b95d4438065c0010074b60ba505cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: abd4ee527dd420da2397478d34d658ff2d9da8a75593c1966aa3588afd9272515880d8b84fe322d19c77cba75d2fbc2dc55e256346111f0c10a80134f12261a0
|
7
|
+
data.tar.gz: ee31469c0b5388abf0dc1dc1d9ba75a47e7903d6a5e519be860c0b44546a1e59a622d1031a283d633ca6672103bedc61b220a2704ba14ebaed88b8e3d690ba3b
|
data/lib/sort-table.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module sort-table
|
2
|
+
def sortable(column, title = nil)
|
3
|
+
title ||= column.titleize
|
4
|
+
css_class = column == sort_column ? "current #{sort_direction}" : nil
|
5
|
+
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc"
|
6
|
+
link_to title, {:sort => column, :direction => direction}, {:class => css_class}
|
7
|
+
end
|
8
|
+
|
9
|
+
def sort_column
|
10
|
+
Product.column_names.include?(params[:sort]) ? params[:sort] : "name"
|
11
|
+
end
|
12
|
+
|
13
|
+
def sort_direction
|
14
|
+
%w[asc desc].include?(params[:direction]) ? params[:direction] : "asc"
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sort-table
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ruby Coder
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: sort-table is the best for sorting.you can easily sort table data.
|
14
|
+
email: sumitkumar_2@zapbuild.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/sort-table.rb
|
20
|
+
homepage:
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.6.8
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: sort-table is the best for sorting
|
43
|
+
test_files: []
|