table_sortable 0.4.7 → 1.0.0.pre.alpha.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 +4 -4
- data/app/views/table_sortable/_capture_column.html.erb +3 -0
- data/app/views/table_sortable/_row.html.erb +1 -0
- data/lib/table_sortable/column.rb +5 -7
- data/lib/table_sortable/version.rb +1 -1
- data/lib/table_sortable/view_helpers.rb +12 -8
- data/lib/table_sortable.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a4f40f3be133c7ec573c4b44ed7a0e09d4ff32
|
4
|
+
data.tar.gz: 8c5b23bb0ca2f978ac6e521a8c3ff6ec0b5f19c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cded6091b5b1f9ca2fc93dcb89dda9282b1793a1e5ba3c6930bb5a58e1ef98a1058f0139eb4a80bb3491758c5d051d4be047744b67f6382fed5dc12d3bba14f2
|
7
|
+
data.tar.gz: b2b5058c8231d4150bcb39b118b5645bab6d26416e3f2b70c227a6b5d8762d39798b4ca47775df077124f33d8f2f430cb3fedbec7b0bda945af03fc6089d8628
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= table_sortable_columns record, record_counter, html_options %>
|
@@ -24,15 +24,13 @@ module TableSortable
|
|
24
24
|
@template = template
|
25
25
|
@template_path = template_path
|
26
26
|
|
27
|
-
view_path = @template_path || (defined?(Rails) ? File.join(
|
27
|
+
view_path = @template_path || (defined?(Rails) ? File.join("#{controller.controller_path}/table_sortable/") : '')
|
28
28
|
|
29
|
-
view_filename = "
|
30
|
-
|
31
|
-
@column_partial = view.any? ? File.join(view_path, "#{view_filename}") : false
|
29
|
+
view_filename = "#{@template}_column.html"
|
30
|
+
@column_partial = controller.lookup_context.find_all(File.join(view_path, "_#{view_filename}")).any? ? File.join(view_path, "#{view_filename}") : false
|
32
31
|
|
33
|
-
view_filename = "
|
34
|
-
|
35
|
-
@header_partial = view.any? ? File.join(view_path, "#{view_filename}") : false
|
32
|
+
view_filename = "#{@template}_header.html"
|
33
|
+
@header_partial = controller.lookup_context.find_all(File.join(view_path, "_#{view_filename}")).any? ? File.join(view_path, "#{view_filename}") : false
|
36
34
|
|
37
35
|
@options = column_options
|
38
36
|
@filter = TableSortable::Column::Filter.new(options.merge(:column => self) )
|
@@ -36,7 +36,7 @@ module TableSortable
|
|
36
36
|
th_options.merge!(html_options)
|
37
37
|
|
38
38
|
if col.header_partial
|
39
|
-
render
|
39
|
+
render partial: col.header_partial,
|
40
40
|
locals: {label: col.label,
|
41
41
|
column: col,
|
42
42
|
index: index}
|
@@ -48,7 +48,7 @@ module TableSortable
|
|
48
48
|
end.join.html_safe
|
49
49
|
end
|
50
50
|
|
51
|
-
def table_sortable_columns(record, html_options = {})
|
51
|
+
def table_sortable_columns(record, row_number, html_options = {})
|
52
52
|
controller.columns.map.with_index do |col, index|
|
53
53
|
value = col.value(record)
|
54
54
|
content = col.content(record)
|
@@ -57,12 +57,7 @@ module TableSortable
|
|
57
57
|
td_options.merge!(html_options)
|
58
58
|
|
59
59
|
if col.column_partial
|
60
|
-
|
61
|
-
locals: {content: content,
|
62
|
-
value: value,
|
63
|
-
source: record,
|
64
|
-
column: col,
|
65
|
-
index: index}
|
60
|
+
@column_html[col.name][row_number]
|
66
61
|
else
|
67
62
|
content_tag :td, td_options do
|
68
63
|
content
|
@@ -70,5 +65,14 @@ module TableSortable
|
|
70
65
|
end
|
71
66
|
end.join.html_safe
|
72
67
|
end
|
68
|
+
|
69
|
+
def table_sortable_rows(layout, collection, html_options = {})
|
70
|
+
@column_html = {}
|
71
|
+
controller.columns.select{|col| col.column_partial}.each do |col|
|
72
|
+
@column_html[col.name] = []
|
73
|
+
render partial: col.column_partial, collection: collection, as: :record, layout: '/table_sortable/capture_column.html.erb', locals: {column: col}
|
74
|
+
end
|
75
|
+
render partial: '/table_sortable/row.html.erb', layout: layout, collection: collection, as: :record, locals: {html_options: html_options}
|
76
|
+
end
|
73
77
|
end
|
74
78
|
end
|
data/lib/table_sortable.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_sortable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.pre.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oded Davidov
|
@@ -160,6 +160,8 @@ files:
|
|
160
160
|
- LICENSE.txt
|
161
161
|
- README.md
|
162
162
|
- Rakefile
|
163
|
+
- app/views/table_sortable/_capture_column.html.erb
|
164
|
+
- app/views/table_sortable/_row.html.erb
|
163
165
|
- bin/console
|
164
166
|
- bin/setup
|
165
167
|
- lib/table_sortable.rb
|
@@ -205,9 +207,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
207
|
version: '0'
|
206
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
209
|
requirements:
|
208
|
-
- - "
|
210
|
+
- - ">"
|
209
211
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
212
|
+
version: 1.3.1
|
211
213
|
requirements: []
|
212
214
|
rubyforge_project:
|
213
215
|
rubygems_version: 2.6.12
|