Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hglattergotz committed Jan 25, 2015
0 parents commit a2982c8
Show file tree
Hide file tree
Showing 52 changed files with 915 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "bower_components",
"analytics": false
}
33 changes: 33 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
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
/bower_components

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
32 changes: 32 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"predef": [
"document",
"window",
"-Promise"
],
"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
}
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
language: node_js

sudo: false

cache:
directories:
- node_modules

before_install:
- "npm config set spin false"
- "npm install -g npm@^2"

install:
- npm install -g bower
- npm install
- bower install

script:
- npm test
26 changes: 26 additions & 0 deletions Brocfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* global require, module */

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

var app = new EmberApp({
'ember-cli-bootswatch': {
theme: 'cerulean'
}
});

// 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.

app.import('bower_components/momentjs/moment.js');

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

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.

## Prerequisites

You will need the following things properly installed on your computer.

* [Git](http://git-scm.com/)
* [Node.js](http://nodejs.org/) (with NPM)
* [Bower](http://bower.io/)
* [Ember CLI](http://www.ember-cli.com/)
* [PhantomJS](http://phantomjs.org/)

## Installation

* `git clone <repository-url>` this repository
* change into the new directory
* `npm install`
* `bower install`

## Running / Development

* `ember server`
* Visit your app at [http://localhost:4200](http://localhost:4200).

### Code Generators

Make use of the many generators for code, try `ember help generate` for more details

### Running Tests

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

### Building

* `ember build` (development)
* `ember build --environment production` (production)

### Deploying

Specify what it takes to deploy your app.

## Further Reading / Useful Links

* [ember.js](http://emberjs.com/)
* [ember-cli](http://www.ember-cli.com/)
* Development Browser Extensions
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)

16 changes: 16 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

Ember.MODEL_FACTORY_INJECTIONS = true;

var App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
});

loadInitializers(App, config.modulePrefix);

export default App;
Empty file added app/components/.gitkeep
Empty file.
12 changes: 12 additions & 0 deletions app/components/link-li.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Ember from 'ember';

export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['active','disabled'],
active: function(){
return this.get('childViews').anyBy('active');
}.property('[email protected]'),
disabled: function(){
return this.get('childViews').everyBy('disabled');
}.property('[email protected]')
});
Empty file added app/controllers/.gitkeep
Empty file.
11 changes: 11 additions & 0 deletions app/controllers/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Ember from 'ember';

export default Ember.Controller.extend({
isEditing: false,
actions: {
edit: function() {
console.log('edit button clicked');
this.transitionToRoute('settings.edit');
}
}
});
28 changes: 28 additions & 0 deletions app/controllers/settings/edit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Ember from 'ember';

export default Ember.Controller.extend({
actions: {
editSave: function() {
var that = this;

if (this.get('model').get('isDirty')) {
console.log('model is dirty saving settings');
this.get('model').save().then(function() {
that.get('store').findAll('tweet').then(function(items) {
items.toArray().forEach(function(item){
item.unloadRecord();
});
});
that.transitionToRoute('settings');
});
} else {
console.log('model NOT dirty');
that.transitionToRoute('settings');
}
},
editCancel: function () {
this.get('model').rollback();
this.transitionToRoute('settings');
}
}
});
22 changes: 22 additions & 0 deletions app/controllers/tweets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Ember from 'ember';

export default Ember.ArrayController.extend({
sortProperties: ['id'],
sortAscending: false,
actions: {
onopen: function(socketEvent) {
console.log('On open has been called! type = ' + socketEvent.type);
},
onmessage: function(socketEvent) {
var tweet = JSON.parse(socketEvent.data);
console.log('Got tweet from ' + tweet.author);
this.store.push('tweet', tweet);
},
onclose: function(socketEvent) {
console.log('On close has been called! type = ' + socketEvent.type);
},
onerror: function(socketEvent) {
console.log('On error has been called! :-( type = ' + socketEvent.type);
}
}
});
Empty file added app/helpers/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions app/helpers/date-ago.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Ember from 'ember';

export function dateAgo(dateStr) {
var hintStr = "",
displayStr = "";

if (null === dateStr) {
hintStr = "The date is null";
displayStr = "unknown";
} else {
hintStr = moment(new Date(dateStr)).format("YYYY-MM-DD hh:mm:ss");
displayStr = moment(new Date(dateStr)).fromNow();
}

var result = "<time title=\"" + hintStr + "\">" + displayStr + "</time>";

return new Ember.Handlebars.SafeString(result);
}

export default Ember.Handlebars.makeBoundHelper(dateAgo);
25 changes: 25 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Ed</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for 'head'}}

<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/ed.css">

{{content-for 'head-footer'}}
</head>
<body>
{{content-for 'body'}}

<script src="assets/vendor.js"></script>
<script src="assets/ed.js"></script>

{{content-for 'body-footer'}}
</body>
</html>
Empty file added app/models/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions app/models/setting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import DS from 'ember-data';

var attr = DS.attr;

export default DS.Model.extend({
hashtag: attr('string')
});
11 changes: 11 additions & 0 deletions app/models/tweet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import DS from 'ember-data';

var attr = DS.attr;

export default DS.Model.extend({
author: attr('string'),
avatar: attr('string'),
body: attr('string'),
date: attr('date'),
screenname: attr('string')
});
15 changes: 15 additions & 0 deletions app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Ember from 'ember';
import config from './config/environment';

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

Router.map(function() {
this.resource('tweets', { path: '/tweets' });
this.resource('settings', { path: '/settings' }, function() {
this.route('edit');
});
});

export default Router;
Empty file added app/routes/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions app/routes/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Ember from 'ember';

export default Ember.Route.extend({
model: function () {
return this.store.find('setting', 1)
}
});
7 changes: 7 additions & 0 deletions app/routes/settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Ember from 'ember';

export default Ember.Route.extend({
model: function() {
return this.store.find('setting', 1);
}
});
Loading

0 comments on commit a2982c8

Please sign in to comment.