Commit 7dcf3732 authored by Curtis Adam's avatar Curtis Adam

Add modal messages to the card editor

parent 8808253d
......@@ -285,7 +285,10 @@
"moduleShortplaceholder": "Abkürzung des Modultitels",
"moduleNumplaceholder": "Nummer des Moduls laut Modulhandbuch",
"moduleLinkplaceholder": "Link zur offiziellen Modulbeschreibung",
"deleteCards": "Möchtest du wirklich alle Karten des Kartensatzes \"__name__\" löschen?"
"deleteCards": "Möchtest du wirklich alle Karten des Kartensatzes \"__name__\" löschen?",
"deleteCard": "Möchtest du wirklich die Karte löschen?",
"cancelEditCard": "Möchtest du wirklich den Bearbeitungsmodus verlassen? Alle nicht gespeicherten Änderungen werden bei Bestätigung verworfen.",
"cancelEditCardTitle": "Bearbeitungsmodus verlassen"
},
"profile": {
"overview": "Lernaktivität",
......
......@@ -296,7 +296,10 @@
"moduleShortplaceholder": "Short module name",
"moduleNumplaceholder": "Number of the module",
"moduleLinkplaceholder": "Link to the module description",
"deleteCards": "Do you really want to delete all cards for the cardset \"__name__\"?"
"deleteCards": "Do you really want to delete all cards for the cardset \"__name__\"?",
"deleteCard": "Do you really want to erase the card?",
"cancelEditCard": "Do you really want to leave editing mode? All unsaved changes will be discarded upon confirmation.",
"cancelEditCardTitle": "Exit editing mode"
},
"profile": {
"overview": "Learning Progress",
......
......@@ -32,6 +32,8 @@
<template name="editor">
{{getContent}}
{{> cancelEditForm}}
{{> deleteCardForm}}
<div class="row firstEditorRow editorElement">
<div id="cardType" class="col-md-6 cardtext editorElement">
<h5>{{_ "cardType"}}</h5>
......@@ -372,11 +374,12 @@
{{_ "savecard"}}
</button>
<button id="cardSaveReturn"
class="btn btn-success btn-raised save col-xs-12 col-sm-4" {{disableIfOffline}} tabindex="14">
class="btn btn-default btn-raised save col-xs-12 col-sm-4" {{disableIfOffline}} tabindex="14">
{{_ "savecardReturn"}}
</button>
<button id="cardCancel" class="btn btn-danger btn-raised cancel col-xs-12 col-sm-3 pull-right"
tabindex="15">{{_
tabindex="15" data-toggle="modal"
data-target="#cancelEditModal">{{_
"declinecard"}}</button>
</div>
</div>
......@@ -387,11 +390,9 @@
<br>
<button id="cardDelete"
class="btn btn-danger btn-raised col-xs-12 col-md-3 pull-right" {{isDisabled}}
tabindex="16">{{_
tabindex="16" data-toggle="modal"
data-target="#deleteCardModal">{{_
"deletecard"}}</button>
<button id="cardDeleteConfirm" style="display: none;"
class="btn btn-warning btn-raised col-xs-12 col-md-3 pull-right">{{_
"confirmcard"}}</button>
</div>
</div>
{{/if}}
......@@ -408,7 +409,8 @@
<div class="carousel-inner">
{{#each getCards}}
<div class="item {{#if cardActive @index}}active{{/if}}" data-id="{{_id}}">
<div class="{{#unless isCardType 5}}box flashcard{{else}}box-static flashcard-static{{/unless}}">
<div class="{{#unless isCardType
5}}box flashcard{{else}}box-static flashcard-static{{/unless}}">
<div class="cardHeader {{getCardBackground difficulty cardType backgroundStyle}}-header"
style="{{#if isHintPreview}}display: none{{/if}}{{#if
isLecturePreview}}display: none{{/if}}">
......@@ -774,3 +776,53 @@
</div>
</div>
</template>
<template name="cancelEditForm">
<div class="modal fade" id="cancelEditModal" tabindex="-1" role="dialog"
aria-labelledby="deleteCardsTitle">
<div class="modal-dialog">
<div class="modal-content modal-content-for-buttons">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 id="cancelEditTitle" class="modal-title">{{_ "modal-dialog.cancelEditCardTitle"}}</h4>
</div>
<div class="modal-body">
{{_ "modal-dialog.cancelEditCard"}}
<button id="cancelEditConfirm" class="btn btn-raised btn-danger btn-block col-xs-12 col-sm-3">{{_
"modal-dialog.cancelEditCardTitle"}}</button>
<button id="cancelEditDismiss" class="btn btn-raised btn-default btn-block col-xs-12 col-sm-3"
data-dismiss="modal">{{_
"modal-dialog.cancel"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
<template name="deleteCardForm">
<div class="modal fade" id="deleteCardModal" tabindex="-1" role="dialog"
aria-labelledby="deleteCardTitle">
<div class="modal-dialog">
<div class="modal-content modal-content-for-buttons">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 id="deleteCardTitle" class="modal-title">{{_ "deletecard"}}</h4>
</div>
<div class="modal-body">
{{_ "modal-dialog.deleteCard"}}
<button id="deleteCardConfirm" class="btn btn-raised btn-danger btn-block col-xs-12 col-sm-3">{{_
"deleteCard"}}</button>
<button id="deleteCardDismiss" class="btn btn-raised btn-default btn-block col-xs-12 col-sm-3"
data-dismiss="modal">{{_
"modal-dialog.cancel"}}</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</template>
\ No newline at end of file
......@@ -879,26 +879,6 @@ Template.btnCard.events({
},
"click #cardSaveReturn": function () {
saveCard(this._id, true);
},
'click #cardCancel': function () {
defaultData();
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
},
'click #cardDelete': function () {
$("#cardDelete").remove();
$("#cardDeleteConfirm").css('display', "");
$('#cardDeleteConfirm').focus();
},
'click #cardDeleteConfirm': function () {
var id = this._id;
Session.set('modifiedCard', undefined);
Meteor.call("deleteCard", id);
Bert.alert(TAPi18n.__('deletecardSuccess'), "success", 'growl-top-left');
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
}
});
......@@ -1086,7 +1066,7 @@ Template.subjectEditor.helpers({
if ((Session.get('cardType') === 2 || Session.get('cardType') === 5) && Session.get('learningUnit') !== '') {
let card = Cards.findOne({_id: Session.get('learningUnit')});
if (card !== undefined && card.subject !== undefined) {
return card.subject ;
return card.subject;
} else {
return "";
}
......@@ -1764,3 +1744,39 @@ Meteor.startup(function () {
}
});
});
/*
* ############################################################################
* cancelEditForm
* ############################################################################
*/
Template.cancelEditForm.events({
'click #cancelEditConfirm': function () {
$('#cancelEditModal').on('hidden.bs.modal', function () {
defaultData();
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
}).modal('hide');
}
});
/*
* ############################################################################
* deleteCardForm
* ############################################################################
*/
Template.deleteCardForm.events({
'click #deleteCardConfirm': function () {
$('#deleteCardModal').on('hidden.bs.modal', function () {
Session.set('modifiedCard', undefined);
Meteor.call("deleteCard", Router.current().params.cardid);
Bert.alert(TAPi18n.__('deletecardSuccess'), "success", 'growl-top-left');
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
});
}).modal('hide');
}
});
\ No newline at end of file
......@@ -62,6 +62,8 @@ module.exports = {
browser.waitForVisible('#cardCancel', global.threshold);
if (click) {
browser.click('#cardCancel');
browser.waitForVisible('#cancelEditConfirm', global.threshold);
browser.click('#cancelEditConfirm');
}
},
editCard: function (click = true) {
......@@ -78,9 +80,9 @@ module.exports = {
}
},
deleteCardConfirm: function (click = true) {
browser.waitForVisible('#cardDeleteConfirm', global.threshold);
browser.waitForVisible('#deleteCardConfirm', global.threshold);
if (click) {
browser.click('#cardDeleteConfirm');
browser.click('#deleteCardConfirm');
}
},
deleteAllCards: function (click = true) {
......
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