effective_datatables 2.12.2 → 3.0.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 +4 -4
- data/README.md +632 -512
- data/app/assets/javascripts/dataTables/buttons/buttons.html5.js +176 -177
- data/app/assets/javascripts/dataTables/buttons/buttons.print.js +2 -0
- data/app/assets/javascripts/dataTables/buttons/dataTables.buttons.js +14 -14
- data/app/assets/javascripts/dataTables/dataTables.bootstrap.js +1 -1
- data/app/assets/javascripts/dataTables/jquery.dataTables.js +246 -217
- data/app/assets/javascripts/effective_datatables.js +2 -3
- data/app/assets/javascripts/effective_datatables/events.js.coffee +7 -0
- data/app/assets/javascripts/effective_datatables/filters.js.coffee +6 -0
- data/app/assets/javascripts/effective_datatables/initialize.js.coffee +42 -39
- data/app/assets/javascripts/effective_datatables/reset.js.coffee +7 -0
- data/app/assets/javascripts/vendor/jquery.delayedChange.js +1 -1
- data/app/assets/stylesheets/dataTables/dataTables.bootstrap.css +0 -1
- data/app/assets/stylesheets/effective_datatables.scss +1 -2
- data/app/assets/stylesheets/effective_datatables/{_scopes.scss → _filters.scss} +1 -1
- data/app/assets/stylesheets/effective_datatables/_overrides.scss +1 -1
- data/app/controllers/effective/datatables_controller.rb +2 -4
- data/app/helpers/effective_datatables_helper.rb +56 -91
- data/app/helpers/effective_datatables_private_helper.rb +55 -64
- data/app/models/effective/datatable.rb +103 -177
- data/app/models/effective/datatable_column.rb +28 -0
- data/app/models/effective/datatable_column_tool.rb +110 -0
- data/app/models/effective/datatable_dsl_tool.rb +28 -0
- data/app/models/effective/datatable_value_tool.rb +142 -0
- data/app/models/effective/effective_datatable/attributes.rb +25 -0
- data/app/models/effective/effective_datatable/collection.rb +38 -0
- data/app/models/effective/effective_datatable/compute.rb +154 -0
- data/app/models/effective/effective_datatable/cookie.rb +29 -0
- data/app/models/effective/effective_datatable/dsl.rb +14 -8
- data/app/models/effective/effective_datatable/dsl/bulk_actions.rb +5 -6
- data/app/models/effective/effective_datatable/dsl/charts.rb +7 -9
- data/app/models/effective/effective_datatable/dsl/datatable.rb +107 -57
- data/app/models/effective/effective_datatable/dsl/filters.rb +50 -0
- data/app/models/effective/effective_datatable/format.rb +157 -0
- data/app/models/effective/effective_datatable/hooks.rb +0 -18
- data/app/models/effective/effective_datatable/params.rb +34 -0
- data/app/models/effective/effective_datatable/resource.rb +108 -0
- data/app/models/effective/effective_datatable/state.rb +178 -0
- data/app/views/effective/datatables/_actions_column.html.haml +9 -42
- data/app/views/effective/datatables/_bulk_actions_column.html.haml +1 -1
- data/app/views/effective/datatables/_bulk_actions_dropdown.html.haml +2 -3
- data/app/views/effective/datatables/_chart.html.haml +1 -1
- data/app/views/effective/datatables/_datatable.html.haml +7 -25
- data/app/views/effective/datatables/_filters.html.haml +21 -0
- data/app/views/effective/datatables/_reset.html.haml +2 -0
- data/app/views/effective/datatables/_resource_column.html.haml +8 -0
- data/app/views/effective/datatables/index.html.haml +0 -1
- data/config/effective_datatables.rb +9 -32
- data/lib/effective_datatables.rb +2 -6
- data/lib/effective_datatables/engine.rb +1 -1
- data/lib/effective_datatables/version.rb +1 -1
- data/lib/generators/effective_datatables/install_generator.rb +2 -2
- metadata +39 -19
- data/app/assets/javascripts/dataTables/colreorder/dataTables.colReorder.js +0 -27
- data/app/assets/javascripts/dataTables/jszip/jszip.js +0 -9155
- data/app/assets/javascripts/effective_datatables/scopes.js.coffee +0 -9
- data/app/models/effective/active_record_datatable_tool.rb +0 -242
- data/app/models/effective/array_datatable_tool.rb +0 -97
- data/app/models/effective/effective_datatable/ajax.rb +0 -101
- data/app/models/effective/effective_datatable/charts.rb +0 -20
- data/app/models/effective/effective_datatable/dsl/scopes.rb +0 -23
- data/app/models/effective/effective_datatable/helpers.rb +0 -24
- data/app/models/effective/effective_datatable/options.rb +0 -309
- data/app/models/effective/effective_datatable/rendering.rb +0 -365
- data/app/views/effective/datatables/_scopes.html.haml +0 -21
@@ -1,6 +1,5 @@
|
|
1
1
|
//= require vendor/jquery.delayedChange
|
2
2
|
//= require vendor/jquery.fileDownload
|
3
|
-
//= require dataTables/jszip/jszip
|
4
3
|
|
5
4
|
//= require dataTables/jquery.dataTables
|
6
5
|
//= require dataTables/dataTables.bootstrap
|
@@ -10,14 +9,14 @@
|
|
10
9
|
//= require dataTables/buttons/buttons.colVis
|
11
10
|
//= require dataTables/buttons/buttons.html5
|
12
11
|
//= require dataTables/buttons/buttons.print
|
13
|
-
//= require dataTables/colreorder/dataTables.colReorder
|
14
12
|
//= require dataTables/responsive/dataTables.responsive
|
15
13
|
//= require dataTables/responsive/responsive.bootstrap
|
16
14
|
|
17
15
|
//= require effective_datatables/bulk_actions
|
18
16
|
//= require effective_datatables/events
|
17
|
+
//= require effective_datatables/filters
|
18
|
+
//= require effective_datatables/reset
|
19
19
|
//= require effective_datatables/responsive
|
20
|
-
//= require effective_datatables/scopes
|
21
20
|
|
22
21
|
//= require effective_datatables/charts
|
23
22
|
//= require effective_datatables/initialize
|
@@ -11,3 +11,10 @@ $(document).on 'column-visibility.dt', (event, settings, index, state) ->
|
|
11
11
|
$.event.trigger('page:change')
|
12
12
|
, 700)
|
13
13
|
)
|
14
|
+
|
15
|
+
# Remove empty label (bulk actions) from ColVis dropdown
|
16
|
+
$(document).on 'click.dtb-collection', (event) ->
|
17
|
+
$colvis = $('.dt-button-collection:not(.initialized)')
|
18
|
+
return if $colvis.length == 0
|
19
|
+
|
20
|
+
$colvis.addClass('initialized').find('li > a:empty').each -> $(this).parent().remove()
|
@@ -16,7 +16,7 @@ initializeDataTables = ->
|
|
16
16
|
buttons: [
|
17
17
|
{
|
18
18
|
extend: 'colvis',
|
19
|
-
text: 'Show /
|
19
|
+
text: 'Show / Hide',
|
20
20
|
postfixButtons: [
|
21
21
|
{ extend: 'colvisGroup', text: 'Show all', show: ':hidden'},
|
22
22
|
{ extend: 'colvisRestore', text: 'Show default'}
|
@@ -26,52 +26,57 @@ initializeDataTables = ->
|
|
26
26
|
extend: 'copy',
|
27
27
|
exportOptions:
|
28
28
|
format:
|
29
|
-
header: (str) -> $("<div>#{str}</div>").children('.
|
29
|
+
header: (str) -> $("<div>#{str}</div>").children('.search-label').first().text()
|
30
30
|
columns: buttons_export_columns
|
31
31
|
},
|
32
32
|
{
|
33
33
|
extend: 'csv',
|
34
34
|
exportOptions:
|
35
35
|
format:
|
36
|
-
header: (str) -> $("<div>#{str}</div>").children('.
|
37
|
-
columns: buttons_export_columns
|
38
|
-
},
|
39
|
-
{
|
40
|
-
extend: 'excel',
|
41
|
-
exportOptions:
|
42
|
-
format:
|
43
|
-
header: (str) -> $("<div>#{str}</div>").children('.filter-label').first().text()
|
36
|
+
header: (str) -> $("<div>#{str}</div>").children('.search-label').first().text()
|
44
37
|
columns: buttons_export_columns
|
45
38
|
},
|
46
39
|
{
|
47
40
|
extend: 'print',
|
48
41
|
exportOptions:
|
49
42
|
format:
|
50
|
-
header: (str) -> $("<div>#{str}</div>").children('.
|
43
|
+
header: (str) -> $("<div>#{str}</div>").children('.search-label').first().text()
|
51
44
|
columns: ':visible:not(.col-actions)'
|
52
45
|
},
|
53
46
|
]
|
54
|
-
colReorder: !simple
|
55
47
|
columns: datatable.data('columns')
|
56
48
|
deferLoading: [datatable.data('display-records'), datatable.data('total-records')]
|
57
49
|
deferRender: true
|
50
|
+
displayStart: datatable.data('display-start')
|
58
51
|
dom: "<'row'<'col-sm-4'l><'col-sm-8'B>><'row'<'col-sm-12'tr>><'row'<'col-sm-6'i><'col-sm-6'p>>"
|
59
|
-
iDisplayLength: datatable.data('display-
|
52
|
+
iDisplayLength: datatable.data('display-length')
|
60
53
|
language: { 'lengthMenu': 'Show _MENU_ per page'}
|
61
|
-
lengthMenu: [[10, 25, 50, 100, 250, 1000,
|
62
|
-
order: datatable.data('
|
54
|
+
lengthMenu: [[10, 25, 50, 100, 250, 1000, 9999999], ['10', '25', '50', '100', '250', '1000', 'All']]
|
55
|
+
order: datatable.data('display-order')
|
63
56
|
processing: true
|
64
57
|
responsive: true
|
65
58
|
serverParams: (params) ->
|
66
|
-
|
67
|
-
|
68
|
-
|
59
|
+
api = this.api()
|
60
|
+
api.columns().flatten().each (index) => params['columns'][index]['visible'] = api.column(index).visible()
|
61
|
+
|
62
|
+
$table = $(api.table().node())
|
63
|
+
$form = $(".effective-datatable-filters[aria-controls='#{$table.attr('id')}']").first()
|
64
|
+
|
65
|
+
if $form.length > 0
|
66
|
+
params['scope'] = $form.find("input[id^='filters_scope']:checked").val() || ''
|
67
|
+
params['filter'] = {}
|
68
|
+
|
69
|
+
$form.find("[id^='filters_']:not(input[id^='filters_scope'])").each ->
|
70
|
+
$input = $(this)
|
71
|
+
params['filter'][$input.attr('id').substring(8, $input.attr('id').length)] = $input.val()
|
72
|
+
|
69
73
|
serverSide: true
|
70
74
|
scrollCollapse: true
|
71
75
|
pagingType: 'simple_numbers'
|
72
76
|
initComplete: (settings) ->
|
77
|
+
initializeReset(this.api())
|
73
78
|
initializeBulkActions(this.api())
|
74
|
-
|
79
|
+
initializeSearch(this.api())
|
75
80
|
drawCallback: (settings) ->
|
76
81
|
$table = $(this.api().table().node())
|
77
82
|
|
@@ -87,11 +92,15 @@ initializeDataTables = ->
|
|
87
92
|
# Copies the bulk actions html, stored in a data attribute on the table, into the buttons area
|
88
93
|
initializeBulkActions = (api) ->
|
89
94
|
$table = $(api.table().node())
|
90
|
-
bulkActions = $table.data('bulk-actions')
|
91
95
|
|
92
|
-
if
|
93
|
-
$table.closest('.dataTables_wrapper').children().first()
|
94
|
-
|
96
|
+
if $table.data('bulk-actions')
|
97
|
+
$table.closest('.dataTables_wrapper').children().first().find('.dt-buttons').prepend($table.data('bulk-actions'))
|
98
|
+
|
99
|
+
initializeReset = (api) ->
|
100
|
+
$table = $(api.table().node())
|
101
|
+
|
102
|
+
if $table.data('reset')
|
103
|
+
$table.closest('.dataTables_wrapper').children().first().find('.dt-buttons').prepend($table.data('reset'))
|
95
104
|
|
96
105
|
# After we perform a bulk action, we have to re-select the checkboxes manually and do a bit of house keeping
|
97
106
|
drawBulkActions = ($table) ->
|
@@ -125,21 +134,21 @@ initializeDataTables = ->
|
|
125
134
|
chart = new google.visualization[data['type']](obj)
|
126
135
|
chart.draw(google.visualization.arrayToDataTable(data['data']), data['options'])
|
127
136
|
|
128
|
-
# Appends the
|
129
|
-
|
137
|
+
# Appends the search html, stored in the column definitions, into each column header
|
138
|
+
initializeSearch = (api) ->
|
130
139
|
api.columns().flatten().each (index) =>
|
131
140
|
$th = $(api.column(index).header())
|
132
141
|
settings = api.settings()[0].aoColumns[index] # column specific settings
|
133
142
|
|
134
|
-
if settings.
|
135
|
-
api.settings()[0].aoPreSearchCols[index].sSearch = settings.
|
143
|
+
if settings.search && ('' + settings.search).length > 0 # Assign preselected values
|
144
|
+
api.settings()[0].aoPreSearchCols[index].sSearch = settings.search
|
136
145
|
|
137
|
-
if settings.
|
138
|
-
$th.append('<br>' + settings.
|
139
|
-
|
146
|
+
if settings.searchHtml # Append the search html and initialize input events
|
147
|
+
$th.append('<br>' + settings.searchHtml)
|
148
|
+
initializeSearchEvents($th)
|
140
149
|
|
141
150
|
# Sets up the proper events for each input
|
142
|
-
|
151
|
+
initializeSearchEvents = ($th) ->
|
143
152
|
$th.find('input,select').each (_, input) ->
|
144
153
|
$input = $(input)
|
145
154
|
|
@@ -169,23 +178,17 @@ initializeDataTables = ->
|
|
169
178
|
|
170
179
|
# Apply EffectiveFormInputs to the Show x per page dropdown
|
171
180
|
if datatable.data('effective-form-inputs')
|
172
|
-
try table.closest('.dataTables_wrapper').find('.dataTables_length select').select2()
|
181
|
+
try table.closest('.dataTables_wrapper').find('.dataTables_length select').removeAttr('name').select2()
|
173
182
|
|
174
183
|
destroyDataTables = ->
|
175
184
|
$('table.effective-datatable').each ->
|
176
185
|
if $.fn.DataTable.fnIsDataTable(this)
|
177
186
|
$(this).DataTable().destroy()
|
178
187
|
|
179
|
-
anotherDestroy = ->
|
180
|
-
for settings in $.fn.dataTable.settings
|
181
|
-
$(settings.nTableWrapper).unbind('.DT').find(':not(tbody *)').unbind('.DT')
|
182
|
-
$(window).unbind('.DT-'+settings.sInstance)
|
183
|
-
|
184
|
-
$.fn.dataTable.settings.length = 0
|
185
|
-
|
186
188
|
$ -> initializeDataTables()
|
187
189
|
$(document).on 'page:change', -> initializeDataTables()
|
188
190
|
$(document).on 'turbolinks:load', -> initializeDataTables()
|
191
|
+
$(document).on 'turbolinks:render', -> initializeDataTables()
|
189
192
|
$(document).on 'turbolinks:before-cache', -> destroyDataTables()
|
190
193
|
|
191
194
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
$(document).on 'click', 'a.buttons-reset-cookie', (event) ->
|
2
|
+
event.preventDefault()
|
3
|
+
|
4
|
+
$obj = $(event.currentTarget)
|
5
|
+
$obj.find('span').text('Resetting...')
|
6
|
+
document.cookie = "#{$obj.data('cookie-name')}=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"
|
7
|
+
location.reload()
|
@@ -46,7 +46,7 @@ table.dataTable.sort-hidden thead .sorting_desc { background-image: none; }
|
|
46
46
|
table.dataTable .form-group { width: 100%; margin-left: 0px; margin-right: 0px; }
|
47
47
|
table.dataTable select { width: 100%; }
|
48
48
|
table.dataTable .form-control { width: 100%; }
|
49
|
-
table.dataTable .form-group.
|
49
|
+
table.dataTable .form-group.datatable_search_bulk_actions { margin-left: 4px; }
|
50
50
|
|
51
51
|
// Processing popup
|
52
52
|
div.dataTables_wrapper div.dataTables_processing {
|
@@ -4,10 +4,7 @@ module Effective
|
|
4
4
|
|
5
5
|
# This will respond to both a GET and a POST
|
6
6
|
def show
|
7
|
-
|
8
|
-
scopes = (params[:scopes].presence || {})
|
9
|
-
|
10
|
-
@datatable = find_datatable(params[:id]).try(:new, attributes.merge(scopes))
|
7
|
+
@datatable = find_datatable(params[:id]).try(:new)
|
11
8
|
@datatable.view = view_context if !@datatable.nil?
|
12
9
|
|
13
10
|
EffectiveDatatables.authorized?(self, :index, @datatable.try(:collection_class))
|
@@ -28,6 +25,7 @@ module Effective
|
|
28
25
|
private
|
29
26
|
|
30
27
|
def find_datatable(id)
|
28
|
+
id = id.gsub('-', '/')
|
31
29
|
id.classify.safe_constantize || id.classify.pluralize.safe_constantize
|
32
30
|
end
|
33
31
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# These are expected to be called by a developer. They are part of the datatables DSL.
|
2
2
|
module EffectiveDatatablesHelper
|
3
3
|
|
4
|
-
def render_datatable(datatable,
|
4
|
+
def render_datatable(datatable, input_js: {}, charts: true, filters: true, simple: false)
|
5
5
|
raise 'expected datatable to be present' unless datatable
|
6
6
|
|
7
7
|
datatable.view ||= self
|
@@ -12,121 +12,86 @@ module EffectiveDatatablesHelper
|
|
12
12
|
return content_tag(:p, "You are not authorized to view this datatable. (cannot :index, #{datatable.collection_class})")
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
charts = charts && datatable._charts.present?
|
16
|
+
filters = filters && (datatable._scopes.present? || datatable._filters.present?)
|
17
|
+
|
18
|
+
effective_datatable_params = {
|
19
|
+
id: datatable.to_param,
|
20
|
+
class: datatable.table_html_class,
|
21
|
+
data: {
|
22
|
+
'effective-form-inputs' => defined?(EffectiveFormInputs),
|
23
|
+
'bulk-actions' => datatable_bulk_actions(datatable),
|
24
|
+
'columns' => datatable_columns(datatable),
|
25
|
+
'display-length' => datatable.display_length,
|
26
|
+
'display-order' => [datatable.order_index, datatable.order_direction].to_json(),
|
27
|
+
'display-records' => datatable.to_json[:recordsFiltered],
|
28
|
+
'display-start' => datatable.display_start,
|
29
|
+
'input-js-options' => (input_js || {}).to_json,
|
30
|
+
'reset' => datatable_reset(datatable),
|
31
|
+
'simple' => datatable.simple?.to_s,
|
32
|
+
'source' => effective_datatables.datatable_path(datatable, {format: 'json'}),
|
33
|
+
'total-records' => datatable.to_json[:recordsTotal]
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
if (charts || filters) && !simple
|
38
|
+
output = ''.html_safe
|
39
|
+
|
40
|
+
if charts
|
41
|
+
datatable._charts.each { |name, _| output << render_datatable_chart(datatable, name) }
|
42
|
+
end
|
18
43
|
|
19
|
-
|
20
|
-
|
44
|
+
if filters
|
45
|
+
output << render_datatable_filters(datatable)
|
46
|
+
end
|
21
47
|
|
22
|
-
|
23
|
-
|
48
|
+
output << render(partial: 'effective/datatables/datatable',
|
49
|
+
locals: { datatable: datatable, effective_datatable_params: effective_datatable_params }
|
50
|
+
)
|
24
51
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
return content_tag(:p, "You are not authorized to view this datatable. (cannot :index, #{datatable.collection_class})})")
|
29
|
-
end
|
52
|
+
output
|
53
|
+
else
|
54
|
+
datatable.attributes[:simple] = true if simple
|
30
55
|
|
31
|
-
|
32
|
-
|
56
|
+
render(partial: 'effective/datatables/datatable',
|
57
|
+
locals: { datatable: datatable, effective_datatable_params: effective_datatable_params }
|
58
|
+
)
|
59
|
+
end
|
33
60
|
end
|
34
61
|
|
35
|
-
def
|
62
|
+
def render_datatable_filters(datatable)
|
36
63
|
raise 'expected datatable to be present' unless datatable
|
37
64
|
|
38
|
-
return unless datatable.scopes.present?
|
39
65
|
datatable.view ||= self
|
66
|
+
return unless datatable._scopes.present? || datatable._filters.present?
|
67
|
+
|
68
|
+
if datatable._filters_form_required?
|
69
|
+
render partial: 'effective/datatables/filters', locals: { datatable: datatable }
|
70
|
+
else
|
71
|
+
render(partial: 'effective/datatables/filters', locals: { datatable: datatable }).gsub('<form', '<div').gsub('/form>', '/div>').html_safe
|
72
|
+
end
|
40
73
|
|
41
|
-
render partial: 'effective/datatables/scopes', locals: { datatable: datatable }
|
42
74
|
end
|
43
75
|
|
44
76
|
def render_datatable_charts(datatable)
|
45
77
|
raise 'expected datatable to be present' unless datatable
|
46
78
|
|
47
|
-
return unless datatable.charts.present?
|
48
79
|
datatable.view ||= self
|
80
|
+
return unless datatable._charts.present?
|
49
81
|
|
50
|
-
datatable.
|
82
|
+
datatable._charts.map { |name, _| render_datatable_chart(datatable, name) }.join.html_safe
|
51
83
|
end
|
52
84
|
|
53
85
|
def render_datatable_chart(datatable, name)
|
54
86
|
raise 'expected datatable to be present' unless datatable
|
55
87
|
|
56
|
-
return unless datatable.charts.present?
|
57
|
-
return unless datatable.charts[name].present?
|
58
88
|
datatable.view ||= self
|
89
|
+
return unless datatable._charts[name].present?
|
59
90
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
render partial: (options[:partial] || 'effective/datatables/chart'),
|
64
|
-
locals: { datatable: datatable, chart: chart }
|
65
|
-
end
|
66
|
-
|
67
|
-
def datatables_admin_path?
|
68
|
-
@datatables_admin_path ||= (
|
69
|
-
path = request.path.to_s.downcase.chomp('/') + '/'
|
70
|
-
referer = request.referer.to_s.downcase.chomp('/') + '/'
|
71
|
-
(attributes[:admin_path] || referer.include?('/admin/') || path.include?('/admin/')) rescue false
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
# TODO: Improve on this
|
76
|
-
def datatables_active_admin_path?
|
77
|
-
attributes[:active_admin_path] rescue false
|
78
|
-
end
|
79
|
-
|
80
|
-
### Icon Helpers for actions_column or elsewhere
|
81
|
-
def show_icon_to(path, options = {})
|
82
|
-
glyphicon_to('eye-open', path, {title: 'Show'}.merge(options))
|
83
|
-
end
|
84
|
-
|
85
|
-
def edit_icon_to(path, options = {})
|
86
|
-
glyphicon_to('edit', path, {title: 'Edit'}.merge(options))
|
87
|
-
end
|
88
|
-
|
89
|
-
def destroy_icon_to(path, options = {})
|
90
|
-
defaults = {title: 'Destroy', data: {method: :delete, confirm: 'Delete this item?'}}
|
91
|
-
glyphicon_to('trash', path, defaults.merge(options))
|
92
|
-
end
|
91
|
+
chart = datatable._charts[name]
|
92
|
+
chart_data = datatable.to_json[:charts][name][:data]
|
93
93
|
|
94
|
-
|
95
|
-
defaults = {title: 'Archive', data: {method: :delete, confirm: 'Archive this item?'}}
|
96
|
-
glyphicon_to('trash', path, defaults.merge(options))
|
97
|
-
end
|
98
|
-
|
99
|
-
def unarchive_icon_to(path, options = {})
|
100
|
-
defaults = {title: 'Unarchive', data: {confirm: 'Unarchive this item?'}}
|
101
|
-
glyphicon_to('retweet', path, defaults.merge(options))
|
102
|
-
end
|
103
|
-
|
104
|
-
def settings_icon_to(path, options = {})
|
105
|
-
glyphicon_to('cog', path, {title: 'Settings'}.merge(options))
|
106
|
-
end
|
107
|
-
|
108
|
-
def ok_icon_to(path, options = {})
|
109
|
-
glyphicon_to('ok', path, {title: 'OK'}.merge(options))
|
110
|
-
end
|
111
|
-
|
112
|
-
def approve_icon_to(path, options = {})
|
113
|
-
glyphicon_to('ok', path, {title: 'Approve'}.merge(options))
|
114
|
-
end
|
115
|
-
|
116
|
-
def remove_icon_to(path, options = {})
|
117
|
-
glyphicon_to('remove', path, {title: 'Remove'}.merge(options))
|
118
|
-
end
|
119
|
-
|
120
|
-
def glyphicon_to(icon, path, options = {})
|
121
|
-
content_tag(:a, options.merge(href: path)) do
|
122
|
-
if icon.start_with?('glyphicon-')
|
123
|
-
content_tag(:span, '', class: "glyphicon #{icon}")
|
124
|
-
else
|
125
|
-
content_tag(:span, '', class: "glyphicon glyphicon-#{icon}")
|
126
|
-
end
|
127
|
-
end
|
94
|
+
render partial: chart[:partial], locals: { datatable: datatable, chart: chart, chart_data: chart_data }
|
128
95
|
end
|
129
|
-
alias_method :bootstrap_icon_to, :glyphicon_to
|
130
|
-
alias_method :glyph_icon_to, :glyphicon_to
|
131
96
|
|
132
97
|
end
|