Commit 4ed6b9b2 authored by Curtis Adam's avatar Curtis Adam

Create first an empty shuffled cardset before the user selects references

parent 8251fd8d
......@@ -32,58 +32,36 @@
<template name="shuffle">
{{#if canShuffle}}
{{#unless isShuffleRoute}}
{{#unless selectShuffleCardset}}
<a href="shuffle" id="shuffleCardsets" class="btn btn-raised btn-success" role="button">{{_
"set-list.shuffleCardsets"}}</a>
{{/unless}}
{{else}}
<div class="col-md-12" id="set-list-region">
<div class="bs-callout bs-callout-info selectionInfo">
{{#if isActiveRoute 'shuffle'}}
<a href="repetitorium" id="cancelShuffle" class="btn btn-raised btn-danger" role="button">{{_
"declinecard"}}</a>
{{#if gotShuffledCards}}
<a href="#" id="createShuffledCardset" class="btn btn-raised btn-success" role="button"
data-toggle="modal"
data-target="#setCardsetFormModal" {{disableIfOffline}}>{{_
"set-list.shuffle"}}</a>
{{/if}}
<span class="text">
{{_ "set-list.shuffleInfoTextNew"}}
</span>
{{/if}}
{{#if isActiveRoute 'editshuffle'}}
{{#if gotShuffledCards}}
<button href="#" id="updateShuffledCardset" class="btn btn-raised btn-success"
role="button" {{disableIfOffline}}>{{_
"set-list.shuffle"}}</button>
{{/if}}
<button id="cancelUpdateShuffle" class="btn btn-raised btn-danger" role="button">{{_
"declinecard"}}</button>
<span class="text">
{{_ "set-list.shuffleInfoTextEdit"}}
</span>
{{/if}}
{{#if displayRemoveButton}}
<button href="#" id="removeShuffledCards" class="btn btn-raised btn-danger"
role="button" {{disableIfOffline}}>{{_
"set-list.shuffleRemove"}}</button>
{{/if}}
</div>
{{> filterNavigation}}
{{#if shuffleList 1}}
{{#each shuffleList 2}}
{{#unless isActiveCardset}}
{{> cardsetCourseIterationResultRow extendContext 'index' @index}}
{{/unless}}
{{/each}}
{{> infiniteScroll}}
{{else}}
{{> noFilterResults}}
<div class="col-md-12" id="set-list-region">
<div class="bs-callout bs-callout-info selectionInfo">
{{#if gotShuffledCards}}
<button href="#" id="updateShuffledCardset" class="btn btn-raised btn-success"
role="button" {{disableIfOffline}}>{{_
"set-list.shuffle"}}</button>
{{/if}}
<button id="cancelUpdateShuffle" class="btn btn-raised btn-danger" role="button">{{_
"declinecard"}}</button>
<span class="text">
{{_ "set-list.shuffleInfoTextEdit"}}
</span>
{{#if displayRemoveButton}}
<button href="#" id="removeShuffledCards" class="btn btn-raised btn-danger"
role="button" {{disableIfOffline}}>{{_
"set-list.shuffleRemove"}}</button>
{{/if}}
</div>
{{/unless}}
{{> filterNavigation}}
{{#if shuffleList 1}}
{{#each shuffleList 2}}
{{#unless isActiveCardset}}
{{> cardsetCourseIterationResultRow extendContext 'index' @index}}
{{/unless}}
{{/each}}
{{> infiniteScroll}}
{{else}}
{{> noFilterResults}}
{{/if}}
</div>
{{/if}}
</template>
......@@ -116,7 +94,10 @@
<template name="repetitorium">
<div class="col-md-12" id="set-list-region">
{{> shuffle}}
<button id="newRepetitorium" type="button" class="btn btn-raised btn-success saveSet" data-toggle="modal"
data-target="#setCardsetFormModal" {{disableIfOffline}} {{disableIfShuffle}}>
{{_ "set-list.shuffleCardsets"}}
</button>
{{#if cardsetList 0}}
{{> filterNavigation}}
{{#if cardsetList 1}}
......
......@@ -118,6 +118,12 @@ Template.repetitorium.helpers({
}
});
Template.repetitorium.events({
'click #newRepetitorium': function () {
Session.set('isNewCardset', true);
}
});
Template.repetitorium.onDestroyed(function () {
Filter.resetMaxItemCounter();
});
......@@ -172,9 +178,6 @@ Template.learn.events({
*/
Template.shuffle.events({
'click #createShuffledCardset': function () {
Session.set("ShuffleTemplate", Cardsets.findOne({_id: Session.get("ShuffledCardsets")[0]}));
},
'click #updateShuffledCardset': function () {
let removedCardsets = $(Cardsets.findOne({_id: Router.current().params._id}).cardGroups).not(Session.get("ShuffledCardsets")).get();
Meteor.call("updateShuffleGroups", Router.current().params._id, Session.get("ShuffledCardsets"), removedCardsets, function (error, result) {
......
......@@ -83,6 +83,7 @@ export function saveCardset() {
$('#helpSetName').html(TAPi18n.__('modal-dialog.name_required'));
}
if ($('#setCardType').val() < 0) {
error = true;
errorMessage += "<li>" + TAPi18n.__('modal-dialog.cardType') + "</li>";
bertDelayMultiplier++;
$('#setCardTypeLabel').addClass('text-warning');
......@@ -101,16 +102,20 @@ export function saveCardset() {
if (!error) {
let name, cardType, description, shuffled, cardGroups;
name = $('#setName').val();
if (Route.isShuffle()) {
if (Route.isShuffle() || Route.isRepetitorium()) {
cardType = -1;
} else {
cardType = $('#setCardType').val();
}
description = $('#contentEditor').val();
if (isNewCardset()) {
if (Route.isShuffle()) {
if (Route.isShuffle() || Route.isRepetitorium()) {
shuffled = true;
cardGroups = Session.get("ShuffledCardsets");
if (Route.isRepetitorium()) {
cardGroups = [];
} else {
cardGroups = Session.get("ShuffledCardsets");
}
} else {
shuffled = false;
cardGroups = [];
......
......@@ -13,6 +13,7 @@ Scenario: User creates a new deck of cards
When User clicks on the create cardset button
Then he is redirected to the new cardset form
Then he should be able to edit the cardset title
And he should be able to edit the card type
And he should be able to edit the cardset description
And he should push the create new cardset button
And he should see the details of that cardset with the correct values
......@@ -26,6 +26,11 @@ module.exports = function () {
navigation.setContent('#setName', title);
});
this.Then(/^he should be able to edit the card type$/, function () {
navigation.clickElement('#setCardType');
navigation.clickElement('.cardType');
});
this.Then(/^he should be able to edit the cardset description$/, function () {
navigation.setContent('#contentEditor', description);
});
......
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