Sha256: 8d622b03a654e446be1c41a15e38e0aece674c59849d4f7da6e1cded8c4209bd
Contents?: true
Size: 1.05 KB
Versions: 10
Compression:
Stored size: 1.05 KB
Contents
function new_record(id,name){ var model_name = name.split("[")[1].split("_id]")[0]; $('#modal_new_record').attr("class","modal inmodal") $('#modal_new_record').addClass(model_name); var model_target = "#modal_new_record." + model_name; var url = "/crud/" + model_name + "/new.js?render=modal"; var jqxhr = $.ajax(url) .done(function(result) { $(model_target).attr('data-source',id); $(model_target).attr('data-saved','false'); $(model_target).on('hidden.bs.modal', function (e) { if($(model_target).attr('data-saved') == 'true'){ var entity_desc = $(model_target).attr('data-entity-name') var entity_id = $(model_target).attr('data-entity-id') $('#' + id).append($('<option>', { value: entity_id, text: entity_desc, selected: 'selected' })); $(model_target).attr('data-saved','false'); $(model_target).attr('data-entity-name','') $(model_target).attr('data-entity-id','') } }) $(model_target + ' .modal-body').html(result); $(model_target).modal('show'); $('.modal-backdrop').appendTo("body"); }); }
Version data entries
10 entries across 10 versions & 1 rubygems