displayStyle: "compact", //or "all": all on same page
parameters: 0, //TODO: DO NOT re-draw parameters for already answered questions
};
- }
+ },
// Full questions tree is rendered, but some parts hidden depending on display settings
render(h) {
// Prepare questions groups, ordered
{
"class": {
"question": true,
- "depth" + depth: true,
+ ["depth" + depth]: true,
},
},
questionContent
"questionGroup": true,
"hide": this.display == "one" && this.iidx != i,
},
- }
+ },
qgDom
);
});
questionsText: "", //questions in an evaluation, in text format
},
mounted: function() {
-
-
-
- $('.modal').each( (i,elem) => {
- if (elem.id != "evaluationEdit")
- $(elem).modal();
- });
- $('ul.tabs').tabs(); //--> migrate to grade.js
-
-
-
- $('#evaluationEdit').modal({
- complete: () => {
- this.parseEvaluation();
- Vue.nextTick(statementsLibsRefresh);
- },
- });
+ $('.modal').modal();
+ Materialize.updateTextFields(); //textareas, time field...
},
methods: {
// GENERAL:
}
);
},
- materialOpenModal: function(id) {
- $("#" + id).modal("open");
- Materialize.updateTextFields(); //textareas, time field...
- },
updateEvaluation: function() {
$.ajax("/evaluations", {
method: "PUT",
subject: subject,
body: "Hello " + to.initials + "!\n" +
"Access your account here: " +
- params.siteURL + "/authenticate?token=" + token + "\\n" +
+ params.siteURL + "/authenticate/" + token + "\\n" +
"Token will expire in " + params.token.expire/(1000*60) + " minutes."
}, err => {
res.json(err || {});
router.post('/register', access.ajax, access.unlogged, (req,res) => {
const newUser = {
- email: req.body.email,
- name: req.body.name,
+ email: decodeURIComponent(req.body.email),
+ name: decodeURIComponent(req.body.name),
};
let error = validator(newUser, "User");
if (error.length > 0)
// Login:
router.put('/sendtoken', access.ajax, access.unlogged, (req,res) => {
- const email = req.body.email;
+ const email = decodeURIComponent(req.body.email);
let error = validator({email:email}, "User");
if (error.length > 0)
return res.json({errmsg:error});
});
// Authentication process, optionally with email changing:
-router.put('/authenticate/:token([a-z0-9]+)', access.unlogged, (req,res) => {
+router.get('/authenticate/:token([a-z0-9]+)', access.unlogged, (req,res) => {
const loginToken = req.params.token;
UserModel.getByLoginToken(loginToken, (err,user) => {
access.checkRequest(res, err, user, "Invalid token", () => {
});
});
-router.put('/logout', access.logged, (req,res) => {
+router.get('/logout', access.logged, (req,res) => {
UserModel.removeToken(req.user._id, req.cookies.token, (err,ret) => {
access.checkRequest(res, err, ret, "Logout failed", () => {
res.clearCookie("initials");
block content
.container#course
if teacher
- #newevaluation.modal
+ #newEvaluation.modal
.modal-content
- form(@submit.prevent="addevaluation")
+ form(@submit.prevent="addEvaluation")
.input-field
input#evaluationName(type="text" v-model="newEvaluation.name" required)
label(for="evaluationName") Name
td {{ student.group }}
.row
.col.s12.m10.offset-m1
- h4.title(@click="toggleDisplay('evaluations')") evaluations
+ h4.title(@click="toggleDisplay('evaluations')") Evaluations
.card(v-show="display=='evaluations'")
if teacher
.center-align
- a.on-left.waves-effect.waves-light.btn.modal-trigger(href="#newevaluation") New evaluation
+ a.on-left.waves-effect.waves-light.btn.modal-trigger(href="#newEvaluation") New evaluation
input#password(type="password" v-model="monitorPwd" @keyup.enter="setPassword"
placeholder="Password" title="Monitoring password")
table
th #Questions
tbody
tr.evaluation(v-for="(evaluation,i) in evaluationArray" :class="{idle:!evaluation.active}"
- @click.left="actionevaluation(i)" @contextmenu.prevent="deleteevaluation(evaluation)")
+ @click.left="actionEvaluation(i)" @contextmenu.prevent="deleteEvaluation(evaluation)")
td {{ evaluation.name }}
td {{ evaluation.mode }}
td {{ evaluation.questions.length }}