Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwdunlop committed May 16, 2013
0 parents commit c2bdc43
Show file tree
Hide file tree
Showing 122 changed files with 40,053 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3'

gem 'handlebars_assets'

end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

Empty file added README.md
Empty file.
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Blog::Application.load_tasks
Binary file added app/assets/images/rails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require handlebars
//= require ember-latest
//= require ember-data-latest
//= require_self
//= require blog

window.App = Ember.Application.create({
LOG_TRANSITIONS: true
});
23 changes: 23 additions & 0 deletions app/assets/javascripts/application.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require handlebars
//= require ember-latest
//= require ember-data-latset
//= require_self
//= require blog

window.App = Ember.Application.create({
LOG_TRANSITIONS: true
});
8 changes: 8 additions & 0 deletions app/assets/javascripts/blog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//= require ./store
//= require_tree ./models
//= require_tree ./controllers
//= require_tree ./views
//= require_tree ./helpers
//= require_tree ./templates
//= require ./router
//= require_self
Empty file.
11 changes: 11 additions & 0 deletions app/assets/javascripts/controllers/commentsNewController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
App.CommentsNewController=Ember.ObjectController.extend({
needs: 'post',
text: null,

save: function() {
var post = this.get('controllers.post.content');
var comment = App.Comment.createRecord({ post: post, text: this.get('text') });
comment.get("store").commit();
this.get('target').transitionTo('post.index');
}
});
11 changes: 11 additions & 0 deletions app/assets/javascripts/controllers/commentsNewController.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
App.CommentsNewController=Ember.ObjectController.extend({
needs: 'post',
text: null,

save: function() {
var post = this.get('controllers.post.content');
App.Comment.createRecord({ post: post, text: this.get('text') });
App.Store.commit();
this.get('target').transitionTo('post.index');
}
});
3 changes: 3 additions & 0 deletions app/assets/javascripts/controllers/postsController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//App.PostsController=Ember.ArrayController.extend({
//
//});
3 changes: 3 additions & 0 deletions app/assets/javascripts/controllers/postsController.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
App.PostsController=Ember.ArrayController.extend({

});
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions app/assets/javascripts/models/comment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
App.Comment = DS.Model.extend({
post: DS.belongsTo('App.Post'),
text: DS.attr('string')
});
4 changes: 4 additions & 0 deletions app/assets/javascripts/models/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
App.Post=DS.Model.extend({
comments: DS.hasMany('App.Comment'),
title: DS.attr('string')
});
4 changes: 4 additions & 0 deletions app/assets/javascripts/models/post.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
App.Post=DS.Model.extend({
comments: DS.hasMany('App.Comment'),
title: DS.attr('string')
});
26 changes: 26 additions & 0 deletions app/assets/javascripts/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
App.Router.map(function() {
this.resource('posts');
this.resource('post', { path: '/posts/:post_id' }, function() {
this.resource('comments', function() {
this.route('new');
});
this.route('comment', { path: 'comments/:comment_id'});
});
});
App.PostsRoute=Ember.Route.extend({
model: function(){
return App.Post.find();
}
});

App.PostIndexRoute=Ember.Route.extend({
model: function(params) {
return this.modelFor('post');
}
});

App.CommentsNewRoute=Ember.Route.extend({
setupController: function(controller, model) {
controller.set('text', null);
}
});
26 changes: 26 additions & 0 deletions app/assets/javascripts/router.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
App.Router.map(function() {
this.resource('posts');
this.resource('post', { path: '/posts/:post_id' }, function() {
// this.resource('comments', function() {
// this.route('new');
});
// this.route('comment', { path: 'comments/:comment_id'});
//});
});
App.PostsRoute=Ember.Route.extend({
model: function(){
return App.Post.find();
}
});

App.PostIndexRoute=Ember.Route.extend({
model: function(params) {
return this.modelFor('post');
}
});

App.CommentsNewRoute=Ember.Route.extend({
setupController: function(controller, model) {
controller.set('text', null);
}
});
6 changes: 6 additions & 0 deletions app/assets/javascripts/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
App.Store = DS.Store.extend({
revision: 12,
adapter: DS.RESTAdapter.create({
bulkCommit: false
})
});
10 changes: 10 additions & 0 deletions app/assets/javascripts/store.js~
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
App.Store = DS.Store.extend({
revision: 12,
adapter: DS.RESTAdapter.create({
bulkCommit: false
})
});

//DS.RESTAdapter.map('App.Post', {
// comments: { embedded: 'always' }
//});
Empty file.
11 changes: 11 additions & 0 deletions app/assets/javascripts/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<body>
<header>
<h1>Blog</h1>
</header>
<div>
{{outlet}}
</div>
<footer>
&copy;2013 Ian Dunlop.
</footer>
</body>
3 changes: 3 additions & 0 deletions app/assets/javascripts/templates/comments.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script type="text/x-handlebars" data-template-name="comments">
{{outlet}}
</script>
4 changes: 4 additions & 0 deletions app/assets/javascripts/templates/comments/new.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<form {{action save on='submit'}}>
{{view Ember.TextArea valueBinding="text" placeholder="Enter comment here"}}
<button type="submit">Create Comment</button>
</form>
6 changes: 6 additions & 0 deletions app/assets/javascripts/templates/comments/new.hbs~
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script type="text/x-handlebars" data-template-name="comments/new">
<form {{action save on='submit'}}>
{{view Ember.TextArea valueBinding="text" placeholder="Enter comment here"}}
<button type="submit">Create Comment</button>
</form>
</script>
1 change: 1 addition & 0 deletions app/assets/javascripts/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{#linkTo posts}}Posts{{/linkTo}}
2 changes: 2 additions & 0 deletions app/assets/javascripts/templates/post.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

{{outlet}}
3 changes: 3 additions & 0 deletions app/assets/javascripts/templates/post.hbs~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script type="text/x-handlebars" data-template-name="post">
{{outlet}}
</script>
1 change: 1 addition & 0 deletions app/assets/javascripts/templates/post/comment.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{text}}
3 changes: 3 additions & 0 deletions app/assets/javascripts/templates/post/comment.hbs~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script type="text/x-handlebars" data-template-name="post/comment">
{{text}}
</script>
7 changes: 7 additions & 0 deletions app/assets/javascripts/templates/post/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{title}}
<ul>
{{#each comment in comments}}
<li>{{#linkTo post.comment comment}}{{comment.text}}{{/linkTo}}</li>
{{/each}}
</ul>
{{#linkTo comments.new}}New Comment{{/linkTo}}
2 changes: 2 additions & 0 deletions app/assets/javascripts/templates/post/index.hbs~
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{title}}

7 changes: 7 additions & 0 deletions app/assets/javascripts/templates/posts.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Posts
<ul>
{{#each controller}}
<li>{{#linkTo post this}}{{title}}{{/linkTo}}</li>
{{/each}}
</ul>

7 changes: 7 additions & 0 deletions app/assets/javascripts/templates/posts.hbs~
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Posts
<ul>
{{#each model}}
<li>{{#linkTo post this}}{{title}}{{/linkTo}}</li>
{{/each}}
</ul>

Empty file.
13 changes: 13 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/comments.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Comments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/posts.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Posts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
69 changes: 69 additions & 0 deletions app/assets/stylesheets/scaffolds.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
Loading

0 comments on commit c2bdc43

Please sign in to comment.