From 17d03d060f37eaf91cb8c19194a53ffe7340300b Mon Sep 17 00:00:00 2001 From: Matthew Shawkat Date: Sun, 28 Apr 2013 01:44:16 +0100 Subject: [PATCH] commiting template files --- .gitignore | 1 + index.html | 37 +++++++++++++--- javascripts/application/application.js | 30 ++++--------- javascripts/application/views/explore.js | 24 +++++++++- javascripts/application/views/index.js | 12 +---- stylesheets/application/main.css | 56 ++++++++++++++++++++++++ 6 files changed, 122 insertions(+), 38 deletions(-) create mode 100644 stylesheets/application/main.css diff --git a/.gitignore b/.gitignore index 5331bce..dacef98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .project .sass-cache .DS_Store +/nbproject diff --git a/index.html b/index.html index fab0b10..bdb83b9 100644 --- a/index.html +++ b/index.html @@ -5,15 +5,12 @@ + Go Explore - - - - - + @@ -31,7 +28,35 @@ + + \ No newline at end of file diff --git a/javascripts/application/application.js b/javascripts/application/application.js index 4d2f950..bc84a8e 100644 --- a/javascripts/application/application.js +++ b/javascripts/application/application.js @@ -1,4 +1,5 @@ -YUI().use('app', 'index-view', 'item-model', 'item-list', 'location-service', function (Y) { +YUI().use('app', 'index-view', 'explore-view','item-model', 'item-list', 'location-service', function (Y) { + var app = new Y.App({ serverRouting: false, @@ -12,6 +13,11 @@ YUI().use('app', 'index-view', 'item-model', 'item-list', 'location-service', fu app.route('/', function (req) { + this.showView('index'); + }); + + + app.route('/explore', function (req) { var modelList = new Y.ItemList(); var location = new Y.LocationService({ @@ -28,26 +34,8 @@ YUI().use('app', 'index-view', 'item-model', 'item-list', 'location-service', fu maximumAge: 0, enableHighAccuracy: true }); - - - // setTimeout(function(){ - // modelList.add({ - // id: 1, - // latitude: -31.953004, - // longitude: 115.857469 - // }); - // }, 1000); - - - this.showView('index', { - modelList: modelList - }); - }); - - - - app.route('/explore', function (req) { - this.showView('explore'); + + this.showView('explore' , {modelList: modelList}); }); diff --git a/javascripts/application/views/explore.js b/javascripts/application/views/explore.js index a18f8ca..199ba41 100644 --- a/javascripts/application/views/explore.js +++ b/javascripts/application/views/explore.js @@ -1,6 +1,28 @@ YUI.add('explore-view', function (Y) { - Y.IndexView = Y.Base.create('exploreView', Y.View, [], { + Y.ExploreView = Y.Base.create('exploreView', Y.View, [], { + template: Y.one('#explore-template').getHTML(), + + initializer: function () { + var list = this.get('modelList'); + list.after(['add', 'remove', 'reset'], this.render, this); + list.after('*:change', this.render, this); + }, + + render: function () { + var container = this.get('container'); + + var template = new Y.Template(), + html = template.render(this.template, this.get('modelList').toJSON()); + + container.setHTML(html); + + if (!container.inDoc()) { + Y.one('body').append(container); + } + + return this; + } }); }, '0.0.1', { requires: ['view'] diff --git a/javascripts/application/views/index.js b/javascripts/application/views/index.js index 08d6d1f..0820f70 100644 --- a/javascripts/application/views/index.js +++ b/javascripts/application/views/index.js @@ -2,19 +2,11 @@ YUI.add('index-view', function (Y) { Y.IndexView = Y.Base.create('indexView', Y.View, [], { template: Y.one('#index-template').getHTML(), - initializer: function () { - var list = this.get('modelList'); - - list.after(['add', 'remove', 'reset'], this.render, this); - list.after('*:change', this.render, this); - }, - - render: function () { var container = this.get('container'); - + var template = new Y.Template(), - html = template.render(this.template, this.get('modelList').toJSON()); + html = template.render(this.template); container.setHTML(html); diff --git a/stylesheets/application/main.css b/stylesheets/application/main.css new file mode 100644 index 0000000..b2725bb --- /dev/null +++ b/stylesheets/application/main.css @@ -0,0 +1,56 @@ +/* + Document : main + Created on : Apr 27, 2013, 5:14:19 PM + Author : Matthew + Description: + Purpose of the stylesheet follows. +*/ + +root { + display: block; + +} + +body{ + font-family: verdana; + text-decoration: none !important; +} + +a, u { + text-decoration: none; +} + +.header{ + background-color: activeborder; + padding: 10px; +} + +.content{ + padding: 10px; + margin: 40px 0 ; +} + +#big-message{ + text-align: center; + margin-bottom: 40px; + font-weight: bold; + font-size: 20px; +} + +#small-message{ + text-align: center; + margin-bottom: 80px; +} + +#main-button-container{ + width: 100px; + margin: 0 auto; + background-color: burlywood; + padding: 10px; + text-align: center; + cursor: pointer; + font-weight: bold; + color: white; +} + +