Commit 1c2abb79 authored by Arthur Verschaeve's avatar Arthur Verschaeve Committed by Sindre Sorhus

Close #1292 PR: Componentjs: Minor cleanup.

parent 9c6ae435
/* global cs, app, Router, $, _ */
/* global cs, app, Router, $ */
(function () {
'use strict';
......
......@@ -50,8 +50,7 @@
cs(self).value('data:status-items-remaining', remaining);
if (remaining === 0 && completed > 0) {
cs(self).value('state:all-item-selected', true);
}
else if (remaining > 0) {
} else if (remaining > 0) {
cs(self).value('state:all-item-selected', false);
}
}
......
......@@ -63,8 +63,7 @@
if (items.length === 0) {
$('.todo__main', ui).addClass('hidden');
$('.todo__footer', ui).addClass('hidden');
}
else {
} else {
$('.todo__main', ui).removeClass('hidden');
$('.todo__footer', ui).removeClass('hidden');
}
......@@ -79,7 +78,7 @@
// one-way bind key-press and field blur interactions to leave editing mode
var blur = function (el, takeTitle) {
var id = $(el).parent().data('id') + '';
var id = String($(el).parent().data('id'));
$(el).parent().removeClass('editing');
if (takeTitle) {
var items = cs(self).value('data:item-list');
......@@ -109,7 +108,7 @@
// one-way bind click interaction to toggle item completion
$('.todo__toggle', ui).click(function (ev) {
var id = $(ev.target).parent().parent().data('id') + '';
var id = String($(ev.target).parent().parent().data('id'));
var items = cs(self).value('data:item-list');
var item = _.find(items, { id: id });
item.completed = !item.completed;
......@@ -119,7 +118,7 @@
// one-way bind click interaction to remove item
$('.todo__destroy', ui).click(function (ev) {
var id = $(ev.target).parent().parent().data('id') + '';
var id = String($(ev.target).parent().parent().data('id'));
var items = cs(self).value('data:item-list');
var item = _.find(items, { id: id });
cs(self).value('data:item-list', _.without(items, item));
......@@ -167,8 +166,7 @@
if (value > 0) {
$('.todo__completed', ui).css('display', 'block');
$('*[data-bind=\'data:status-items-completed\']', ui).text(value);
}
else {
} else {
$('.todo__completed', ui).css('display', 'none');
}
}
......
<!doctype html>
<html lang="en" data-framework="componentjs">
<head>
<meta charset="utf-8">
<title>ComponentJS • TodoMVC</title>
<!-- load third-party libraries -->
<script src="bower_components/lodash/dist/lodash.js"></script>
<script src="bower_components/uuid-js/lib/uuid.js"></script>
<script src="bower_components/nunjucks/browser/nunjucks.js"></script>
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/jquery-markup/jquery.markup.js"></script>
<script src="bower_components/director/build/director.js"></script>
<script src="bower_components/componentjs/component.js"></script>
<script src="bower_components/componentjs/component.plugin.jquery.js"></script>
<!-- load and call application initialization code -->
<script src="app/app.js"></script>
<script type="text/javascript">app.boot.init()</script>
<!-- load the service and datamodel parts -->
<script src="app/app-dm.js"></script>
<script src="app/app-sv.js"></script>
<!-- load the root UI component -->
<script src="app/app-ui-constants.js"></script>
<script src="app/app-ui-composite-root.js"></script>
<link href="app/app-ui-composite-root-style.css" rel="stylesheet" type="text/css">
<!-- load the main UI component -->
<script src="app/app-ui-composite-main.js"></script>
<link href="app/app-ui-composite-main-mask.html" rel="markup" type="text/x-markup-nunjucks">
<link href="app/app-ui-composite-main-style.css" rel="stylesheet" type="text/css">
<!-- load the todo UI component -->
<script src="app/app-ui-widget-todo-view.js"></script>
<script src="app/app-ui-widget-todo-model.js"></script>
<link href="app/app-ui-widget-todo-mask.html" rel="markup" type="text/x-markup-nunjucks">
<link href="app/app-ui-widget-todo-style.css" rel="stylesheet" type="text/css">
<!-- load required todomvc.com integration functions -->
<link href="bower_components/todomvc-common/base.css" rel="stylesheet" type="text/css">
<script src="bower_components/todomvc-common/base.js"></script>
<!-- call application main code -->
<script type="text/javascript">app.boot.main()</script>
</head>
<body>
</body>
<head>
<meta charset="utf-8">
<title>ComponentJS • TodoMVC</title>
<!-- load third-party libraries -->
<script src="bower_components/lodash/dist/lodash.js"></script>
<script src="bower_components/uuid-js/lib/uuid.js"></script>
<script src="bower_components/nunjucks/browser/nunjucks.js"></script>
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/jquery-markup/jquery.markup.js"></script>
<script src="bower_components/director/build/director.js"></script>
<script src="bower_components/componentjs/component.js"></script>
<script src="bower_components/componentjs/component.plugin.jquery.js"></script>
<!-- load and call application initialization code -->
<script src="app/app.js"></script>
<script>app.boot.init()</script>
<!-- load the service and datamodel parts -->
<script src="app/app-dm.js"></script>
<script src="app/app-sv.js"></script>
<!-- load the root UI component -->
<script src="app/app-ui-constants.js"></script>
<script src="app/app-ui-composite-root.js"></script>
<link href="app/app-ui-composite-root-style.css" rel="stylesheet">
<!-- load the main UI component -->
<script src="app/app-ui-composite-main.js"></script>
<link href="app/app-ui-composite-main-mask.html" rel="markup" type="text/x-markup-nunjucks">
<link href="app/app-ui-composite-main-style.css" rel="stylesheet">
<!-- load the todo UI component -->
<script src="app/app-ui-widget-todo-view.js"></script>
<script src="app/app-ui-widget-todo-model.js"></script>
<link href="app/app-ui-widget-todo-mask.html" rel="markup" type="text/x-markup-nunjucks">
<link href="app/app-ui-widget-todo-style.css" rel="stylesheet">
<!-- load required todomvc.com integration functions -->
<link href="bower_components/todomvc-common/base.css" rel="stylesheet">
<script src="bower_components/todomvc-common/base.js"></script>
<!-- call application main code -->
<script>app.boot.main()</script>
</head>
<body>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment