Skip to content

Commit

Permalink
initial non-working commit
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Jul 24, 2014
0 parents commit 9a5e3a6
Show file tree
Hide file tree
Showing 40 changed files with 566 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "vendor"
}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/vendor/*

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
34 changes: 34 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"predef": {
"document": true,
"window": true,
"MyappENV": true,
"Showdown": true,
"moment": true
},
"browser" : true,
"boss" : true,
"curly": true,
"debug": false,
"devel": true,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esnext": true,
"unused": true
}
25 changes: 25 additions & 0 deletions Brocfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* global require, module */

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

var app = new EmberApp();

app.import('vendor/showdown/compressed/showdown.js');
app.import('vendor/showdown/compressed/extensions/github.js');
app.import('vendor/moment/moment.js');
app.import('vendor/bootstrap/dist/css/bootstrap.css');

// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.

module.exports = app.toTree();
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Myapp

This README outlines the details of collaborating on this Ember application.

## Installation

* `git clone` this repository
* `npm install`
* `bower install`

## Running

* `ember server`
* Visit your app at http://localhost:4200.

## Running Tests

* `ember test`
* `ember test --server`

## Building

* `ember build`

For more information on using ember-cli, visit [http://iamstef.net/ember-cli/](http://iamstef.net/ember-cli/).
2 changes: 2 additions & 0 deletions app/adapters/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import DS from "ember-data";
export default DS.FixtureAdapter.extend({});
14 changes: 14 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';

Ember.MODEL_FACTORY_INJECTIONS = true;

var App = Ember.Application.extend({
modulePrefix: 'myapp', // TODO: loaded via config
Resolver: Resolver
});

loadInitializers(App, 'myapp');

export default App;
Empty file added app/controllers/.gitkeep
Empty file.
13 changes: 13 additions & 0 deletions app/controllers/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Ember from "ember";
export default Ember.ObjectController.extend({
isEditing: false,

edit: function() {
this.set('isEditing', true);
},

doneEditing: function() {
this.set('isEditing', false);
this.get('store').commit();
}
});
Empty file added app/helpers/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions app/helpers/format-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Ember from "ember";
export default Ember.Handlebars.makeBoundHelper(function(value) {
return moment(value).fromNow();
});
5 changes: 5 additions & 0 deletions app/helpers/format-markdown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from "ember";
var showdown = new Showdown.converter();
export default Ember.Handlebars.makeBoundHelper(function(value) {
return new Ember.Handlebars.SafeString(showdown.makeHtml(value));
});
26 changes: 26 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Myapp</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{BASE_TAG}}

<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/myapp.css">
</head>
<body>
<script>
window.MyappENV = {{ENV}};
window.EmberENV = window.MyappENV.EmberENV;
</script>
<script src="assets/vendor.js"></script>
<script src="assets/myapp.js"></script>
<script>
window.Myapp = require('myapp/app')['default'].create(MyappENV.APP);
</script>
</body>
</html>
Empty file added app/models/.gitkeep
Empty file.
32 changes: 32 additions & 0 deletions app/models/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import DS from "ember-data";

var Post = DS.Model.extend({
title: DS.attr('string'),
author: {
name: DS.attr('string')
},
date: DS.attr('date'),
excerpt: DS.attr('string'),
body: DS.attr('string')
});


Post.reopenClass({
FIXTURES: [{
id: '1',
title: "Rails is Omakase",
author: { name: "d2h" },
date: new Date('12-27-2012'),
excerpt: "There are lots of à la carte software environments in this world. Places where in order to eat, you must first carefully look over the menu of options to order exactly what you want.",
body: "I want this for my ORM, I want that for my template language, and let's finish it off with this routing library. Of course, you're going to have to know what you want, and you'll rarely have your horizon expanded if you always order the same thing, but there it is. It's a very popular way of consuming software.\n\nRails is not that. Rails is omakase."
}, {
id: '2',
title: "The Parley Letter",
author: { name: "d2h" },
date: new Date('12-24-2012'),
excerpt: "My [appearance on the Ruby Rogues podcast](http://rubyrogues.com/056-rr-david-heinemeier-hansson/) recently came up for discussion again on the private Parley mailing list.",
body: "A long list of topics were raised and I took a time to ramble at large about all of them at once. Apologies for not taking the time to be more succinct, but at least each topic has a header so you can skip stuff you don't care about.\n\n### Maintainability\n\nIt's simply not true to say that I don't care about maintainability. I still work on the oldest Rails app in the world."
}]
});

export default Post;
14 changes: 14 additions & 0 deletions app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Ember from 'ember';

var Router = Ember.Router.extend({
location: MyappENV.locationType
});

Router.map(function() {
this.resource('about');
this.resource('posts', function() {
this.resource('post', { path: ':post_id' });
});
});

export default Router;
Empty file added app/routes/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions app/routes/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Ember from "ember";
import Post from "myapp/models/post";
export default Ember.Route.extend({
model: function(params) {
return Post.findBy('id', params.post_id);
}
});
7 changes: 7 additions & 0 deletions app/routes/posts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Ember from "ember";
import Post from "myapp/models/post";
export default Ember.Route.extend({
model: function() {
return Post.all();
}
});
Empty file added app/styles/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions app/styles/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
html, body {
margin: 20px;
}
Empty file added app/templates/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions app/templates/about.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class='about'>
<p>Yehuda Katz is a member of the <a href="http://emberjs.com">Ember.js</a>, <a href="http://rubyonrails.org">Ruby on Rails</a>
and <a href="http://www.jquery.com">jQuery</a> Core Teams; he spends his daytime hours at the startup he founded,
<a href="http://www.tilde.io">Tilde Inc.</a>.</p>
<p>Yehuda is co-author of best-selling <a href="http://affiliate.manning.com/idevaffiliate.php?id=485_176">jQuery in Action</a> and
<a href="http://affiliate.manning.com/idevaffiliate.php?id=485_145">Rails 3 in Action</a>.</p>
<p>He spends most of his time hacking on open source—his main projects, along with others, like <a href="https://github.com/wycats/thor">Thor</a>,
<a href="http://www.handlebarsjs.com">Handlebars</a> and <a href="https://github.com/carlhuda/janus">Janus</a>—or traveling the world doing evangelism work.</p>
<p>He can be found on Twitter as <a href="http://www.twitter.com/wycats">@wycats</a>.</p>
</div>

<div class='about'>
<p>My name is Tom Dale. I helped create <a href="http://www.emberjs.com/">Ember.js</a>, a JavaScript framework that brings sanity to the web.</p>

<p>In October of 2011, I co-founded <a href="http://www.tilde.io">Tilde</a> with Yehuda Katz, Leah Silber and Carl Lerche.</p>

<p>In my spare time I run a cash-for-beer exchange program at many local San Francisco dive bars.</p>
</div>
13 changes: 13 additions & 0 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<h1 id='title'>Welcome to Ember.js</h1>

<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Bloggr</a>
<ul class="nav">
<li>{{#link-to 'posts'}}Posts{{/link-to}}</li>
<li>{{#link-to 'about'}}About{{/link-to}}</li>
</ul>
</div>
</div>

{{outlet}}
3 changes: 3 additions & 0 deletions app/templates/post-edit.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>{{input type="text" value=title}}</p>
<p>{{input type="text" value=excerpt}}</p>
<p>{{textarea value=body}}</p>
19 changes: 19 additions & 0 deletions app/templates/post.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{#if isEditing}}
{{partial 'post-edit'}}
<button {{action 'doneEditing'}}>Done</button>
{{else}}
<button {{action 'edit'}}>Edit</button>
{{/if}}

<h1>{{title}}</h1>
<h2>by {{author.name}} <small class='muted'>({{format-date date}})</small></h2>

<hr>

<div class='intro'>
{{format-markdown excerpt}}
</div>

<div class='below-the-fold'>
{{format-markdown body}}
</div>
1 change: 1 addition & 0 deletions app/templates/posts-index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p class="text-warning">Please select a post</p>
19 changes: 19 additions & 0 deletions app/templates/posts.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<table class='table'>
<thead>
<tr><th>Recent Posts</th></tr>
</thead>
{{#each model}}
<tr><td>
{{#link-to 'post' this}}{{title}} <small class='muted'>by {{author.name}}</small>{{/link-to}}
</td></tr>
{{/each}}
</table>
</div>
<div class="span9">
{{outlet}}
</div>
</div>
</div>
Empty file added app/views/.gitkeep
Empty file.
19 changes: 19 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "myapp",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"qunit": "~1.12.0",
"ember-qunit": "~0.1.5",
"ember": "1.5.1",
"ember-resolver": "~0.1.1",
"loader": "stefanpenner/loader.js#1.0.0",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.2",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit-notifications": "^0.0.3",
"ember-cli-test-loader": "rjackson/ember-cli-test-loader#0.0.2",
"moment": "~2.7.0",
"showdown": "~0.3.1",
"bootstrap": "~3.2.0"
}
}
38 changes: 38 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* jshint node: true */

module.exports = function(environment) {
var ENV = {
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};

if (environment === 'development') {
// LOG_MODULE_RESOLVER is needed for pre-1.6.0
ENV.LOG_MODULE_RESOLVER = true;

ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
ENV.APP.LOG_MODULE_RESOLVER = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
}

if (environment === 'production') {

}

return ENV;
};
Loading

0 comments on commit 9a5e3a6

Please sign in to comment.