select words angepasst

This commit is contained in:
silas
2018-10-22 12:00:08 +02:00
parent 9dce968eec
commit 50526bc1ca
9 changed files with 17 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ return array(
'defaults' => [
'controller' => IndexController::class,
'action' => 'selectWords',
'resource' => 'admin',
'resource' => 'select-words',
],
],
],
@@ -28,7 +28,7 @@ return array(
'defaults' => [
'controller' => IndexController::class,
'action' => 'changeChecked',
'resource' => 'admin',
'resource' => 'select-words',
],
],
],

View File

@@ -4,7 +4,7 @@ import {DataManager} from "../../../../../js/lib/pwa-core";
export class DeleteWordsSite extends UserSite {
constructor(siteManager) {
super(siteManager, "version/1/html/deleteLevels.html", null, "admin");
super(siteManager, "version/2/html/deleteLevels.html", null, "admin");
}
async onConstruct(args) {

View File

@@ -5,13 +5,14 @@ import {DataManager} from "../../../../../js/lib/pwa-core";
export class SelectWordsSite extends UserSite{
constructor(siteManager) {
super(siteManager, "version/1/html/selectWords.html", null, "admin");
super(siteManager, "version/2/html/selectWords.html", null, "select-words");
}
async onConstruct(args) {
let res = await super.onConstruct(args);
this.stats = (await DataManager.load("words"))["result"];
this.words = this.stats["wordsToCheck"];
console.log(this.stats);
return res;
}
@@ -21,6 +22,7 @@ export class SelectWordsSite extends UserSite{
this.findBy("#checked").appendChild(document.createTextNode(this.stats["wordsChecked"]));
this.findBy("#not-sure").appendChild(document.createTextNode(this.stats["wordsUnsure"]));
this.findBy("#deleted").appendChild(document.createTextNode(this.stats["wordsDeleted"]));
this.findBy("#unused").appendChild(document.createTextNode(this.stats["wordsNotUsed"]));
let template = this.findBy("#word-template");
template.id = null;
@@ -62,7 +64,6 @@ export class SelectWordsSite extends UserSite{
}
setWord(wordElement, word){
console.log(wordElement, word);
wordElement.querySelector(".word").removeAllChildren().appendChild(document.createTextNode(word["word"]));
wordElement.dataset["id"] = word["id"];
}
@@ -71,5 +72,5 @@ export class SelectWordsSite extends UserSite{
InitPromise.addPromise(app => {
app.addDefaultAction(new UserAction("select-words", () => {
app.startSite(SelectWordsSite);
}, null, null, "admin"));
}, null, null, "select-words"));
});

View File

@@ -8,6 +8,8 @@
<div class="column small-6" id='not-sure'></div>
<div class="column small-6">Gelöscht:</div>
<div class="column small-6" id='deleted'></div>
<div class="column small-6">Unbenutzt:</div>
<div class="column small-6" id='unused'></div>
</div>
<br/><br/>
<div id="word-container">