Skip to content
This repository has been archived by the owner on May 2, 2019. It is now read-only.

Commit

Permalink
Change directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuruog committed Mar 10, 2013
1 parent 251b605 commit 8100309
Show file tree
Hide file tree
Showing 69 changed files with 142 additions and 142 deletions.
16 changes: 8 additions & 8 deletions Gruntfile.js
Expand Up @@ -3,19 +3,19 @@ module.exports = function(grunt) {
grunt.initConfig({

jshint: {
all: ['Gruntfile.js', 'app/js/**/*.js']
all: ['Gruntfile.js', 'js/**/*.js']
},
watch: {
scripts: {
files: ['app/js/**/*.js'],
files: ['js/**/*.js'],
tasks: ['jshint']
},
stylus: {
files: ['app/css/styl/*.styl'],
files: ['css/styl/*.styl'],
tasks: ['stylus']
},
handlebars: {
files: ['app/hbs/**/*.hbs'],
files: ['hbs/**/*.hbs'],
tasks: ['handlebars']
}
},
Expand All @@ -31,8 +31,8 @@ module.exports = function(grunt) {
version: '0.1.0',
url: 'https://github.com/mitsuruog/SPA-with-Backbone',
options: {
paths: 'app/js',
outdir: 'app/docs'
paths: 'js',
outdir: 'docs'
}
}
},
Expand All @@ -42,7 +42,7 @@ module.exports = function(grunt) {
},
compile: {
files: {
'app/css/main.css': ['app/css/styl/*.styl']
'css/main.css': ['css/styl/*.styl']
}
}
},
Expand All @@ -56,7 +56,7 @@ module.exports = function(grunt) {
}
},
files: {
"app/js/template.js": "app/hbs/*.hbs"
"js/template.js": "hbs/*.hbs"
}
}
}
Expand Down
11 changes: 0 additions & 11 deletions app/hbs/history.hbs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -6,7 +6,7 @@ thema_blue_body()

thema_blue_special_container()
background linear-gradient(top, #292C3E, #13152A)

thema_blue_special_color()
color #FFF

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions hbs/history.hbs
@@ -0,0 +1,11 @@
{{#each history}}
<ul class="history" data-id="{{this.id}}">
<li class="query">{{this.query}}</li>
<li class="service">({{this.service}})</li>
<li class="search-buttons">
<button class="btn btn-mini btn-danger btn-delete">
<i class="icon-remove-sign icon-white"></i>
</button>
</li>
</ul>
{{/each}}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
100 changes: 50 additions & 50 deletions app/index.html → index.html
@@ -1,51 +1,51 @@
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="ja" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="ja" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="ja" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="ja" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="ja" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>How to build single page application with Backbone.js</title>

<link href="assets/css/bootstrap-2.3.0.css" rel="stylesheet" media="screen" />
<!-- <link href="assets/css/bootstrap-responsive-2.3.0.css" rel="stylesheet" media="screen" />-->
<link href="assets/css/bootstrap-narrow-0.0.1.css" rel="stylesheet" media="screen" />
<link href="css/main.css" rel="stylesheet" media="screen" />

</head>
<body>

<!--app root -->
<div id="app"></div>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="assets/js/bootstrap-2.3.0.js"></script>
<script type="text/javascript" src="assets/js/underscore-1.4.4.js"></script>
<script type="text/javascript" src="assets/js/backbone-0.9.10.js"></script>
<script type="text/javascript" src="assets/js/backbone.localStorage-1.1.0.js"></script>
<script type="text/javascript" src="assets/js/moment-2.0.0.js"></script>
<script type="text/javascript" src="assets/js/handlebars-1.0.0-rc.3.js"></script>
<script type="text/javascript" src="assets/js/twitter-text.js"></script>

<script type="text/javascript" src="js/namespace.js"></script>
<script type="text/javascript" src="js/template.js"></script>
<script type="text/javascript" src="js/models/twitter.js"></script>
<script type="text/javascript" src="js/models/hotpepper.js"></script>
<script type="text/javascript" src="js/collections/search_list.js"></script>
<script type="text/javascript" src="js/collections/twitter_list.js"></script>
<script type="text/javascript" src="js/collections/hotpepper_list.js"></script>
<script type="text/javascript" src="js/views/search_bar.js"></script>
<script type="text/javascript" src="js/views/tabs.js"></script>
<script type="text/javascript" src="js/views/search_results.js"></script>
<script type="text/javascript" src="js/views/history.js"></script>
<script type="text/javascript" src="js/views/footer.js"></script>
<script type="text/javascript" src="js/app.js"></script>

</body>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="ja" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="ja" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="ja" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="ja" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="ja" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>How to build single page application with Backbone.js</title>

<link href="assets/css/bootstrap-2.3.0.css" rel="stylesheet" media="screen" />
<!-- <link href="assets/css/bootstrap-responsive-2.3.0.css" rel="stylesheet" media="screen" />-->
<link href="assets/css/bootstrap-narrow-0.0.1.css" rel="stylesheet" media="screen" />
<link href="css/main.css" rel="stylesheet" media="screen" />

</head>
<body>

<!--app root -->
<div id="app"></div>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="assets/js/bootstrap-2.3.0.js"></script>
<script type="text/javascript" src="assets/js/underscore-1.4.4.js"></script>
<script type="text/javascript" src="assets/js/backbone-0.9.10.js"></script>
<script type="text/javascript" src="assets/js/backbone.localStorage-1.1.0.js"></script>
<script type="text/javascript" src="assets/js/moment-2.0.0.js"></script>
<script type="text/javascript" src="assets/js/handlebars-1.0.0-rc.3.js"></script>
<script type="text/javascript" src="assets/js/twitter-text.js"></script>

<script type="text/javascript" src="js/namespace.js"></script>
<script type="text/javascript" src="js/template.js"></script>
<script type="text/javascript" src="js/models/twitter.js"></script>
<script type="text/javascript" src="js/models/hotpepper.js"></script>
<script type="text/javascript" src="js/collections/search_list.js"></script>
<script type="text/javascript" src="js/collections/twitter_list.js"></script>
<script type="text/javascript" src="js/collections/hotpepper_list.js"></script>
<script type="text/javascript" src="js/views/search_bar.js"></script>
<script type="text/javascript" src="js/views/tabs.js"></script>
<script type="text/javascript" src="js/views/search_results.js"></script>
<script type="text/javascript" src="js/views/history.js"></script>
<script type="text/javascript" src="js/views/footer.js"></script>
<script type="text/javascript" src="js/app.js"></script>

</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,26 +1,26 @@
MyApp.Collections.TwitterList = Backbone.Collection.extend({

url: 'http://search.twitter.com/search.json',

model: MyApp.Models.Twitter,

search: function (param) {

this.fetch({
data: {
q: encodeURIComponent(param.query),
},
dataType: 'jsonp'
});

},

parse: function (response, options) {

this.response = response;

return response.results;

}

MyApp.Collections.TwitterList = Backbone.Collection.extend({

url: 'http://search.twitter.com/search.json',

model: MyApp.Models.Twitter,

search: function (param) {

this.fetch({
data: {
q: encodeURIComponent(param.query),
},
dataType: 'jsonp'
});

},

parse: function (response, options) {

this.response = response;

return response.results;

}

});
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions app/js/template.js → js/template.js
Expand Up @@ -11,11 +11,11 @@ function program1(depth0,data) {
var buffer = "", stack1;
buffer += "\r\n<ul class=\"history\" data-id=\""
+ escapeExpression(((stack1 = depth0.id),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
+ "\"> \r\n <li class=\"query\">"
+ "\">\r\n <li class=\"query\">"
+ escapeExpression(((stack1 = depth0.query),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
+ "</li> \r\n <li class=\"service\">("
+ "</li>\r\n <li class=\"service\">("
+ escapeExpression(((stack1 = depth0.service),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
+ ")</li> \r\n <li class=\"search-buttons\"> \r\n <button class=\"btn btn-mini btn-danger btn-delete\"> \r\n <i class=\"icon-remove-sign icon-white\"></i> \r\n </button> \r\n </li> \r\n</ul> \r\n";
+ ")</li>\r\n <li class=\"search-buttons\">\r\n <button class=\"btn btn-mini btn-danger btn-delete\">\r\n <i class=\"icon-remove-sign icon-white\"></i>\r\n </button>\r\n </li>\r\n</ul>\r\n";
return buffer;
}

Expand Down
26 changes: 13 additions & 13 deletions app/js/views/footer.js → js/views/footer.js
@@ -1,14 +1,14 @@
MyApp.Views.Footer = Backbone.View.extend({

tmpl: _.template(
'<div class="navbar navbar-inverse navbar-fixed-bottom">' +
' <div class="navbar-inner">' +
' <div class="container">Copyright (C) 2013 <a href="https://twitter.com/mitsuruog" target="_blank">@mitsuruog</a> All Rights Reserved.</div>' +
' </div>' +
'</div>' ),

initialize: function() {
this.$el.html(this.tmpl());
}

MyApp.Views.Footer = Backbone.View.extend({

tmpl: _.template(
'<div class="navbar navbar-inverse navbar-fixed-bottom">' +
' <div class="navbar-inner">' +
' <div class="container">Copyright (C) 2013 <a href="https://twitter.com/mitsuruog" target="_blank">@mitsuruog</a> All Rights Reserved.</div>' +
' </div>' +
'</div>' ),

initialize: function() {
this.$el.html(this.tmpl());
}

});
File renamed without changes.
File renamed without changes.
62 changes: 31 additions & 31 deletions app/js/views/search_results.js → js/views/search_results.js
@@ -1,32 +1,32 @@
MyApp.Views.SearchResults = Backbone.View.extend({

initialize: function (options) {

_.bindAll(this);

this.collections = options.collections;
this.tmpl = options.tmpl;
this.service = options.service;

MyApp.Mediator.on('search:add:' + this.service + ' search:history:' + this.service, this.search);

this.collections.on('reset', this.render);
},

search: function (search) {

this.collections.search(search);

},

render: function () {

this.$el.html(this.tmpl({
models: this.collections.toJSON()
}));

MyApp.Mediator.trigger('select:tab', this.$el.data('service'));

}

MyApp.Views.SearchResults = Backbone.View.extend({

initialize: function (options) {

_.bindAll(this);

this.collections = options.collections;
this.tmpl = options.tmpl;
this.service = options.service;

MyApp.Mediator.on('search:add:' + this.service + ' search:history:' + this.service, this.search);

this.collections.on('reset', this.render);
},

search: function (search) {

this.collections.search(search);

},

render: function () {

this.$el.html(this.tmpl({
models: this.collections.toJSON()
}));

MyApp.Mediator.trigger('select:tab', this.$el.data('service'));

}

});
File renamed without changes.

0 comments on commit 8100309

Please sign in to comment.