paco
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/* required LIB STYLES */
|
||||
/* .Treant se automatski dodaje na svaki chart conatiner */
|
||||
.Treant { position: relative; overflow: hidden; padding: 0 !important; }
|
||||
.Treant > .node,
|
||||
.Treant > .pseudo { position: absolute; display: block; visibility: hidden; }
|
||||
.Treant.Treant-loaded .node,
|
||||
.Treant.Treant-loaded .pseudo { visibility: visible; }
|
||||
.Treant > .pseudo { width: 0; height: 0; border: none; padding: 0; }
|
||||
.Treant .collapse-switch { width: 3px; height: 3px; display: block; border: 1px solid black; position: absolute; top: 1px; right: 1px; cursor: pointer; }
|
||||
.Treant .collapsed .collapse-switch { background-color: #868DEE; }
|
||||
.Treant > .node img { border: none; float: left; }
|
||||
@@ -4,8 +4,11 @@ body{
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-attachment: fixed;
|
||||
overflow-y:scroll;
|
||||
color: white;
|
||||
text-shadow: 0px 0px 3px rgb(0, 153, 153);
|
||||
font-family: 'Palanquin Dark', sans-serif;
|
||||
}
|
||||
|
||||
#menu{
|
||||
@@ -15,7 +18,7 @@ body{
|
||||
padding-top: 50px;
|
||||
padding-bottom: 50px;
|
||||
border: 2px solid rgb(0, 153, 153);
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
@@ -26,7 +29,8 @@ body{
|
||||
text-decoration: underline;
|
||||
}
|
||||
#menu h4 a:hover{
|
||||
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
}
|
||||
|
||||
#menu li a{
|
||||
@@ -44,7 +48,7 @@ body{
|
||||
|
||||
#body{
|
||||
background: rgba(0, 153, 153, 0.5);
|
||||
width: calc(100vw - 195px);
|
||||
width: calc(100vw - 210px);
|
||||
min-height: 518px;
|
||||
margin: 15px;;
|
||||
padding-left: 25px;
|
||||
|
||||
@@ -2,14 +2,20 @@
|
||||
<head>
|
||||
<link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="/css/Treant.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="https://fonts.googleapis.com/css?family=Palanquin+Dark&display=swap" rel="stylesheet">
|
||||
<link href="/css/main.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="/js/jquery.dataTables.min.js"></script>
|
||||
<script src="/js/raphael.js"></script>
|
||||
<script src="/js/Treant.js"></script>
|
||||
<script src="/js/buttons.js"></script>
|
||||
<script src="/js/functions.js"></script>
|
||||
<script src="/js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav id="menu" class="text-center">
|
||||
<h4><a href="/">FamilyARK</a></h4>
|
||||
<h4><a id="home">FamilyARK</a></h4>
|
||||
<ul class="list-unstyled text-center">
|
||||
<li> </li>
|
||||
<li><a id="animals">Dinos</a></li>
|
||||
@@ -18,8 +24,6 @@
|
||||
<li><a id="about">About</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article id="body">
|
||||
<h1>Welcome to FamilyARK</h1>
|
||||
</article>
|
||||
<article id="body"></article>
|
||||
<body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
$('document').ready(function(){
|
||||
$( "#body" ).load( "/templates/home.html" );
|
||||
|
||||
// Botones
|
||||
$("#home").click(function(){
|
||||
$( "#body" ).load( "/templates/home.html" );
|
||||
});
|
||||
|
||||
$("#animals").click(function(){
|
||||
$.get( "/animal", function( data ) {
|
||||
$( "#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>");
|
||||
$( "#animal-add").click(function(){
|
||||
$( "#body" ).load( "/templates/animal-form.html" );
|
||||
})
|
||||
dataSet = data.data.map(function(item) {
|
||||
return [item._id, item.name, item.initial_level + " - " + item.level];
|
||||
});
|
||||
$('#animals-table').DataTable({
|
||||
data: dataSet,
|
||||
responsive: true,
|
||||
columns: [
|
||||
{ title: "id", visible: false},
|
||||
{ title: "Name" },
|
||||
{ title: "Level" },
|
||||
{ title: "Options", className: "options-table", orderable: false,data: null, targets: -1, "mRender": function(data, type, full) {
|
||||
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>';
|
||||
}}
|
||||
]});
|
||||
});
|
||||
});
|
||||
$("#species").click(function(){
|
||||
$.get( "/species", function( data ) {
|
||||
$( "#body" ).html("<h1>All Species</h1><table id='species-table'></table>");
|
||||
dataSet = data.data.map(function(item) {
|
||||
return [item.name, item.description];
|
||||
});
|
||||
$('#species-table').DataTable({
|
||||
data: dataSet,
|
||||
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>'
|
||||
}}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#about").click(function(){
|
||||
$( "#body" ).load( "/templates/about.html" );
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
|
||||
//Funtions
|
||||
function onSubmitAnimal(form){
|
||||
var data = {};
|
||||
$.map($(form).serializeArray(), function(n, i){
|
||||
if(n['value']!= "") data[n['name']] = n['value'];
|
||||
else data[n['name']] = null;
|
||||
});
|
||||
|
||||
if(data._id){
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: "/animal/"+data._id,
|
||||
data: JSON.stringify(data),
|
||||
success: function() { $("#animals").click() },
|
||||
contentType : "application/json"
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/animal",
|
||||
data: JSON.stringify(data),
|
||||
success: function() { $("#animals").click() },
|
||||
contentType : "application/json"
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function editAnimal(id){
|
||||
$( "#body" ).load( "/templates/animal-form.html", function(){
|
||||
$.get( "/animal/"+id, function( data ) {
|
||||
for(key in data.data[0])
|
||||
{
|
||||
if(data.data[0].hasOwnProperty(key)){
|
||||
if(key == "father" || key == "mother" || key == "specie" || key == "sex"){
|
||||
let a = key;
|
||||
setTimeout(function(){
|
||||
$('#a-'+a+' option[value='+data.data[0][a]+']').attr('selected','selected');
|
||||
console.log(data.data[0][a]);
|
||||
console.log(a);
|
||||
}, 200)
|
||||
}else{
|
||||
$('input[name='+key+']').val( data.data[0][key].$numberDecimal ? data.data[0][key].$numberDecimal : data.data[0][key]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function showAnimal(id){
|
||||
$( "#body" ).load( "/templates/animal-show.html", function(){
|
||||
/* $.get( "/animal/"+id, function( data ) {
|
||||
$.get( "/animal", function( animalsData ) {
|
||||
$.each(data.data[0], function(i, val) {
|
||||
$("#data").append( "<div>"+i+": "+(val.$numberDecimal ? val.$numberDecimal : val)+"</div>");
|
||||
});
|
||||
});
|
||||
});*/
|
||||
$.get('/animal/tree/' + id, function(data) {
|
||||
|
||||
var chart_config = [{
|
||||
container: "#tree",
|
||||
connectors: {
|
||||
type: 'step'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: {
|
||||
name: data[0].name
|
||||
},
|
||||
//parent: data[0].ancestorsmother.filter(ancestor => ancestor.depth === 0),
|
||||
//parent: data[0].ancestorsfather.filter(ancestor => ancestor.depth === 0),
|
||||
//children: data[0].childrensmother.filter(ancestor => ancestor.depth === 0),
|
||||
//children: data[0].childrensfather.filter(ancestor => ancestor.depth === 0)
|
||||
},
|
||||
{
|
||||
text: {
|
||||
name: "test"
|
||||
},
|
||||
parent: data[0].ancestors.filter(ancestor => ancestor.depth === 0)
|
||||
}]
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function removeAnimal(id){
|
||||
if(confirm("¿Surely you want to erase this dino?")){
|
||||
$.ajax({
|
||||
url: '/animal/'+id,
|
||||
type: 'DELETE',
|
||||
success: function() { $("#animals").click() }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
$('document').ready(function(){
|
||||
// Botones
|
||||
$("#animals").click(function(){
|
||||
$.get( "/animal", function( data ) {
|
||||
$( "#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>");
|
||||
$( "#animal-add").click(function(){
|
||||
$( "#body" ).load( "/templates/animal-form.html" );
|
||||
})
|
||||
dataSet = data.data.map(function(item) {
|
||||
return [item._id, item.name, item.initial_level + " - " + item.level];
|
||||
});
|
||||
$('#animals-table').DataTable({
|
||||
data: dataSet,
|
||||
responsive: true,
|
||||
columns: [
|
||||
{ title: "id", visible: false},
|
||||
{ title: "Name" },
|
||||
{ title: "Level" },
|
||||
{ title: "Options", className: "options-table", orderable: false,data: null, targets: -1, "mRender": function(data, type, full) {
|
||||
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>';
|
||||
}}
|
||||
]});
|
||||
});
|
||||
});
|
||||
$("#species").click(function(){
|
||||
$.get( "/species", function( data ) {
|
||||
$( "#body" ).html("<h1>All Species</h1><table id='species-table'></table>");
|
||||
dataSet = data.data.map(function(item) {
|
||||
return [item.name, item.description];
|
||||
});
|
||||
$('#species-table').DataTable({
|
||||
data: dataSet,
|
||||
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>'
|
||||
}}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#about").click(function(){
|
||||
$( "#body" ).load( "/templates/about.html" );
|
||||
});
|
||||
});
|
||||
|
||||
//Funtions
|
||||
function onSubmitAnimal(form){
|
||||
var data = {};
|
||||
$.map($(form).serializeArray(), function(n, i){
|
||||
if(n['value']!= "") data[n['name']] = n['value'];
|
||||
});
|
||||
|
||||
if(data._id){
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
url: "/animal/"+data._id,
|
||||
data: JSON.stringify(data),
|
||||
success: function() { $("#animals").click() },
|
||||
contentType : "application/json"
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/animal",
|
||||
data: JSON.stringify(data),
|
||||
success: function() { $("#animals").click() },
|
||||
contentType : "application/json"
|
||||
});
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function editAnimal(id){
|
||||
$( "#body" ).load( "/templates/animal-form.html", function(){
|
||||
$.get( "/animal/"+id, function( data ) {
|
||||
for(key in data.data[0])
|
||||
{
|
||||
if(data.data[0].hasOwnProperty(key)){
|
||||
if(key == "father" || key == "mother" || key == "specie" || key == "sex"){
|
||||
let a = key;
|
||||
setTimeout(function(){
|
||||
$('#a-'+a+' option[value='+data.data[0][a]+']').attr('selected','selected');
|
||||
console.log(data.data[0][a]);
|
||||
console.log(a);
|
||||
}, 200)
|
||||
}else{
|
||||
$('input[name='+key+']').val( data.data[0][key].$numberDecimal ? data.data[0][key].$numberDecimal : data.data[0][key]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function showAnimal(id){
|
||||
$( "#body" ).load( "/templates/animal-show.html", function(){
|
||||
$.get( "/animal/"+id, function( data ) {
|
||||
$.get( "/animal", function( animalsData ) {
|
||||
$.each(data.data[0], function(i, val) {
|
||||
$("#data").append( "<div>"+i+": "+(val.$numberDecimal ? val.$numberDecimal : val)+"</div>");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function removeAnimal(id){
|
||||
if(confirm("¿Surely you want to erase this dino?")){
|
||||
$.ajax({
|
||||
url: '/animal/'+id,
|
||||
type: 'DELETE',
|
||||
success: function() { $("#animals").click() }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
$('document').ready(function(){
|
||||
// Botones
|
||||
$("#animals").click(function(){
|
||||
$.get( "/animal", function( data ) {
|
||||
$( "#body" ).html("<button id='animal-add'>+</button><table id='animals-table'></table>");
|
||||
$( "#animal-add").click(function(){
|
||||
$( "#body" ).load( "/templates/animal-form.html" );
|
||||
})
|
||||
dataSet = data.data.map(function(item) {
|
||||
return [item.name, item.inital_level+ " - " + item.level];
|
||||
});
|
||||
$('#species-table').DataTable({
|
||||
data: dataSet,
|
||||
columns: [
|
||||
{ title: "Name" },
|
||||
{ title: "Level" }
|
||||
]});
|
||||
});
|
||||
});
|
||||
$("#species").click(function(){
|
||||
$.get( "/species", function( data ) {
|
||||
$( "#body" ).html("<table id='species-table'></table>");
|
||||
dataSet = data.data.map(function(item) {
|
||||
return [item.name, item.description];
|
||||
});
|
||||
$('#species-table').DataTable({
|
||||
data: dataSet,
|
||||
columns: [
|
||||
{ title: "Name" },
|
||||
{ title: "Description" },
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
//Funtions
|
||||
//$('#animal-add-button').click(function() {
|
||||
function onSubmitAnimal(form){
|
||||
console.log(222);
|
||||
JSON.stringify($(form).serializeArray());
|
||||
|
||||
console.log( data );
|
||||
return false;
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -0,0 +1,138 @@
|
||||
<form id="animal-form" onsubmit="return onSubmitAnimal(this)">
|
||||
<h5>Identication</h5>
|
||||
<div class="row">
|
||||
<input type="hidden" class="form-control" name="_id" id="id">
|
||||
|
||||
<div class="form-group col-4">
|
||||
<label for="a-UUID">UUID</label>
|
||||
<input type="text" class="form-control" name="uuid" id="a-UUID" placeholder="UUID">
|
||||
</div>
|
||||
<div class="form-group col-3">
|
||||
<label for="a-name">Name</label>
|
||||
<input type="text" class="form-control" name="name" id="a-name" placeholder="Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-initial_level">Initial Level</label>
|
||||
<input type="number" class="form-control" name="initial_level" id="a-initial_level" placeholder="Initial Level" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-level">Level</label>
|
||||
<input type="number" class="form-control" name="level" id="a-level" placeholder="Level" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h5>Initial attributes</h5>
|
||||
<div class="row">
|
||||
<div class="form-group col-2">
|
||||
<label for="a-initial_health">Initial Health</label>
|
||||
<input type="number" step="any" class="form-control" name="initial_health" id="a-inital_health" placeholder="Initial Health">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-initial_energy">Initial Energy</label>
|
||||
<input type="number" step="any" class="form-control" name="initial_energy" id="a-initial_energy" placeholder="Initial Energy">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-initial_food">Initial Food</label>
|
||||
<input type="number" step="any" class="form-control" name="initial_food" id="a-initial_food" placeholder="Initial Food">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-initial_damage">Initial Damage</label>
|
||||
<input type="number" step="any" class="form-control" name="initial_damage" id="a-initial_damage" placeholder="Initial Damage">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-initial_velocity">Initial Velocity</label>
|
||||
<input type="number" step="any" class="form-control" name="initial_velocity" id="a-initial_velocity" placeholder="Initial Velocity">
|
||||
</div>
|
||||
</div>
|
||||
<h5>Actuality attributes</h5>
|
||||
<div class="row">
|
||||
<div class="form-group col-2">
|
||||
<label for="a-health">Health</label>
|
||||
<input type="number" step="any" class="form-control" name="health" id="a-health" placeholder="Health">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-energy">Energy</label>
|
||||
<input type="number" step="any" class="form-control" name="energy" id="a-energy" placeholder="Energy">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-food">Food</label>
|
||||
<input type="number" step="any" class="form-control" name="food" id="a-food" placeholder="Food">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-damage">Damage</label>
|
||||
<input type="number" step="any" class="form-control" name="damage" id="a-damage" placeholder="Damage">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-velocity">Velocity</label>
|
||||
<input type="number" step="any" class="form-control" name="velocity" id="a-velocity" placeholder="Velocity">
|
||||
</div>
|
||||
</div>
|
||||
<h5>Parenting data</h5>
|
||||
<div class="row">
|
||||
<div class="form-group col-2">
|
||||
<label for="a-father">Father</label>
|
||||
<select 5de1c950a23e880015b454e2 class="form-control" name="father" id="a-father" placeholder="Father"><option value="">None..</option></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-mother">Mother</label>
|
||||
<select class="form-control" name="mother" id="a-mother" placeholder="Mother"><option value="">None..</option></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-inconsistency">Inconsistency</label>
|
||||
<input type="number" step="any" class="form-control" name="inconsistency" id="a-inconsistency" placeholder="Inconsistency">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-imprint">Imprint</label>
|
||||
<input type="number" step="any" class="form-control" name="imprint" id="a-imprint" placeholder="Imprint">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-mutations">Mutations</label>
|
||||
<input type="number" class="form-control" name="mutations" id="a-mutations" placeholder="Mutations">
|
||||
</div>
|
||||
</div>
|
||||
<h5>Clan data</h5>
|
||||
<div class="row">
|
||||
<div class="form-group col-2">
|
||||
<label for="a-server">Server</label>
|
||||
<input type="text" class="form-control" name="server" id="a-server" placeholder="Server">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-base">Base</label>
|
||||
<input type="text" class="form-control" name="base" id="a-base" placeholder="Base">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-2">
|
||||
<label for="a-breeder">Breeder</label>
|
||||
<input type="text" class="form-control" name="breeder" id="a-breeder" placeholder="Breeder">
|
||||
</div>
|
||||
</div>
|
||||
<button id="animal-add-button" type="submit" class="btn btn-primary float-right">Submit</button>
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
$('document').ready(function(){
|
||||
$.get( "/animal", function( data ) {
|
||||
data.data.map(function(item){
|
||||
$("#a-father, #a-mother").append("<option value='"+item._id+"'>"+item.name+" - "+ item.level +"</option>");
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
<h1 class="a-name">Un dino</h1>
|
||||
<div class="row">
|
||||
<div id="data" class="col-6"></div>
|
||||
<div id="tree" class="col-6"><h5>Aqui vendra el arbolgenialogico.</h5></div>
|
||||
<div id="chart" class="col-12"><h5>Aqui vendran graficas.</h5></div>
|
||||
<div id="tree" class="col-6"></div>
|
||||
<div id="chart" class="col-12"><h5>Aqui vendran graficas de cada atributo con el inicial y el actual, para que se pueda ver el crecimiento.</h5></div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<h1>Welcome to FamilyARK</h1>
|
||||
<div class="text-center">
|
||||
<h4>Your app for your dinos.</h4>
|
||||
<h4>Inventory, breeding and family.</h4>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user