forked from ariatemplates/hashspace-todomvc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(temporary) fix F8, F9, F10: checkboxes working other way around in C…
…hrome and IE This works around hashspace's gh issue 224: Instead of relying on `onChange`, each todo item has its own controller which observes the state of the checkbox and propagates it to the parent controller which then synchronizes the data (this can be further refactored).
- Loading branch information
Showing
4 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
architecture-examples/hashspace/js/controllers/todoitemctrl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
/* | ||
* Copyright 2014 Amadeus s.a.s. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
(function () { | ||
'use strict'; | ||
|
||
var klass = require("hsp/klass"); | ||
|
||
exports.TodoItemCtrl = klass({ | ||
$init : function () { | ||
this.todo.controller = this; | ||
}, | ||
attributes: { | ||
"todo" : { type: "object" }, | ||
"parentCtrl" : { type: "object" }, | ||
"completed" : { type: "boolean", defaultValue: false, binding: "2-way" } | ||
}, | ||
onCompletedChange : function (newVal, oldVal) { | ||
this.todo.completed = newVal; | ||
this.parentCtrl.syncData(); | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters