Skip to content

Commit

Permalink
Update the ember example (tastejs#1948)
Browse files Browse the repository at this point in the history
Update ember to the 3.4 LTS
Update to the latest TodoMVC template to make the info sidebar appear
  • Loading branch information
Windvis authored and FadySamirSadek committed Nov 21, 2018
1 parent 1a4941c commit 94ff67e
Show file tree
Hide file tree
Showing 22 changed files with 3,571 additions and 2,941 deletions.
2 changes: 2 additions & 0 deletions examples/emberjs/todomvc/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
1 change: 1 addition & 0 deletions examples/emberjs/todomvc/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
// node files
{
files: [
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
Expand Down
5 changes: 5 additions & 0 deletions examples/emberjs/todomvc/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended'
};
1 change: 1 addition & 0 deletions examples/emberjs/todomvc/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ before_install:
- npm config set spin false

script:
- npm run lint:hbs
- npm run lint:js
- npm test
2 changes: 1 addition & 1 deletion examples/emberjs/todomvc/app/components/todo-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Component from '@ember/component';
export default Component.extend({
repo: service(),
tagName: 'section',
elementId: 'main',
classNames: ['main'],
canToggle: true,
allCompleted: computed('todos.@each.completed', function () {
return this.todos.isEvery('completed');
Expand Down
8 changes: 3 additions & 5 deletions examples/emberjs/todomvc/app/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<!DOCTYPE html>
<html>
<!doctype html>
<html language="en" data-framework="emberjs">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Ember TodoMVC</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ember • TodoMVC</title>

{{content-for "head"}}

Expand Down
41 changes: 23 additions & 18 deletions examples/emberjs/todomvc/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<section id="todoapp">
<header id="header">
<section class="todoapp">
<header class="header">
<h1>todos</h1>
<input type="text" id="new-todo" onkeydown={{action 'createTodo'}} placeholder="What needs to be done?" autofocus>
<input
class="new-todo"
onkeydown={{action "createTodo"}}
placeholder="What needs to be done?"
autofocus
>
</header>
{{outlet}}
{{#if (gt model.length 0)}}
<footer id="footer">
<span id="todo-count"><strong>{{remaining.length}}</strong> {{pluralize 'item' remaining.length}} left</span>
<ul id="filters">
<li>{{#link-to "index" activeClass="selected"}}All{{/link-to}}</li>
<li>{{#link-to "active" activeClass="selected"}}Active{{/link-to}}</li>
<li>{{#link-to "completed" activeClass="selected"}}Completed{{/link-to}}</li>
</ul>
{{#if completed.length}}
<button id="clear-completed" onclick={{action 'clearCompleted'}}>Clear completed</button>
{{/if}}
</footer>
{{/if}}
{{outlet}}
{{#if (gt model.length 0)}}
<footer class="footer">
<span class="todo-count"><strong>{{remaining.length}}</strong> {{pluralize "item" remaining.length}} left</span>
<ul class="filters">
<li>{{#link-to "index" activeClass="selected"}}All{{/link-to}}</li>
<li>{{#link-to "active" activeClass="selected"}}Active{{/link-to}}</li>
<li>{{#link-to "completed" activeClass="selected"}}Completed{{/link-to}}</li>
</ul>
{{#if completed.length}}
<button class="clear-completed" onclick={{action "clearCompleted"}}>Clear completed</button>
{{/if}}
</footer>
{{/if}}
</section>
<footer id="info">
<footer class="info">
<p>Double-click to edit a todo</p>
<p>
Created by
Expand Down
19 changes: 15 additions & 4 deletions examples/emberjs/todomvc/app/templates/components/todo-item.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<div class="view">
<input type="checkbox" class="toggle" checked={{todo.completed}} onchange={{action 'toggleCompleted'}}>
<label ondblclick={{action 'startEditing'}}>{{todo.title}}</label>
<button onclick={{action 'removeTodo'}} class="destroy"></button>
<input
class="toggle"
type="checkbox"
checked={{todo.completed}}
onchange={{action "toggleCompleted"}}
>
<label ondblclick={{action "startEditing"}}>{{todo.title}}</label>
<button class="destroy" onclick={{action "removeTodo"}}></button>
</div>
<input type="text" class="edit" value={{todo.title}} onblur={{action 'doneEditing' value='target.value'}} onkeydown={{action 'handleKeydown'}} autofocus>
<input
class="edit"
value={{todo.title}}
onblur={{action "doneEditing" value="target.value"}}
onkeydown={{action "handleKeydown"}}
autofocus
>
17 changes: 14 additions & 3 deletions examples/emberjs/todomvc/app/templates/components/todo-list.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
{{#if todos.length}}
{{#if canToggle}}
<input type="checkbox" id="toggle-all" checked={{allCompleted}} onchange={{action 'toggleAll'}}>
<input
id="toggle-all"
class="toggle-all"
type="checkbox"
checked={{allCompleted}}
onchange={{action "toggleAll"}}
>
<label for="toggle-all">Mark all as complete</label>
{{/if}}
<ul id="todo-list" class="todo-list">
<ul class="todo-list">
{{#each todos as |todo|}}
{{todo-item todo=todo onStartEdit=(action 'disableToggle') onEndEdit=(action 'enableToggle')}}
{{todo-item
todo=todo
onStartEdit=(action "disableToggle")
onEndEdit=(action "enableToggle")
}}
{{/each}}
</ul>
{{/if}}
3 changes: 3 additions & 0 deletions examples/emberjs/todomvc/config/optional-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"jquery-integration": true
}

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 94ff67e

Please sign in to comment.