//application.js
$('.form_datetime').datepicker({
autoclose: true,
todayBtn: true,
pickerPosition: "bottom-left",
format: 'mm-dd-yyyy'
});
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
$(document).ready(function(){
$('.datepicker').datepicker({
autoclose: true,
todayBtn: true,
format: 'yyyy-mm-dd',
clearBtn: true,
orientation: 'bottom left'
});
});
$(document).ready(function(){
$('.monthpicker').datepicker({
startView: 'months',
minViewMode: 'months',
autoclose: true,
todayBtn: true,
format: 'yyyy-mm',
clearBtn: true,
orientation: 'bottom left'
});
});
$(document).ready(function () {
$("#addRow").click(function () {
$("#myTable").append("<tr><td>row</td><td><input type='text'></td></tr>");
});
});
function add_fields(link, association, content) {
var new_id = new Date().getTime();
// find the new_ + "association" that was defined in Rails helper
var regexp = new RegExp("new_" + association, "g");
// find the container and append in the sub field content
$(link).prev().append(content.replace(regexp, new_id));
return false;
}
function add_fields_to_table_row(link, association, content, id) {
var new_id = new Date().getTime();
// find the new_ + "association" that was defined in Rails helper
var regexp = new RegExp("new_" + association, "g");
// find the container and append in the sub field content
$(id).append(content.replace(regexp, new_id));
return false;
}