class Daru::View::DataTables
Public Class Methods
init_css( dependent_css=DATATABLES_DEPENDENCIES_CSS )
click to toggle source
@param [Array] dependent css files required @return [String] CSS code of the dependent file(s)
# File lib/daru/data_tables/display/display.rb, line 27 def self.init_css( dependent_css=DATATABLES_DEPENDENCIES_CSS ) css = '' css << "\n<style type='text/css'>" css << Daru::View.generate_init_code_css(dependent_css) css << "\n</style>" css end
init_iruby( dependent_js=DATATABLES_DEPENDENCIES_IRUBY )
click to toggle source
Enable to show plots on IRuby notebook. Load the dependent JS files in IRuby notebook. Those JS will help in plotting the table in IRuby cell.
One can see the loaded JS files in the source code of the notebook. @example
# File lib/daru/data_tables/display/iruby_notebook.rb, line 34 def self.init_iruby( dependent_js=DATATABLES_DEPENDENCIES_IRUBY ) # dependent_css=['jquery.dataTables.css'] # Note: Jquery is dependecy for DataTables. # Since Jquery is already a dependency for iruby notebook. # So it will be loaded into IRuby notebook when `iruby` is run. # No need to add it in the `dependent_js`. js = generate_init_code_js(dependent_js) # TODO: don't know how to import css like js # css = generate_init_code_css(dependent_css) IRuby.display(IRuby.javascript(js)) # IRuby.display(css, mime: 'text/stylesheet') # FixMe: Don't know, how to add css in IRuby notebook (Means there is # no IRuby.stylesheet(..) method) end
init_javascript( dependent_js=DATATABLES_DEPENDENCIES_WEB )
click to toggle source
@param dependent_js [Array] dependent js files required @return [String] js code of the dependent files
# File lib/daru/data_tables/display/display.rb, line 13 def self.init_javascript( dependent_js=DATATABLES_DEPENDENCIES_WEB ) # TODO: there are many js and css files, that must be added for # more features. Refer: https://datatables.net/download/index js = '' js << "\n<script type='text/javascript'>" js << Daru::View.generate_init_code_js(dependent_js) js << "\n</script>" js end
init_script()
click to toggle source
dependent script for the library. It must be added in the head tag of the web application.
@return [String] code of the dependent css and js file(s) @example
dep_js = DataTables.init_script
use in Rails app : <%=raw dep_js %>
# File lib/daru/data_tables/display/display.rb, line 46 def self.init_script init_code = '' init_code << init_css init_code << init_javascript init_code end