style
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
$('document').ready(function(){
|
||||
$( "#body" ).load( "/templates/home.html" );
|
||||
|
||||
// Botones
|
||||
$("#home").click(function(){
|
||||
$("#load").fadeIn(0);
|
||||
$( "#body" ).load( "/templates/home.html" );
|
||||
$.get("/info", function( data ) {
|
||||
var text = "<table class=\"info\">"
|
||||
@@ -11,10 +10,12 @@ $('document').ready(function(){
|
||||
});
|
||||
text += "</table>"
|
||||
$( "#info" ).html( text );
|
||||
$("#load").fadeOut("fast");
|
||||
});
|
||||
});
|
||||
|
||||
$("#animals").click(function(){
|
||||
$("#load").fadeIn(0);
|
||||
$.get( "/animal", function( data ) {
|
||||
$.get( "/species", function( species_r ) {
|
||||
var species = {};
|
||||
@@ -22,7 +23,7 @@ $('document').ready(function(){
|
||||
species[item._id] = item.name
|
||||
});
|
||||
|
||||
$( "#body" ).html("<h1>Yours Dinos</h1><button id='animal-add' class='btn btn-success btn-sm float-right'>+ New Dino</button><br><br><table id='animals-table'></table>");
|
||||
$( "#body" ).html("<h1>Yours Dinos <button id='animal-add' class='btn btn-success btn-sm float-right'>+ New Dino</button></h1><table id='animals-table'></table>");
|
||||
$( "#animal-add").click(function(){
|
||||
$( "#body" ).load( "/templates/animal-form.html", function (){
|
||||
set_animal_include("");
|
||||
@@ -50,10 +51,12 @@ $('document').ready(function(){
|
||||
return '<button class="btn btn-primary btn-sm" onclick="showAnimal(\''+ full[0] +'\')">Show</button> <button class="btn btn-info btn-sm" onclick="editAnimal(\''+ full[0] +'\')">Edit</button> <button class="btn btn-danger btn-sm" onclick="removeAnimal(\''+full[0]+'\')">Remove</button>';
|
||||
}}
|
||||
]});
|
||||
$("#load").fadeOut("fast");
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#species").click(function(){
|
||||
$("#load").fadeIn(0);
|
||||
$.get( "/species", function( data ) {
|
||||
$( "#body" ).html("<h1>All Species</h1><table id='species-table'></table>");
|
||||
dataSet = data.data.map(function(item) {
|
||||
@@ -64,17 +67,16 @@ $('document').ready(function(){
|
||||
responsive: true,
|
||||
columns: [
|
||||
{ title: "Name" },
|
||||
{ title: "Description" },
|
||||
{ title: "Options", className: "options-table-species", orderable: false,data: null, targets: -1, "mRender": function(data, type, full) {
|
||||
return '<button class="btn btn-primary btn-sm" onclick="alert(\'En desarollo\')">Show</button>'
|
||||
}}
|
||||
{ title: "Description" }
|
||||
]
|
||||
});
|
||||
$("#load").fadeOut("fast");
|
||||
});
|
||||
});
|
||||
|
||||
$("#about").click(function(){
|
||||
$( "#body" ).load( "/templates/about.html" );
|
||||
$("#load").fadeIn(0);
|
||||
$( "#body" ).load( "/templates/about.html", function(){$("#load").fadeOut("fast");} );
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ function onSubmitAnimal(form){
|
||||
};
|
||||
|
||||
function editAnimal(id){
|
||||
$("#load").fadeIn(0);
|
||||
$( "#body" ).load( "/templates/animal-form.html", function(){
|
||||
var animal;
|
||||
$.get( "/animal/"+id, function( data ) {
|
||||
@@ -48,19 +49,21 @@ function editAnimal(id){
|
||||
}
|
||||
set_animal_include(animal._id);
|
||||
paint_male_female(animal.specie, animal._id);
|
||||
$("#load").fadeOut("slow");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showAnimal(id){
|
||||
$( "#body" ).load( "/templates/animal-show.html", function(){
|
||||
$("#load").fadeIn(0);
|
||||
$( "#body" ).load( "/templates/animal-show.html", function(){
|
||||
var text = "<table>";
|
||||
$.get( "/animal/"+ id, function( data ) {
|
||||
var animal = data.data,
|
||||
j = 1;
|
||||
$.each(animal, function(i, val) {
|
||||
|
||||
if(i != "_id" && i != "__v" && i.indexOf("initial") < 0)
|
||||
if(i != "_id" && i != "__v" && i != "father" && i != "mother" && i != "name" && i.indexOf("initial") < 0)
|
||||
text += "<tr><td>"+i+"</td><td>"+(val ? val.$numberDecimal ? val.$numberDecimal : val : "")+"</td></tr>";
|
||||
// if(j % 3 == 0) text += "</tr><tr>"
|
||||
j++;
|
||||
@@ -73,6 +76,7 @@ function showAnimal(id){
|
||||
|
||||
get_parrents(animal);
|
||||
get_childrens(animal);
|
||||
$("#load").fadeOut("slow");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
$('document').ready(function(){
|
||||
$.get("/info", function( data ) {
|
||||
var text = "<table class=\"info\">"
|
||||
$.each(data, function(i, obj) {
|
||||
text += "<tr><td>"+i+"</td><td> "+obj+"</td></tr>";
|
||||
$( "#body" ).load( "/templates/home.html", function(){$("#load").fadeOut("slow");
|
||||
$.get("/info", function( data ) {
|
||||
var text = "<table class=\"info\">"
|
||||
$.each(data, function(i, obj) {
|
||||
text += "<tr><td>"+i+"</td><td> "+obj+"</td></tr>";
|
||||
});
|
||||
text += "</table>"
|
||||
$( "#info" ).html( text );
|
||||
$("#load").fadeOut("slow");
|
||||
});
|
||||
text += "</table>"
|
||||
$( "#info" ).html( text );
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user