Skip to content

Commit af0c2ef

Browse files
committed
Add helper methods: datatable_admin_path? datatable_active_admin_path?
1 parent 1dc8a9f commit af0c2ef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/helpers/effective_datatables_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,13 @@ def datatable_widths(datatable)
6262
datatable.table_columns.values.map { |options| {'sWidth' => options[:width]} if options[:width] }.to_json()
6363
end
6464

65+
def datatables_admin_path?
66+
(attributes[:admin_path] || request.referer.downcase.include?('/admin/')) rescue false
67+
end
68+
69+
# TODO: Improve on this
70+
def datatables_active_admin_path?
71+
attributes[:active_admin_path] rescue false
72+
end
6573

6674
end

0 commit comments

Comments
 (0)