Created
May 14, 2016 19:36
-
-
Save kevsersrca/30e9e11cc53163ef1a7e684edc59bc72 to your computer and use it in GitHub Desktop.
TODOLİST
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="tr"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>TodoList</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/yeti/bootstrap.min.css"> | |
<style> | |
#add-form | |
{ | |
display: none; | |
} | |
.panel-body | |
{ | |
display: none; | |
} | |
#update | |
{ | |
display: none; | |
} | |
#update-form | |
{ | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container-fluid"> | |
<div class="panel-group content"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<div class="pull-right" id="update"> | |
<a href="javascript:;"><i class="glyphicon glyphicon-pencil"></i></a> | |
</div> | |
<h1>Name</h1> | |
</div> | |
<div class="panel-body"> | |
<p>Description</p> | |
</div> | |
</div> | |
</div> | |
<div class="container-fluid" id="add-form"> | |
<form action="" method="post"> | |
<div class="form-group"> | |
<label for="Username">Name</label> | |
<input type="text" class="form-control" id="add-name" placeholder="Name"> | |
</div> | |
<div class="form-group"> | |
<label for="Name">Description</label> | |
<textarea name="description" id="add-description" class="form-control" rows="3" ></textarea> | |
</div> | |
<button type="submit" class="btn btn-default" id="add-button">Submit</button> | |
<a href="javascript:;" id="close-add-form">Close</a> | |
</form> | |
</div> | |
<div class="container-fluid" id="update-form"> | |
<form action="" method="post"> | |
<div class="form-group"> | |
<label for="Username">Name</label> | |
<input type="text" class="form-control" id="update-name" placeholder="Name"> | |
</div> | |
<div class="form-group"> | |
<label for="Name">Description</label> | |
<textarea name="description" id="update-description" class="form-control" rows="3" ></textarea> | |
</div> | |
<button type="submit" class="btn btn-default" id="update-button">Submit</button> | |
<a href="javascript:;" id="close-update-form">Close</a> | |
</form> | |
</div> | |
<div class="pull-right" > | |
<button type="button" class="btn btn-default" id="add-form-open"><i class="glyphicon glyphicon-plus"></i>Add</button> | |
</div> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> | |
<script> | |
var database = | |
[{ | |
/*'name':'notum 1', | |
'description':'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sit quidem, nulla fugiat, labore voluptatem dolor tempora? Debitis rem quidem dignissimos facere quaerat blanditiis quam provident natus, at obcaecati ipsum impedit.', | |
'status':0//status 0 is open 1 is closed | |
*/ | |
}]; | |
$(document).ready(function(){ | |
$('.btn-default').click(function(){ | |
$('#add-form').show(); | |
$('.content').hide(); | |
}); | |
$('#close-add-form').click(function(){ | |
$('#add-form').hide(); | |
$('.content').show(); | |
}); | |
}); | |
$(document).ready(function(){ | |
$(".content").on('click','.panel-heading',function(){ | |
$('#update').show(); | |
$(".panel-body").slideUp("slow"); | |
var el = $(this).parent(".panel-default").children(".panel-body"); | |
el.css('display') == 'block' ? el.slideUp('slow') : el.slideDown('slow') | |
}); | |
}); | |
$(document).ready(function(){ | |
$('#update').click(function(){ | |
$('.content').hide(); | |
$('#update-form').show(); | |
}); | |
$('#close-update-form').click(function(){ | |
$('#update-form').hide(); | |
$('.content').show(); | |
}); | |
}); | |
$(document).ready(function(){ | |
$('#add-button').click(function(){ | |
var name=$('#add-name').val(); | |
var description=$('#add-description').val(); | |
var string=JSON.stringify({'name':name,'description':description}); | |
database.push(string); | |
alert(database); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment