Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added fonts/glyphicons-halflings-regular.eot
Binary file not shown.
229 changes: 229 additions & 0 deletions fonts/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/glyphicons-halflings-regular.ttf
Binary file not shown.
Binary file added fonts/glyphicons-halflings-regular.woff
Binary file not shown.
9 changes: 7 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<meta charset="UTF-8">
<title>TEST JSON Server</title>
<link rel="stylesheet" href="stylesheets/bootstrap.min.css">
<link rel="stylesheet" href="styles/main.css">
<!-- Custom CSS for the '4 Col Portfolio' Template -->
<link href="css/4-col-portfolio.css" rel="stylesheet">
<script src='javascript/jquery.min.js'></script>
<script src='javascript/jquery.tmpl.min.js'></script>
</head>
Expand All @@ -19,10 +22,12 @@
<img class="media-object dp img-circle" src="http://lorempixel.com/100/100/" style="width: 100px;height:100px;">
</a>
<div class="media-body">
<h4 class="media-heading">${subject}</h4>
<h4 class="media-heading"> ${subject} </h4>

<h5>${date}</h5>
<button id="subject" data-id="${id}" class="btn btn-danger">Read More</button>
<hr style="margin:8px auto">

<span class="label label-default">HTML5/CSS3</span>
<span class="label label-default">jQuery</span>
<span class="label label-info">CakePHP</span>
Expand Down
38 changes: 27 additions & 11 deletions javascript/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
(function($){
(function($) {
$.ajax({
dataType: 'json',
header: {'Content-Type': 'application/json'},
crossDomain: true,
url: 'http://booklog.io/1/post',
success: function(response){
$('#postTemplate')
.tmpl(response.posts)
.appendTo('#content');
dataType: 'json',
url: 'http://booklog.io/1/post',
success: function(response, jqXHR, textStatus) {
$('#postTemplate')
.tmpl(response.posts)
.appendTo('#content');
},
complete: function(jqXHR, textStatus) {
$('[id=subject]').each(function(index) {
var me = $(this);

me.on('click', function() {
var id = me.data('id');

$.ajax({
dataType: 'json',
url: 'http://booklog.io/1/post/' + id,
success: function(response, jqXHR, textStatus) {
$('#content').html('<h2>'
+ response.post.content
+ '</h2>');
},
});
});
});
}
});

}) ($);
}) ($);
30 changes: 30 additions & 0 deletions javascript/mainbad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(function($) {
$.ajax({
dataType: 'json',
url: 'http://booklog.io/1/post',
success: function(response, jqXHR, textStatus) {
$('#postTemplate')
.tmpl(response.posts)
.appendTo('#content');
},
complete: function(jqXHR, textStatus) {
$('[id=subject]').each(function(index) {
var me = $(this);

me.on('click', function() {
var id = me.data('id');

$.ajax({
dataType: 'json',
url: 'http://booklog.io/1/post/' + id,
success: function(response, jqXHR, textStatus) {
$('#content').html('<h2>'
+ response.post.content
+ '</h2>');
},
});
});
});
}
});
}) ($);
11 changes: 11 additions & 0 deletions stylesheets/4-col-portfolio.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
body {
margin-top: 50px; /* 50px is the height of the navbar - change this if the navbarn height changes */
}

.portfolio-item {
margin-bottom: 25px;
}

footer {
margin: 50px 0;
}