Skip to content

Instantly share code, notes, and snippets.

@marti1125
Last active December 14, 2015 07:19
Show Gist options
  • Save marti1125/5049430 to your computer and use it in GitHub Desktop.
Save marti1125/5049430 to your computer and use it in GitHub Desktop.
list.html crud
#{extends 'CRUD/layout.html' /} #{set
title:messages.get('crud.list.title', type.name) /}
<div id="aplicacion"></div>
<h2>
<i class="icon-user-md"></i>&nbsp;Administración de &{'crud.list.title', type.name}
</h2>
<p id="crudListAdd">
<a role="button" data-toggle="modal" href="#modalAcciones" id="add" class="btn btn-primary" ><i class="icon-plus"></i>&nbsp;&{'crud.add', type.modelName}</a>
</p>
<div id="crudListTable">
#{crud.table/}
</div>
<div id="crudListPagination">
#{crud.pagination /}
</div>
<script type="text/javascript">
$(function() {
function wizard(result){
$("#model-o-wizard").html('');
$('#modalAcciones').modal('hide');
$("#model-o-wizard").html(result);
var wizard = $("#wizard-crud").wizard({buttons:{nextText:"Siguiente",backText:"Atrás",submitText:"Guardar",saveAndContinueText:"Guardar y seguir editando",saveAndAddAnotherText:"Guardar y crear otro"}});
wizard.show();
}
function modal(result){
$("#model-o-wizard").html('');
$("#model-o-wizard").html('<div id="modalAgregar" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">'+result+'</div>');
$('#modalAgregar').modal('show');
}
$('#agregar').click(function(){
$.get("/admin/${type.controllerName}/new", function(result){
if("${type.controllerName}" == "aplicaciones"){
wizard(result);
} else {
modal(result);
}
});
});
$('.actualizar').click(function(){
var id = $(this).attr('id');
$.get("/admin/${type.controllerName}/"+id, function(result){
if("${type.controllerName}" == "aplicaciones"){
wizard(result);
} else {
modal(result);
}
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment