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
4 changes: 2 additions & 2 deletions booklog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ <h4 class="media-heading"><%= post.title %></h4>

<script id='post-single' type='text/template'>
<div class="col-md-12 portfolio-item">
<h2 class="media-heading"><%= title %></h2>
<h4><%= content %></h4>
<h2 class="media-heading"><%= posts[0].title %></h2>
<h4><%= posts[0].message %></h4>
</div>
</script>

Expand Down
7 changes: 4 additions & 3 deletions booklog/javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ var app = app || {};
**/
app.Message = Backbone.Model.extend({
url: function() {
return 'http://launchergap.org/1/post'
return 'http://localhost:3000/1/post'
+ ( this.id === null ? '' : '/' + this.id );
},
id: null,
defaults: {
success: false,
errfor: {},
posts: [],
subject: '',
content: ''
post: [],
title: '',
message: ''
}
});

Expand Down
48 changes: 48 additions & 0 deletions googlemap/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple markers</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>

function initMap() {
var myLatLng = {lat: 25.05, lng: 121.53};

var map = new google.maps.Map(document.getElementById('map'), {
zoom: 16,
center: myLatLng
});

var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hello World!'
});
}

</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyACnXBrsGMB7iGukptA1OS6rBjYVH4gDy8&signed_in=true&callback=initMap"></script>

<!-- JavaScript -->
<script src="javascripts/jquery.min.js"></script>
<script src="vendor/underscore/underscore-min.js"></script>
<script src="vendor/backbone/backbone-min.js"></script>
<script src='javascripts/app.js'></script>

</body>
</html>
57 changes: 57 additions & 0 deletions googlemap/javascripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* SETUP
**/
var app = app || {};


/**
* MODELS
**/
app.Message = Backbone.Model.extend({
url: function() {
return 'http://localhost:3000/1/post'
+ ( this.id === null ? '' : '/' + this.id );
},
id: null,
defaults: {
success: false,
errfor: {},
posts: [],
post: [],
title: '',
message: ''
}
});

/**
* VIEWS
**/
app.ContentView = Backbone.View.extend({
el: '#content',
events: {
'click #subject': 'read'
},
// constructor
initialize: function() {
this.model = new app.Message();
this.model.bind('change', this.render, this);
this.template = _.template($('#post-list').html());

this.model.fetch();
},
render: function() {
var html = this.template(this.model.attributes);
this.$el.html(html);
},
read: function(e) {
var id = $(e.target).data('id');
var self = this;
this.model.id = id;
this.template = _.template($('#post-single').html());
this.model.fetch();
}
});

$(document).ready(function(){
app.contentView = new app.ContentView();
});
5 changes: 5 additions & 0 deletions googlemap/javascripts/jquery.min.js

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions googlemap/vendor/backbone/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "backbone",
"version": "1.2.1",
"main": "backbone.js",
"dependencies": {
"underscore": ">=1.7.0"
},
"ignore": [
"docs",
"examples",
"test",
"*.yml",
"*.html",
"*.ico",
"*.md",
"CNAME",
".*",
"karma.*",
"component.json",
"package.json"
],
"homepage": "https://github.com/jashkenas/backbone",
"_release": "1.2.1",
"_resolution": {
"type": "version",
"tag": "1.2.1",
"commit": "938a8ff934fd4de4f0009f68d43f500f5920b490"
},
"_source": "git://github.com/jashkenas/backbone.git",
"_target": "~1.2.1",
"_originalSource": "backbone",
"_direct": true
}
22 changes: 22 additions & 0 deletions googlemap/vendor/backbone/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions googlemap/vendor/backbone/backbone-min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions googlemap/vendor/backbone/backbone-min.map

Large diffs are not rendered by default.

Loading