Commit 9aeabe49 authored by Curtis Adam's avatar Curtis Adam

Add an Option for non-course card sets

parent a52e0ac4
......@@ -197,7 +197,9 @@
"wozniak": "Woźniak",
"both": "Leitner & Woźniak",
"none": "ohne",
"levelOfLearning": "Lernstand"
"levelOfLearning": "Lernstand",
"noModuleLong": "Ohne Modul",
"noModuleShort": "ohne"
},
"set-list-empty": {
"emptytextlist": "Du hast noch keinen Kartensatz angelegt.",
......@@ -262,6 +264,8 @@
"course_required": "Wähle einen Studiengang",
"manageEditors": "Bearbeitungsrechte verwalten für den Kartensatz \"__name__\"",
"module": "Modul",
"moduleActivated": "Mit Modul",
"moduleDeactivated": "Ohne Modul",
"module_required": "Gib den vollen Titel des Moduls an!",
"moduleShort": "Kurzbezeichnung",
"moduleShort_required": "Gib eine Kurzbezeichnung des Modultitels an!",
......
......@@ -207,7 +207,9 @@
"wozniak": "Woźniak",
"both": "Leitner & Woźniak",
"none": "None",
"levelOfLearning": "Progress"
"levelOfLearning": "Progress",
"noModuleLong": "Without module",
"noModuleShort": "None"
},
"set-list-empty": {
"emptytextlist": "You have not created any deck of cards yet",
......@@ -273,6 +275,8 @@
"course_required": "Choose a course",
"manageEditors": "Manage Editors for cardset \"__name__\"",
"module": "Module",
"moduleActivated": "With Module",
"moduleDeactivated": "Without Module",
"module_required": "The full name of the module is required!",
"moduleShort": "Initials",
"moduleShort_required": "The short name of the module is required!",
......
......@@ -119,21 +119,23 @@ const CardsetsSchema = new SimpleSchema({
userDeleted: {
type: Boolean
},
moduleActive: {
type: Boolean
},
module: {
type: String
type: String,
optional: true
},
moduleToken: {
type: String
type: String,
optional: true
},
moduleNum: {
type: String
},
moduleLink: {
type: String,
optional: true
},
skillLevel: {
type: Number,
moduleLink: {
type: String,
optional: true
},
college: {
......@@ -216,6 +218,7 @@ Meteor.methods({
* @param {Boolean} visible - Visibility of the cardset
* @param {Boolean} ratings - Rating of the cardset
* @param {String} kind - Type of cards
* @param {Boolean} moduleActive - Does the cardset use a module
* @param {String} module - Modulename
* @param {String} moduleShort - Abbreviation for the module
* @param {String} moduleNum - Number of the module
......@@ -225,7 +228,7 @@ Meteor.methods({
* @param {Boolean} shuffled - Is the cardset made out of shuffled cards
* @param {String} cardGroups - The group names of the shuffled cards
*/
addCardset: function (name, description, visible, ratings, kind, module, moduleShort, moduleNum, moduleLink, college, course, shuffled, cardGroups) {
addCardset: function (name, description, visible, ratings, kind, moduleActive, module, moduleShort, moduleNum, moduleLink, college, course, shuffled, cardGroups) {
if (Meteor.settings.public.university.singleUniversity) {
college = Meteor.settings.public.university.default;
}
......@@ -234,6 +237,7 @@ Meteor.methods({
check(visible, Boolean);
check(ratings, Boolean);
check(kind, String);
check(moduleActive, Boolean);
check(module, String);
check(moduleShort, String);
check(moduleNum, String);
......@@ -274,6 +278,7 @@ Meteor.methods({
quantity: quantity,
license: [],
userDeleted: false,
moduleActive: moduleActive,
module: module.trim(),
moduleToken: moduleShort.trim(),
moduleNum: moduleNum.trim(),
......@@ -489,6 +494,7 @@ Meteor.methods({
* @param {String} id - ID of the cardset to be updated
* @param {String} name - Title of the cardset
* @param {String} description - Description for the content of the cardset
* @param {Boolean} moduleActive - Does the cardset use a module
* @param {String} module - Module name
* @param {String} moduleShort - Abbreviation for the module
* @param {String} moduleNum - Number of the module
......@@ -496,13 +502,14 @@ Meteor.methods({
* @param {String} college - Assigned university
* @param {String} course - Assigned university course
*/
updateCardset: function (id, name, description, module, moduleShort, moduleNum, moduleLink, college, course) {
updateCardset: function (id, name, description, moduleActive, module, moduleShort, moduleNum, moduleLink, college, course) {
if (Meteor.settings.public.university.singleUniversity) {
college = Meteor.settings.public.university.default;
}
check(id, String);
check(name, String);
check(description, String);
check(moduleActive, Boolean);
check(module, String);
check(moduleShort, String);
check(moduleNum, String);
......@@ -527,6 +534,7 @@ Meteor.methods({
name: name.trim(),
description: description,
dateUpdated: new Date(),
moduleActive: moduleActive,
module: module.trim(),
moduleToken: moduleShort.trim(),
moduleNum: moduleNum.trim(),
......
......@@ -46,6 +46,7 @@ var initTestNotificationsCardset = function () {
"nd"
],
"userDeleted": false,
"moduleActive": true,
"module": "Notifications Test",
"moduleToken": "NT",
"moduleNum": "CS1024",
......@@ -426,6 +427,19 @@ Meteor.startup(function () {
);
}
cardsets = Cardsets.find({moduleActive: {$exists: false}}).fetch();
for (let i = 0; i < cardsets.length; i++) {
Cardsets.update({
_id: cardsets[i]._id
},
{
$set: {
moduleActive: true
}
}
);
}
cardsets = Cardsets.find({learners: {$exists: false}}).fetch();
for (let i = 0; i < cardsets.length; i++) {
Meteor.call("updateLearnerCount", cardsets[i]._id);
......
......@@ -74,48 +74,61 @@
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">{{_ "modal-dialog.module"}}</div>
<div class="form-group setdetails name row" id="module">
<label id="editCardsetModuleLabelAdmin" class="col-md-3 control-label"
for="editCardsetModuleAdmin">{{_ "modal-dialog.module"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editCardsetModuleAdmin"
value="{{module}}">
<span id="helpEditCardsetModuleAdmin" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name row" id="module">
<label id="editCardsetModuleShortLabelAdmin" class="col-md-3 control-label"
for="editCardsetModuleShortAdmin">{{_ "modal-dialog.moduleShort"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editCardsetModuleShortAdmin"
value="{{moduleToken}}">
<span id="helpEditCardsetModuleShortAdmin" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name row" id="module">
<label id="editCardsetModuleNumLabelAdmin" class="col-md-3 control-label"
for="editCardsetModuleNumAdmin">{{_ "modal-dialog.moduleNum"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editCardsetModuleNumAdmin"
value="{{moduleNum}}">
<span id="helpEditCardsetModuleNumAdmin" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<div class="form-group setdetails name" id="module">
<label id="editSetModuleLinkLabelAdmin" class="col-md-3 control-label"
for="editSetModuleLinkAdmin">{{_
"modal-dialog.moduleLink"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editSetModuleLinkAdmin"
placeholder="{{_ "modal-dialog.moduleLinkplaceholder"}}"
value="{{moduleLink}}">
</div>
</div><!-- / module textfield -->
<br>
<br>
<div class="panel-heading">{{_ "modal-dialog.module"}}
<span class="pull-right">
<label class="moduleRadioButtonLabel radio-inline"><input type="radio" class="moduleRadioButton"
name="optradio" value="true"
checked="{{#if moduleActive}}checked{{/if}}">{{_
"modal-dialog.moduleActivated"}}</label>
<label class="moduleRadioButtonLabel radio-inline"><input type="radio" class="moduleRadioButton"
name="optradio" value="false" checked="{{#unless
moduleActive}}checked{{/unless}}">{{_
"modal-dialog.moduleDeactivated"}}</label>
</span>
</div>
<div class="moduleBody" style="display: {{#unless moduleActive}}none{{/unless}}">
<div class="form-group setdetails name row" id="module">
<label id="editCardsetModuleLabelAdmin" class="col-md-3 control-label"
for="editCardsetModuleAdmin">{{_ "modal-dialog.module"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editCardsetModuleAdmin"
value="{{module}}">
<span id="helpEditCardsetModuleAdmin" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name row" id="module">
<label id="editCardsetModuleShortLabelAdmin" class="col-md-3 control-label"
for="editCardsetModuleShortAdmin">{{_ "modal-dialog.moduleShort"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editCardsetModuleShortAdmin"
value="{{moduleToken}}">
<span id="helpEditCardsetModuleShortAdmin" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name row" id="module">
<label id="editCardsetModuleNumLabelAdmin" class="col-md-3 control-label"
for="editCardsetModuleNumAdmin">{{_ "modal-dialog.moduleNum"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editCardsetModuleNumAdmin"
value="{{moduleNum}}">
<span id="helpEditCardsetModuleNumAdmin" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<div class="form-group setdetails name" id="module">
<label id="editSetModuleLinkLabelAdmin" class="col-md-3 control-label"
for="editSetModuleLinkAdmin">{{_
"modal-dialog.moduleLink"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="editSetModuleLinkAdmin"
placeholder="{{_ "modal-dialog.moduleLinkplaceholder"}}"
value="{{moduleLink}}">
</div>
</div><!-- / module textfield -->
<br>
<br>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
......
......@@ -118,19 +118,19 @@ Template.admin_cardset.events({
$('#helpEditCardsetDescriptionAdmin').html(TAPi18n.__('admin.cardset.description_required'));
$('#helpEditCardsetDescriptionAdmin').css('color', '#b94a48');
}
if ($('#editCardsetModuleAdmin').val() === "") {
if ($('#editCardsetModuleAdmin').val() === "" && Session.get('moduleActive')) {
$('#editCardsetModuleLabelAdmin').css('color', '#b94a48');
$('#editCardsetModuleAdmin').css('border-color', '#b94a48');
$('#helpEditCardsetModuleAdmin').html(TAPi18n.__('modal-dialog.module_required'));
$('#helpEditCardsetModuleAdmin').css('color', '#b94a48');
}
if ($('#editCardsetModuleShortAdmin').val() === "") {
if ($('#editCardsetModuleShortAdmin').val() === "" && Session.get('moduleActive')) {
$('#editCardsetModuleShortLabelAdmin').css('color', '#b94a48');
$('#editCardsetModuleShortAdmin').css('border-color', '#b94a48');
$('#helpEditCardsetModuleShortAdmin').html(TAPi18n.__('modal-dialog.moduleShort_required'));
$('#helpEditCardsetModuleShortAdmin').css('color', '#b94a48');
}
if ($('#editCardsetModuleNumAdmin').val() === "") {
if ($('#editCardsetModuleNumAdmin').val() === "" && Session.get('moduleActive')) {
$('#editCardsetModuleNumLabelAdmin').css('color', '#b94a48');
$('#editCardsetModuleNumAdmin').css('border-color', '#b94a48');
$('#helpEditCardsetModuleNumAdmin').html(TAPi18n.__('modal-dialog.moduleNum_required'));
......@@ -179,9 +179,9 @@ Template.admin_cardset.events({
if (Meteor.settings.public.university.singleUniversity) {
if ($('#editCardsetNameAdmin').val() !== "" &&
$('#editCardsetDescriptionAdmin').val() !== "" &&
$('#editCardsetModuleAdmin').val() !== "" &&
$('#editCardsetModuleShortAdmin').val() !== "" &&
$('#editCardsetModuleNumAdmin').val() !== "" &&
($('#editCardsetModuleAdmin').val() !== "" || !Session.get('moduleActive')) &&
($('#editCardsetModuleShortAdmin').val() !== "" || !Session.get('moduleActive')) &&
($('#editCardsetModuleNumAdmin').val() !== "" || !Session.get('moduleActive')) &&
$('#editCardsetCollegeAdmin').val() !== "" &&
$('#editCardsetCourseAdmin').val() !== "" &&
($("#kindoption0Admin").hasClass('active') ||
......@@ -226,15 +226,15 @@ Template.admin_cardset.events({
visible = false;
}
Meteor.call("publishCardset", this._id, kind, price, visible);
Meteor.call("updateCardset", this._id, name, description, module, moduleShort, moduleNum, moduleLink, college, course);
Meteor.call("updateCardset", this._id, name, description, Session.get('moduleActive'), module, moduleShort, moduleNum, moduleLink, college, course);
window.history.go(-1);
}
} else {
if ($('#editCardsetNameAdmin').val() !== "" &&
$('#editCardsetDescriptionAdmin').val() !== "" &&
$('#editCardsetModuleAdmin').val() !== "" &&
$('#editCardsetModuleShortAdmin').val() !== "" &&
$('#editCardsetModuleNumAdmin').val() !== "" &&
($('#editCardsetModuleAdmin').val() !== "" || !Session.get('moduleActive')) &&
($('#editCardsetModuleShortAdmin').val() !== "" || !Session.get('moduleActive')) &&
($('#editCardsetModuleNumAdmin').val() !== "" || !Session.get('moduleActive')) &&
$('#editCardsetCollegeAdmin').val() !== "" &&
$('#editCardsetCourseAdmin').val() !== "" &&
($("#kindoption0Admin").hasClass('active') ||
......@@ -279,7 +279,7 @@ Template.admin_cardset.events({
visible = false;
}
Meteor.call("publishCardset", this._id, kind, price, visible);
Meteor.call("updateCardset", this._id, name, description, module, moduleShort, moduleNum, moduleLink, college, course);
Meteor.call("updateCardset", this._id, name, description, Session.get('moduleActive'), module, moduleShort, moduleNum, moduleLink, college, course);
window.history.go(-1);
}
}
......@@ -341,6 +341,15 @@ Template.admin_cardset.events({
$('#editCardsetModuleNumAdmin').css('border-color', '');
$('#helpEditCardsetModuleNumAdmin').html('');
},
'click .moduleRadioButton': function (event) {
if ($(event.currentTarget).val() === "true") {
Session.set('moduleActive', true);
$('.moduleBody').css('display', '');
} else {
Session.set('moduleActive', false);
$('.moduleBody').css('display', 'none');
}
},
'click .collegeAdmin': function (evt) {
var collegeName = $(evt.currentTarget).attr("data");
$('#editCardsetCollegeAdmin').html(collegeName);
......@@ -437,6 +446,7 @@ Template.admin_cardset.events({
Template.admin_cardset.onRendered(function () {
Session.set('poolFilterCollege', $('#editCardsetCollegeAdmin').val());
let cardset = Cardsets.findOne({_id: Router.current().params._id});
Session.set('moduleActive', cardset.moduleActive);
if (cardset.learningActive) {
let now = cardset.learningStart;
let end = cardset.learningEnd;
......
This diff is collapsed.
......@@ -126,10 +126,10 @@ Template.cardset.rendered = function () {
};
Template.cardset.helpers({
'onEditmodalClose': function () {
Session.set('previousName', Cardsets.findOne(Router.current().params._id).name);
Session.set('previousDescription', Cardsets.findOne(Router.current().params._id).description);
Session.set('previousModuleActive', Cardsets.findOne(Router.current().params._id).moduleActive);
Session.set('previousModule', Cardsets.findOne(Router.current().params._id).module);
Session.set('previousModuleShort', Cardsets.findOne(Router.current().params._id).moduleToken);
Session.set('previousModuleNum', Cardsets.findOne(Router.current().params._id).moduleNum);
......@@ -161,19 +161,19 @@ Template.cardset.events({
$('#helpEditSetDescription').html(TAPi18n.__('modal-dialog.description_required'));
$('#helpEditSetDescription').css('color', '#b94a48');
}
if ($('#editSetModule').val() === "") {
if ($('#editSetModule').val() === "" && Session.get('moduleActive')) {
$('#editSetModuleLabel').css('color', '#b94a48');
$('#editSetModule').css('border-color', '#b94a48');
$('#helpEditSetModule').html(TAPi18n.__('modal-dialog.module_required'));
$('#helpEditSetModule').css('color', '#b94a48');
}
if ($('#editSetModuleShort').val() === "") {
if ($('#editSetModuleShort').val() === "" && Session.get('moduleActive')) {
$('#editSetModuleShortLabel').css('color', '#b94a48');
$('#editSetModuleShort').css('border-color', '#b94a48');
$('#helpEditSetModuleShort').html(TAPi18n.__('modal-dialog.moduleShort_required'));
$('#helpEditSetModuleShort').css('color', '#b94a48');
}
if ($('#editSetModuleNum').val() === "") {
if ($('#editSetModuleNum').val() === "" && Session.get('moduleActive')) {
$('#editSetModuleNumLabel').css('color', '#b94a48');
$('#editSetModuleNum').css('border-color', '#b94a48');
$('#helpEditSetModuleNum').html(TAPi18n.__('modal-dialog.moduleNum_required'));
......@@ -207,25 +207,26 @@ Template.cardset.events({
if (Meteor.settings.public.university.singleUniversity) {
if ($('#editSetName').val() !== "" &&
$('#editSetDescription').val() !== "" &&
$('#editSetModule').val() !== "" &&
$('#editSetModuleShort').val() !== "" &&
$('#editSetModuleNum').val() !== "" &&
($('#editSetModule').val() !== "" || !Session.get('moduleActive')) &&
($('#editSetModuleShort').val() !== "" || !Session.get('moduleActive')) &&
($('#editSetModuleNum').val() !== "" || !Session.get('moduleActive')) &&
$('#editSetCourse').val() !== "") {
name = tmpl.find('#editSetName').value;
description = tmpl.find('#editSetDescription').value;
module = tmpl.find('#editSetModule').value;
moduleShort = tmpl.find('#editSetModuleShort').value;
moduleNum = tmpl.find('#editSetModuleNum').value;
college = Meteor.settings.public.university.default;
course = $('#editSetCourse').text();
Meteor.call("updateCardset", this._id, name, description, module, moduleShort, moduleNum, moduleLink, college, course);
Meteor.call("updateCardset", this._id, name, description, Session.get('moduleActive'), module, moduleShort, moduleNum, moduleLink, college, course);
$('#editSetModal').modal('hide');
}
} else {
if ($('#editSetName').val() !== "" &&
$('#editSetDescription').val() !== "" &&
$('#editSetModule').val() !== "" &&
$('#editSetModuleShort').val() !== "" &&
$('#editSetModuleNum').val() !== "" &&
($('#editSetModule').val() !== "" || !Session.get('moduleActive')) &&
($('#editSetModuleShort').val() !== "" || !Session.get('moduleActive')) &&
($('#editSetModuleNum').val() !== "" || !Session.get('moduleActive')) &&
$('#editSetCollege').val() !== "" &&
$('#editSetCourse').val() !== "") {
name = tmpl.find('#editSetName').value;
......@@ -235,7 +236,7 @@ Template.cardset.events({
moduleNum = tmpl.find('#editSetModuleNum').value;
college = $('#editSetCollege').text();
course = $('#editSetCourse').text();
Meteor.call("updateCardset", this._id, name, description, module, moduleShort, moduleNum, moduleLink, college, course);
Meteor.call("updateCardset", this._id, name, description, Session.get('moduleActive'), module, moduleShort, moduleNum, moduleLink, college, course);
$('#editSetModal').modal('hide');
}
}
......@@ -283,8 +284,8 @@ Template.cardset.events({
Template.cardsetForm.onRendered(function () {
$('#editSetModal').on('hidden.bs.modal', function () {
var previousCollegeName = Session.get('previousCollegeName');
var previousCourseName = Session.get('previousCourseName');
let previousCollegeName = Session.get('previousCollegeName');
let previousCourseName = Session.get('previousCourseName');
$('#editSetName').val(Session.get('previousName'));
$('#editSetNameLabel').css('color', '');
......@@ -328,6 +329,18 @@ Template.cardsetForm.onRendered(function () {
$('#editSetCourseLabel').css('color', '');
$('.editSetCourseDropdown').css('border-color', '');
$('#helpEditSetCourse').html('');
if (Session.get('previousModuleActive')) {
$('.moduleRadioButton')[0].checked = true;
$('.moduleRadioButton')[1].checked = false;
$('.moduleBody').css('display', '');
Session.set('moduleActive', true);
} else {
$('.moduleRadioButton')[0].checked = false;
$('.moduleRadioButton')[1].checked = true;
$('.moduleBody').css('display', 'none');
Session.set('moduleActive', false);
}
});
});
......@@ -375,6 +388,15 @@ Template.cardsetForm.events({
$('#editSetModuleNumLabel').css('color', '');
$('#editSetModuleNum').css('border-color', '');
$('#helpEditSetModuleNum').html('');
},
'click .moduleRadioButton': function (event) {
if ($(event.currentTarget).val() === "true") {
Session.set('moduleActive', true);
$('.moduleBody').css('display', '');
} else {
Session.set('moduleActive', false);
$('.moduleBody').css('display', 'none');
}
}
});
......
......@@ -267,7 +267,8 @@
</template>
<template name="cardsetsForm">
<div class="modal fade" id="newSetModal" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="newSetModalTitle">
<div class="modal fade" id="newSetModal" data-backdrop="static" tabindex="-1" role="dialog"
aria-labelledby="newSetModalTitle">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
......@@ -294,52 +295,63 @@
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">{{_ "modal-dialog.module"}}</div>
<div class="panel-heading">{{_ "modal-dialog.module"}}
<span class="moduleRadioButtonGroup pull-right">
<label class="moduleRadioButtonLabel radio-inline"><input type="radio" class="moduleRadioButton" name="optradio" value="true"
checked="checked">{{_
"modal-dialog.moduleActivated"}}</label>
<label class="moduleRadioButtonLabel radio-inline"><input type="radio" class="moduleRadioButton" name="optradio" value="false">{{_
"modal-dialog.moduleDeactivated"}}</label>
</span>
</div>
<br>
<!-- start module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleLabel" class="col-md-3 control-label"
for="newSetModule">{{_ "modal-dialog.module"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModule"
placeholder="{{_ "modal-dialog.moduleplaceholder"}}"
value="{{getShuffleModule}}">
<span id="helpNewSetModule" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleShortLabel" class="col-md-3 control-label"
for="newSetModuleShort">{{_ "modal-dialog.moduleShort"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModuleShort"
placeholder="{{_ "modal-dialog.moduleShortplaceholder"}}"
value="{{getShuffleModuleShort}}">
<span id="helpNewSetModuleShort" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleNumLabel" class="col-md-3 control-label"
for="newSetModuleNum">{{_
"modal-dialog.moduleNum"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModuleNum"
placeholder="{{_ "modal-dialog.moduleNumplaceholder"}}"
value="{{getShuffleModuleNum}}">
<span id="helpNewSetModuleNum" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleLinkLabel" class="col-md-3 control-label"
for="newSetModuleLink">{{_
"modal-dialog.moduleLink"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModuleLink"
placeholder="{{_ "modal-dialog.moduleLinkplaceholder"}}"
value="{{getShuffleModuleLink}}">
</div>
</div><!-- / module textfield -->
<div class="moduleBody">
<!-- start module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleLabel" class="col-md-3 control-label"
for="newSetModule">{{_ "modal-dialog.module"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModule"
placeholder="{{_ "modal-dialog.moduleplaceholder"}}"
value="{{getShuffleModule}}">
<span id="helpNewSetModule" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleShortLabel" class="col-md-3 control-label"
for="newSetModuleShort">{{_ "modal-dialog.moduleShort"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModuleShort"
placeholder="{{_ "modal-dialog.moduleShortplaceholder"}}"
value="{{getShuffleModuleShort}}">
<span id="helpNewSetModuleShort" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<!-- start module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleNumLabel" class="col-md-3 control-label"
for="newSetModuleNum">{{_
"modal-dialog.moduleNum"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModuleNum"
placeholder="{{_ "modal-dialog.moduleNumplaceholder"}}"
value="{{getShuffleModuleNum}}">
<span id="helpNewSetModuleNum" class="help-block name"></span>
</div>
</div><!-- / module textfield -->
<div class="form-group setdetails name" id="module">
<label id="newSetModuleLinkLabel" class="col-md-3 control-label"
for="newSetModuleLink">{{_
"modal-dialog.moduleLink"}}</label>
<div class="col-md-9">
<input class="form-control" type="text" id="newSetModuleLink"
placeholder="{{_ "modal-dialog.moduleLinkplaceholder"}}"
value="{{getShuffleModuleLink}}">
</div>
</div><!-- / module textfield -->
<br>
</div>
</div>
{{#unless singleUniversity}}
<!-- start college Dropdown -->
......
......@@ -10,6 +10,7 @@ import "./cardsets.html";
import {image, tex} from '/imports/ui/card/card.js';
Session.setDefault('cardsetId', undefined);
Session.set('moduleActive', true);
Meteor.subscribe("cardsets");
......@@ -40,6 +41,11 @@ function cleanModal() {
$('#newSetModuleNum').css('border-color', '');
$('#newSetModuleNumLabel').css('color', '');
$('#newSetModuleLink').val('');
$('#helpNewSetModuleLink').html('');
$('#newSetModuleLink').css('border-color', '');
$('#newSetModuleLinkLabel').css('color', '');
if ($('#newSetCollege').val() !== "") {
$('#newSetCollege').val('');
$('#newSetCollege').html(TAPi18n.__('modal-dialog.college_required'));
......@@ -57,9 +63,18 @@ function cleanModal() {
$('#helpNewSetCourse').html('');
$('.newSetCourseDropdown').css('border-color', '');
$('#newSetCourseLabel').css('color', '');
$('.newSetCourseDropdown').attr('disabled', true);
if (!Meteor.settings.public.university.singleUniversity) {
$('.newSetCourseDropdown').attr('disabled', true);
}
Session.set('poolFilterCollege', undefined);
$('.md-footer').html("");
$('.moduleRadioButton')[0].checked = true;
$('.moduleRadioButton')[1].checked = false;
$('.moduleBody').css('display', '');
Session.set('moduleActive', true);
});
}
......@@ -385,6 +400,17 @@ Template.cardsetsForm.helpers({
}
}
});
Template.cardsets.events({
'click .moduleRadioButton': function (event) {
if ($(event.currentTarget).val() === "true") {
Session.set('moduleActive', true);
$('.moduleBody').css('display', '');
} else {
Session.set('moduleActive', false);
$('.moduleBody').css('display', 'none');
}
}
});
/*
* ############################################################################
......@@ -432,19 +458,19 @@ Template.cardsets.events({
$('#helpNewSetDescription').html(TAPi18n.__('modal-dialog.description_required'));
$('#helpNewSetDescription').css('color', '#b94a48');
}
if ($('#newSetModule').val() === "") {
if ($('#newSetModule').val() === "" && Session.get('moduleActive')) {
$('#newSetModuleLabel').css('color', '#b94a48');