Skip to content

Commit

Permalink
Update ancient emberjs version and use ember-cli (#1582)
Browse files Browse the repository at this point in the history
Update to Ember 2.6
  • Loading branch information
cibernox authored and samccone committed Jun 10, 2016
1 parent 326e50c commit 8019b40
Show file tree
Hide file tree
Showing 63 changed files with 1,309 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"examples/aurelia/jspm_packages/**/*.js",
"examples/duel/www/**",
"examples/duel/src/main/webapp/js/lib/**",
"examples/ember-cli/todomvc/dist/**/*.js",
"examples/ember-cli/todomvc/testem.js",
"examples/ember-cli/assets/**/*.js",
"examples/humble/js/**",
"examples/js_of_ocaml/js/*.js",
"examples/polymer/elements/elements.build.js",
Expand Down
1 change: 1 addition & 0 deletions examples/ember-cli/assets
15 changes: 15 additions & 0 deletions examples/ember-cli/crossdomain.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->

<!-- Most restrictive policy: -->
<site-control permitted-cross-domain-policies="none"/>

<!-- Least restrictive policy: -->
<!--
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
-->
</cross-domain-policy>
1 change: 1 addition & 0 deletions examples/ember-cli/index.html
3 changes: 3 additions & 0 deletions examples/ember-cli/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# http://www.robotstxt.org
User-agent: *
Disallow:
4 changes: 4 additions & 0 deletions examples/ember-cli/todomvc/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "bower_components",
"analytics": false
}
34 changes: 34 additions & 0 deletions examples/ember-cli/todomvc/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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]
insert_final_newline = false
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 examples/ember-cli/todomvc/.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 examples/ember-cli/todomvc/.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 examples/ember-cli/todomvc/.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
}
22 changes: 22 additions & 0 deletions examples/ember-cli/todomvc/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
language: node_js
node_js:
- "4"

sudo: false

cache:
directories:
- node_modules

before_install:
- npm config set spin false
- npm install -g bower
- npm install phantomjs-prebuilt

install:
- npm install
- bower install

script:
- npm test
3 changes: 3 additions & 0 deletions examples/ember-cli/todomvc/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
15 changes: 15 additions & 0 deletions examples/ember-cli/todomvc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Ember.js TodoMVC Example using Ember CLI

> A framework for creating ambitious web applications.
> _[Ember.js - emberjs.com](http://emberjs.com)_
> _[Ember CLI - ember-cli.com](http://ember-cli.com)_
## Note for people updating this app.

The `index.html` and the `assets` folder in the parent folder as simlinks into the items with the
same names inside `dist`. The `dist` folder has to be checked in git and built for production.

To work on this comment `<base href="/examples/ember-cli/index.html" />` in the `app/index.html`
and uncommented it back before doing the production build.

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

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

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

loadInitializers(App, config.modulePrefix);

export default App;
Empty file.
49 changes: 49 additions & 0 deletions examples/ember-cli/todomvc/app/components/todo-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Ember from 'ember';

export default Ember.Component.extend({
repo: Ember.inject.service(),
tagName: 'li',
editing: false,
classNameBindings: ['todo.completed', 'editing'],

actions: {
startEditing() {
this.get('onStartEdit')();
this.set('editing', true);
Ember.run.scheduleOnce('afterRender', this, 'focusInput');
},

doneEditing(todoTitle) {
if (!this.get('editing')) { return; }
if (Ember.isBlank(todoTitle)) {
this.send('removeTodo');
} else {
this.set('todo.title', todoTitle.trim());
this.set('editing', false);
this.get('onEndEdit')();
}
},

handleKeydown(e) {
if (e.keyCode === 13) {
e.target.blur();
} else if (e.keyCode === 27) {
this.set('editing', false);
}
},

toggleCompleted(e) {
let todo = this.get('todo');
Ember.set(todo, 'completed', e.target.checked);
this.get('repo').persist();
},

removeTodo() {
this.get('repo').delete(this.get('todo'));
}
},

focusInput() {
this.element.querySelector('input.edit').focus();
}
});
27 changes: 27 additions & 0 deletions examples/ember-cli/todomvc/app/components/todo-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Ember from 'ember';

export default Ember.Component.extend({
repo: Ember.inject.service(),
tagName: 'section',
elementId: 'main',
canToggle: true,
allCompleted: Ember.computed('todos.@each.completed', function () {
return this.get('todos').isEvery('completed');
}),

actions: {
enableToggle() {
this.set('canToggle', true);
},

disableToggle() {
this.set('canToggle', false);
},

toggleAll() {
let allCompleted = this.get('allCompleted');
this.get('todos').forEach(todo => Ember.set(todo, 'completed', !allCompleted));
this.get('repo').persist();
}
}
});
5 changes: 5 additions & 0 deletions examples/ember-cli/todomvc/app/controllers/active.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from 'ember';

export default Ember.Controller.extend({
todos: Ember.computed.filterBy('model', 'completed', false)
});
20 changes: 20 additions & 0 deletions examples/ember-cli/todomvc/app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Ember from 'ember';

export default Ember.Controller.extend({
repo: Ember.inject.service(),
remaining: Ember.computed.filterBy('model', 'completed', false),
completed: Ember.computed.filterBy('model', 'completed'),
actions: {
createTodo(e) {
if (e.keyCode === 13 && !Ember.isBlank(e.target.value)) {
this.get('repo').add({ title: e.target.value.trim(), completed: false });
e.target.value = '';
}
},

clearCompleted() {
this.get('model').removeObjects(this.get('completed'));
this.get('repo').persist();
}
}
});
5 changes: 5 additions & 0 deletions examples/ember-cli/todomvc/app/controllers/completed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from 'ember';

export default Ember.Controller.extend({
todos: Ember.computed.filterBy('model', 'completed', true)
});
7 changes: 7 additions & 0 deletions examples/ember-cli/todomvc/app/helpers/gt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Ember from 'ember';

export function gt([n1, n2]/*, hash*/) {
return n1 > n2;
}

export default Ember.Helper.helper(gt);
8 changes: 8 additions & 0 deletions examples/ember-cli/todomvc/app/helpers/pluralize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Ember from 'ember';
import { pluralize } from 'ember-inflector';

export function pluralizeHelper([singular, count]/*, hash*/) {
return count === 1 ? singular : pluralize(singular);
}

export default Ember.Helper.helper(pluralizeHelper);
25 changes: 25 additions & 0 deletions examples/ember-cli/todomvc/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>Todomvc</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/examples/ember-cli/index.html" />
{{content-for "head"}}

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

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

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

{{content-for "body-footer"}}
</body>
</html>
Empty file.
3 changes: 3 additions & 0 deletions examples/ember-cli/todomvc/app/resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Resolver from 'ember-resolver';

export default Resolver;
13 changes: 13 additions & 0 deletions examples/ember-cli/todomvc/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Ember from 'ember';
import config from './config/environment';

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

Router.map(function () {
this.route('active');
this.route('completed');
});

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

export default Ember.Route.extend({
repo: Ember.inject.service(),
model() {
return this.get('repo').findAll();
}
});
Loading

0 comments on commit 8019b40

Please sign in to comment.