Commit 51c5e5aa authored by Curtis Adam's avatar Curtis Adam

Update the keyCode events for the Editor view

parent 7959f441
......@@ -47,8 +47,8 @@ export let CardEditor = class CardEditor {
}
static setLearningGoalLevel (forward = true) {
let navigationLength = $('#learningGoalLevelGroup:first label').length;
let index = ($(".active").index("#learningGoalLevelGroup:first label")) + 1;
let navigationLength = $('#learningGoalLevelGroup:first button').length;
let index = ($(".active").index("#learningGoalLevelGroup:first button")) + 1;
if (forward) {
if (index >= navigationLength) {
index = 1;
......
......@@ -297,7 +297,11 @@ export let CardNavigation = class CardNavigation {
keyCodes = [9];
}
if (Route.isEditMode()) {
keyCodes = [9, 37, 39];
if ($('.learningGoalLevelButton').is(":focus")) {
keyCodes = [9, 37, 39];
} else {
keyCodes = [9];
}
}
if (Route.isDemo()) {
keyCodes = [9, 32, 37, 38, 39, 40];
......@@ -329,9 +333,7 @@ export let CardNavigation = class CardNavigation {
break;
case 37:
if (Route.isEditMode() && !CardVisuals.isFullscreen()) {
if (CardEditor.getEditorButtons()[CardEditor.getEditorButtonIndex() - 1] === CardEditor.getLearningGoalLevelGroupName()) {
CardEditor.setLearningGoalLevel(false);
}
CardEditor.setLearningGoalLevel(false);
} else {
if (CardNavigation.isVisible()) {
if ($('#leftCarouselControl').click()) {
......@@ -350,9 +352,7 @@ export let CardNavigation = class CardNavigation {
break;
case 39:
if (Route.isEditMode() && !CardVisuals.isFullscreen()) {
if (CardEditor.getEditorButtons()[CardEditor.getEditorButtonIndex() - 1] === CardEditor.getLearningGoalLevelGroupName()) {
CardEditor.setLearningGoalLevel();
}
CardEditor.setLearningGoalLevel();
} else {
if (CardNavigation.isVisible()) {
if ($('#rightCarouselControl').click()) {
......
<template name="learningGoalLevel">
<div id="learningGoalLevelGroup" class="form-group btn-group col-xs-12" role="group" data-toggle="buttons">
<label id="learningGoalLevel0"
class="col-xs-6 col-sm-2 btn btn-raised {{#if isLearningGoalLevelChecked
<button id="learningGoalLevel0"
class="col-xs-6 col-sm-2 learningGoalLevelButton btn btn-raised {{#if isLearningGoalLevelChecked
0}}btn-primary{{else}}btn-white{{/if}} {{#if
isLearningGoalLevel 0}}active{{/if}}"
data-lvl="0">
......@@ -11,9 +11,9 @@
<input type="radio" name="learningGoalLevel" value="0" data-lvl="0">
{{/if}}
{{_ "learning-goal.level1"}}
</label>
<label id="learningGoalLevel1"
class="col-xs-6 col-sm-2 btn btn-raised {{#if isLearningGoalLevelChecked
</button>
<button id="learningGoalLevel1"
class="col-xs-6 col-sm-2 learningGoalLevelButton btn btn-raised {{#if isLearningGoalLevelChecked
1}}btn-primary{{else}}btn-white{{/if}} {{#if
isLearningGoalLevel 1}}active{{/if}}"
data-lvl="1">
......@@ -23,9 +23,9 @@
<input type="radio" name="learningGoalLevel" value="1" data-lvl="1">
{{/if}}
{{_ "learning-goal.level2"}}
</label>
<label id="learningGoalLevel2"
class="col-xs-6 col-sm-2 btn btn-raised {{#if isLearningGoalLevelChecked
</button>
<button id="learningGoalLevel2"
class="col-xs-6 col-sm-2 learningGoalLevelButton btn btn-raised {{#if isLearningGoalLevelChecked
2}}btn-primary{{else}}btn-white{{/if}} {{#if
isLearningGoalLevel 2}}active{{/if}}"
data-lvl="2">
......@@ -35,9 +35,9 @@
<input type="radio" name="learningGoalLevel" value="2" data-lvl="2">
{{/if}}
{{_ "learning-goal.level3"}}
</label>
<label id="learningGoalLevel3"
class="col-xs-6 col-sm-2 btn btn-raised {{#if isLearningGoalLevelChecked
</button>
<button id="learningGoalLevel3"
class="col-xs-6 col-sm-2 learningGoalLevelButton btn btn-raised {{#if isLearningGoalLevelChecked
3}}btn-primary{{else}}btn-white{{/if}} {{#if
isLearningGoalLevel 3}}active{{/if}}"
data-lvl="3">
......@@ -47,9 +47,9 @@
<input type="radio" name="learningGoalLevel" value="3" data-lvl="3">
{{/if}}
{{_ "learning-goal.level4"}}
</label>
<label id="learningGoalLevel4"
class="col-xs-6 col-sm-2 btn btn-raised {{#if isLearningGoalLevelChecked
</button>
<button id="learningGoalLevel4"
class="col-xs-6 col-sm-2 learningGoalLevelButton btn btn-raised {{#if isLearningGoalLevelChecked
4}}btn-primary{{else}}btn-white{{/if}} {{#if
isLearningGoalLevel 4}}active{{/if}}"
data-lvl="4">
......@@ -59,9 +59,9 @@
<input type="radio" name="learningGoalLevel" value="4" data-lvl="4">
{{/if}}
{{_ "learning-goal.level5"}}
</label>
<label id="learningGoalLevel5"
class="col-xs-6 col-sm-2 btn btn-raised {{#if isLearningGoalLevelChecked
</button>
<button id="learningGoalLevel5"
class="col-xs-6 col-sm-2 learningGoalLevelButton btn btn-raised {{#if isLearningGoalLevelChecked
5}}btn-primary{{else}}btn-white{{/if}} {{#if
isLearningGoalLevel 5}}active{{/if}}"
data-lvl="5">
......@@ -71,7 +71,7 @@
<input type="radio" name="learningGoalLevel" value="5" data-lvl="5">
{{/if}}
{{_ "learning-goal.level6"}}
</label>
</button>
</div>
</template>
......
......@@ -3913,6 +3913,7 @@
"version": "0.0.9",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"inherits": "~2.0.0"
}
......@@ -3937,7 +3938,8 @@
"buffer-shims": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"caseless": {
"version": "0.12.0",
......@@ -3954,12 +3956,14 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"combined-stream": {
"version": "1.0.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"delayed-stream": "~1.0.0"
}
......@@ -3972,17 +3976,20 @@
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"cryptiles": {
"version": "2.0.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"boom": "2.x.x"
}
......@@ -4022,7 +4029,8 @@
"delayed-stream": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"delegates": {
"version": "1.0.0",
......@@ -4054,7 +4062,8 @@
"extsprintf": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"forever-agent": {
"version": "0.6.1",
......@@ -4177,6 +4186,7 @@
"version": "3.1.3",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"boom": "2.x.x",
"cryptiles": "2.x.x",
......@@ -4224,6 +4234,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -4237,7 +4248,8 @@
"isarray": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"isstream": {
"version": "0.1.2",
......@@ -4310,12 +4322,14 @@
"mime-db": {
"version": "1.27.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"mime-types": {
"version": "2.1.15",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"mime-db": "~1.27.0"
}
......@@ -4391,7 +4405,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"oauth-sign": {
"version": "0.8.2",
......@@ -4449,7 +4464,8 @@
"process-nextick-args": {
"version": "1.0.7",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"punycode": {
"version": "1.4.1",
......@@ -4487,6 +4503,7 @@
"version": "2.2.9",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"buffer-shims": "~1.0.0",
"core-util-is": "~1.0.0",
......@@ -4538,7 +4555,8 @@
"safe-buffer": {
"version": "5.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"semver": {
"version": "5.3.0",
......@@ -4562,6 +4580,7 @@
"version": "1.0.9",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"hoek": "2.x.x"
}
......@@ -4595,6 +4614,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -4605,6 +4625,7 @@
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.0.1"
}
......@@ -4633,6 +4654,7 @@
"version": "2.2.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"block-stream": "*",
"fstream": "^1.0.2",
......@@ -4688,7 +4710,8 @@
"util-deprecate": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"uuid": {
"version": "3.0.1",
......@@ -4774,7 +4797,7 @@
},
"gherkin": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/gherkin/-/gherkin-4.0.0.tgz",
"resolved": "http://registry.npmjs.org/gherkin/-/gherkin-4.0.0.tgz",
"integrity": "sha1-edzgTRIj6kO0hip2vlzo+JwSwyw=",
"dev": true
},
......@@ -5573,18 +5596,6 @@
"hoek": "2.x.x",
"joi": "6.x.x",
"wreck": "5.x.x"
},
"dependencies": {
"wreck": {
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/wreck/-/wreck-5.6.1.tgz",
"integrity": "sha1-r/ADBAATiJ11YZtccYcN0qjdBpo=",
"dev": true,
"requires": {
"boom": "2.x.x",
"hoek": "2.x.x"
}
}
}
},
"heavy": {
......@@ -5596,20 +5607,6 @@
"boom": "2.x.x",
"hoek": "2.x.x",
"joi": "5.x.x"
},
"dependencies": {
"joi": {
"version": "5.1.0",
"resolved": "http://registry.npmjs.org/joi/-/joi-5.1.0.tgz",
"integrity": "sha1-FSrQfbjunGQBmX/1/SwSiWBwv1g=",
"dev": true,
"requires": {
"hoek": "^2.2.x",
"isemail": "1.x.x",
"moment": "2.x.x",
"topo": "1.x.x"
}
}
}
},
"hoek": {
......@@ -6457,12 +6454,6 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"isemail": {
"version": "1.2.0",
"resolved": "http://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz",
"integrity": "sha1-vgPfjMPineTSxd9lASY/H6RZXpo=",
"dev": true
},
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
......@@ -7854,31 +7845,6 @@
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.0",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"process-nextick-args": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"rimraf": {
......
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