table_sortable 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +6 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/table_sortable.iml +190 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +137 -0
- data/Rakefile +10 -0
- data/app/helpers/table_sortable_helper.rb +15 -0
- data/app/views/table_sortable/_columns.slim +3 -0
- data/app/views/table_sortable/_field.slim +1 -0
- data/app/views/table_sortable/_header.slim +2 -0
- data/app/views/table_sortable/_headers.slim +3 -0
- data/app/views/table_sortable/_pager.slim +42 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/table_sortable/column/filter.rb +19 -0
- data/lib/table_sortable/column/sorter.rb +20 -0
- data/lib/table_sortable/column.rb +30 -0
- data/lib/table_sortable/columns.rb +26 -0
- data/lib/table_sortable/concerns/proc.rb +49 -0
- data/lib/table_sortable/controller.rb +93 -0
- data/lib/table_sortable/version.rb +3 -0
- data/lib/table_sortable.rb +25 -0
- data/spec/concerns/proc_class_spec.rb +13 -0
- data/spec/controllers/test_controller_spec.rb +17 -0
- data/spec/lib/table_sortable/column/filter_spec.rb +3 -0
- data/spec/lib/table_sortable/column/sorter_spec.rb +3 -0
- data/spec/lib/table_sortable/concerns/proc_spec.rb +82 -0
- data/spec/lib/table_sortable/controller_spec.rb +51 -0
- data/spec/spec_helper.rb +109 -0
- data/spec/support/controller_macros.rb +7 -0
- data/spec/support/matchers/have_filters.rb +6 -0
- data/spec/support/shared_stuff.rb +22 -0
- data/table_sortable.gemspec +37 -0
- metadata +173 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cb60529c650bb2d1133bff4c21717398bdb06611
|
4
|
+
data.tar.gz: e581193a02859623f97d413cd02c5f14dfcaa4ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c74a522c736940dd0422fe599118a875987b5b24d0adf4dc60358e49bf0a569f9bc9c2a10d28499e6c747277f19eb7e63867828c24f79d0d9f5e99d15e7dd6d
|
7
|
+
data.tar.gz: 4a11c00ee087b9a54ad60e045993a9d61c2c8ce83f94d88650e07e8ba9044c2227628ac4ccc8d0eb96569f5def285b5f8345d09b0913d69da68057dcb3bbaaf1
|
data/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build table_sortable-0.1.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install table_sortable-0.1.1.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install table_sortable-0.1.1.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.1 and build and push table_sortable-0.1.1.gem to Rubygems" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run tests" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/table_sortable.iml" filepath="$PROJECT_DIR$/.idea/table_sortable.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
@@ -0,0 +1,190 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<configuration default="false" name="All specs in spec: table_sortable" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
5
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
6
|
+
<module name="table_sortable" />
|
7
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
8
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
9
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
10
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
11
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
12
|
+
<envs>
|
13
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
14
|
+
</envs>
|
15
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
16
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
17
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
18
|
+
<COVERAGE_PATTERN ENABLED="true">
|
19
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
20
|
+
</COVERAGE_PATTERN>
|
21
|
+
</EXTENSION>
|
22
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/spec" />
|
23
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
24
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
25
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
26
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
27
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="ALL_IN_FOLDER" />
|
28
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
29
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
30
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
31
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
32
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
33
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
34
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
35
|
+
<method />
|
36
|
+
</configuration>
|
37
|
+
<configuration default="false" name="Run spec 'test_controller_spec': table_sortable" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
38
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
39
|
+
<module name="table_sortable" />
|
40
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
41
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
42
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
43
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
44
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
45
|
+
<envs>
|
46
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
47
|
+
</envs>
|
48
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
49
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
50
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
51
|
+
<COVERAGE_PATTERN ENABLED="true">
|
52
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
53
|
+
</COVERAGE_PATTERN>
|
54
|
+
</EXTENSION>
|
55
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
56
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/controllers/test_controller_spec.rb" />
|
57
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
58
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
59
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
60
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
61
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
62
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
63
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
64
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
65
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
66
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
67
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
68
|
+
<method />
|
69
|
+
</configuration>
|
70
|
+
<configuration default="false" name="Run spec 'proc_spec': table_sortable" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
71
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
72
|
+
<module name="table_sortable" />
|
73
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
74
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
75
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
76
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
77
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
78
|
+
<envs>
|
79
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
80
|
+
</envs>
|
81
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
82
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
83
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
84
|
+
<COVERAGE_PATTERN ENABLED="true">
|
85
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
86
|
+
</COVERAGE_PATTERN>
|
87
|
+
</EXTENSION>
|
88
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
89
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/lib/table_sortable/concerns/proc_spec.rb" />
|
90
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
91
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
92
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
93
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
94
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
95
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
96
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
97
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
98
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
99
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
100
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
101
|
+
<method />
|
102
|
+
</configuration>
|
103
|
+
<configuration default="false" name="Run spec 'filter_spec': table_sortable" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
104
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
105
|
+
<module name="table_sortable" />
|
106
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
107
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
108
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
109
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
110
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
111
|
+
<envs>
|
112
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
113
|
+
</envs>
|
114
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
115
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
116
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
117
|
+
<COVERAGE_PATTERN ENABLED="true">
|
118
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
119
|
+
</COVERAGE_PATTERN>
|
120
|
+
</EXTENSION>
|
121
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
122
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/lib/table_sortable/column/filter_spec.rb" />
|
123
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
124
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
125
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
126
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
127
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
128
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
129
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
130
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
131
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
132
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
133
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
134
|
+
<method />
|
135
|
+
</configuration>
|
136
|
+
</component>
|
137
|
+
<component name="NewModuleRootManager">
|
138
|
+
<content url="file://$MODULE_DIR$">
|
139
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
140
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
141
|
+
</content>
|
142
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.4.1 [tablesortable]" jdkType="RUBY_SDK" />
|
143
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
144
|
+
<orderEntry type="library" scope="PROVIDED" name="actioncable (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
145
|
+
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
146
|
+
<orderEntry type="library" scope="PROVIDED" name="actionpack (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
147
|
+
<orderEntry type="library" scope="PROVIDED" name="actionview (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
148
|
+
<orderEntry type="library" scope="PROVIDED" name="activejob (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
149
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
150
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
151
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
152
|
+
<orderEntry type="library" scope="PROVIDED" name="arel (v8.0.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
153
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
154
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.15.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
155
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.5, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
156
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
157
|
+
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.6.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
158
|
+
<orderEntry type="library" scope="PROVIDED" name="globalid (v0.4.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
159
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.8.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
160
|
+
<orderEntry type="library" scope="PROVIDED" name="kaminari (v0.17.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
161
|
+
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.0.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
162
|
+
<orderEntry type="library" scope="PROVIDED" name="mail (v2.6.5, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
163
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.8.2, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
164
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
165
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2016.0521, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
166
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.1.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
167
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.2, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
168
|
+
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.1.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
169
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.7.2, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
170
|
+
<orderEntry type="library" scope="PROVIDED" name="rack (v2.0.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
171
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
172
|
+
<orderEntry type="library" scope="PROVIDED" name="rails (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
173
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
174
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.0.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
175
|
+
<orderEntry type="library" scope="PROVIDED" name="railties (v5.1.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
176
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
177
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.6.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
178
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.6.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
179
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.6.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
180
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.6.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
181
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.6.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
182
|
+
<orderEntry type="library" scope="PROVIDED" name="sprockets (v3.7.1, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
183
|
+
<orderEntry type="library" scope="PROVIDED" name="sprockets-rails (v3.2.0, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
184
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.4, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
185
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
186
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.3, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
187
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.6.5, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
188
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.2, RVM: ruby-2.4.1 [tablesortable]) [gem]" level="application" />
|
189
|
+
</component>
|
190
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at davidovoded@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Oded Davidov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
# TableSortable
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/odedd/table_sortable.svg?branch=master)](https://travis-ci.org/odedd/table_sortable)
|
4
|
+
|
5
|
+
TableSortable is a Rails complementation of The **tableSorter jQuery plugin**.
|
6
|
+
|
7
|
+
The tableSorter jQuery plugin is an excellent tool for filtering and sorting tables.
|
8
|
+
When dealing with lots of rows, we usually want to split the table into multiple pages. tableSorter has a nifty [widget](https://mottie.github.io/tablesorter/docs/example-pager-ajax.html) for that, which requires using [mottie's fork](https://mottie.github.io/tablesorter/docs/index.html) of tableSorter.
|
9
|
+
|
10
|
+
Usually this is a scenario where we don't want to send our entire set of records to the front end,
|
11
|
+
which consequently means that the front end no longer knows the entire set of records to filter and sort through.
|
12
|
+
This requires our *server* to handle all that stuff, plus the pagination of the results.
|
13
|
+
|
14
|
+
#### That's where TableSortable comes in!
|
15
|
+
|
16
|
+
TableSortable will handle all the backend filtering, sorting and pagination for you.
|
17
|
+
|
18
|
+
NOTICE: This gem is in very early stages of development, and is not yet fully documented. Any input will be more than welcome.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem 'table_sortable'
|
26
|
+
```
|
27
|
+
|
28
|
+
Then run `bundle install` and you're ready to start
|
29
|
+
|
30
|
+
You should also probably be using jquery-tablesorter.
|
31
|
+
For information regarding integration or tableSorter into your Rails project,
|
32
|
+
please see the [jQuery tablesorter plugin for Rails](https://github.com/themilkman/jquery-tablesorter-rails) page.
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
First, we need to setup our controller.
|
37
|
+
Let's say we have our users controller. Let's include TableSortable so that we can use its methods.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
#controllers/users_controller.rb
|
41
|
+
class UsersController < ApplicationController
|
42
|
+
include TableSortable
|
43
|
+
```
|
44
|
+
|
45
|
+
Next, let's define our columns.
|
46
|
+
```ruby
|
47
|
+
#controllers/users_controller.rb
|
48
|
+
class UsersController < ApplicationController
|
49
|
+
include TableSortable
|
50
|
+
|
51
|
+
define_colunns :first_name, :last_name, :email, :created_at
|
52
|
+
```
|
53
|
+
That's the basic setup of columns. For more configuration options, please see [advanced configuration](#advanced-configuration).
|
54
|
+
|
55
|
+
Now we need to make sure our `index` action filters, sorts and paginates the records.
|
56
|
+
We can do that using the `filter_and_sort` method.
|
57
|
+
```ruby
|
58
|
+
#controllers/users_controller.rb
|
59
|
+
def index
|
60
|
+
|
61
|
+
@users = filter_and_sort(User.all)
|
62
|
+
|
63
|
+
respond_to do |format|
|
64
|
+
format.html {}
|
65
|
+
format.json {render layout: false}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
In our view we can use TableSortable's [view helpers](#view-helpers) to render our table.
|
71
|
+
```erb
|
72
|
+
#views/users/index.html.erb
|
73
|
+
<div id="usersPager"><%= table_sortable_pager %></div>
|
74
|
+
<table id="usersTable" data-query="<%= users_path %>">
|
75
|
+
<thead>
|
76
|
+
<tr>
|
77
|
+
<%= table_sortable_headers %>
|
78
|
+
</tr>
|
79
|
+
</thead>
|
80
|
+
</table>
|
81
|
+
```
|
82
|
+
|
83
|
+
Let's say we have a tableSorter table which poll's the database for data. Here's a simple configuration example for that:
|
84
|
+
|
85
|
+
```javascript
|
86
|
+
var table = $('#usersTable');
|
87
|
+
table.tablesorter({
|
88
|
+
widgets: ['filter', 'pager'],
|
89
|
+
widgetOptions: {
|
90
|
+
// show 10 records at a time
|
91
|
+
pager_size: 10,
|
92
|
+
// Poll our users_index_path.
|
93
|
+
// A better practice would be to use the table's
|
94
|
+
// data-query attribute instead, but more on that later)
|
95
|
+
pager_ajaxUrl: table.data('query') + '?pagesize={size}&page={page}&{filterList:fcol}&{sortList:scol}',
|
96
|
+
// Parse the incoming result
|
97
|
+
pager_ajaxProcessing: function (data) {
|
98
|
+
if (data && data.hasOwnProperty('rows')) {
|
99
|
+
// Update the pager output
|
100
|
+
this.pager_output = data.pager_output;
|
101
|
+
// return total records, the rows HTML data,
|
102
|
+
// and the headers information.
|
103
|
+
return [data.total, $(data.rows), data.headers];
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
});
|
108
|
+
```
|
109
|
+
For full documentation regarding the usage of tableSorter please go [here](https://mottie.github.io/tablesorter/docs/index.html) for the very popular fork by mottie, or [here](http://tablesorter.com/docs/) for the original version of the plugin.
|
110
|
+
|
111
|
+
Now, the results fetched from the server would be filtered, sorter and paginated by TableSortable.
|
112
|
+
|
113
|
+
Of course there are many more configuration options that make TableSortable flexible and adaptable. For those, please see [advanced configuration](#advanced-configuration)
|
114
|
+
|
115
|
+
## Advanced Configuration
|
116
|
+
Coming soon...
|
117
|
+
|
118
|
+
### View Helpers
|
119
|
+
Coming soon...
|
120
|
+
|
121
|
+
## Development
|
122
|
+
|
123
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
124
|
+
|
125
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/odedd/table_sortable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
130
|
+
|
131
|
+
## License
|
132
|
+
|
133
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
134
|
+
|
135
|
+
## Code of Conduct
|
136
|
+
|
137
|
+
Everyone interacting in the TableSortable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/table_sortable/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module TableSortableHelper
|
2
|
+
|
3
|
+
def table_sortable_pager
|
4
|
+
render 'table_sortable/pager'
|
5
|
+
end
|
6
|
+
|
7
|
+
def table_sortable_headers
|
8
|
+
render 'table_sortable/headers'
|
9
|
+
end
|
10
|
+
|
11
|
+
def table_sortable_columns(record)
|
12
|
+
render 'table_sortable/columns', record: record
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
td = value
|
@@ -0,0 +1,42 @@
|
|
1
|
+
.nav aria-label="Table Navigation"
|
2
|
+
ul.pagination
|
3
|
+
li.page-item
|
4
|
+
a.page-link.first = fa_icon 'fast-backward'
|
5
|
+
li.page-item
|
6
|
+
a.page-link.prev = fa_icon 'step-backward'
|
7
|
+
li.page-item
|
8
|
+
span.page-link.pagedisplay
|
9
|
+
li.page-item
|
10
|
+
a.page-link.next = fa_icon 'step-forward'
|
11
|
+
li.page-item
|
12
|
+
a.page-link.last = fa_icon 'fast-forward'
|
13
|
+
|
14
|
+
|
15
|
+
/<nav aria-label="Page navigation example">
|
16
|
+
/ <ul class="pagination">
|
17
|
+
/ <li class="page-item">
|
18
|
+
/ <a class="page-link" href="#" aria-label="Previous">
|
19
|
+
/ <span aria-hidden="true">«</span>
|
20
|
+
/ <span class="sr-only">Previous</span>
|
21
|
+
/ </a>
|
22
|
+
/ </li>
|
23
|
+
/ <li class="page-item"><a class="page-link" href="#">1</a></li>
|
24
|
+
/ <li class="page-item"><a class="page-link" href="#">2</a></li>
|
25
|
+
/ <li class="page-item"><a class="page-link" href="#">3</a></li>
|
26
|
+
/ <li class="page-item">
|
27
|
+
/ <a class="page-link" href="#" aria-label="Next">
|
28
|
+
/ <span aria-hidden="true">»</span>
|
29
|
+
/ <span class="sr-only">Next</span>
|
30
|
+
/ </a>
|
31
|
+
/ </li>
|
32
|
+
/ </ul>
|
33
|
+
/</nav>
|
34
|
+
|
35
|
+
/.row
|
36
|
+
/ .col.text-right
|
37
|
+
/ .pagination.my-0.justify-content-center
|
38
|
+
/ a.first.ml-1 = fa_icon 'fast-backward'
|
39
|
+
/ a.prev = fa_icon 'step-backward'
|
40
|
+
/ span.mx-1.pagedisplay
|
41
|
+
/ a.ml-1.next = fa_icon 'step-forward'
|
42
|
+
/ a.last = fa_icon 'fast-forward'
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "table_sortable"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|