My question is how would I would convert the following javascript to coffeescript for a rails project using datatables:
$.extend( $.fn.dataTableExt.oStdClasses, {
"sWrapper": "dataTables_wrapper form-inline"
} );
… this works:
jQuery ->
$('#logs').dataTable
bJQueryUI: true
sDom: "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>"
sPaginationType: "full_numbers"
oLanguage: "sLengthMenu": "_MENU_ records per page"
The $.extend javascript is from the DataTables web site that’s needed to
use Twitter Bootstrap with DataTables, and I just can’t figure out how
to convert that to coffeescript.
Update:
For anyone encountering this issue, just use the gem “jquery-datatables-rails”
which makes it easy to include DataTables in a Rails app and it supports
Twitter Bootstrap.
You can use http://js2coffee.org/ when in doubt.
This would be the obvious (the braces are optional):
Some people would do this, which I think goes too far, it’s confusing:
Personally I prefer to remove complexity from function calls: