fixed problem with personalized legend in student's pictos, (issue #650)

parent b436ebc6
......@@ -86,7 +86,9 @@ module.exports = {
status: 'invisible',
highlight: false,
color: null,
expression: null
expression: null,
legend: null,
legend_size: 'small'
};
if (typeof attributes === 'object') {
......@@ -117,6 +119,15 @@ module.exports = {
if (!((/^(invisible|enabled|disabled)$/).test(validAttributes.status))) {
delete validAttributes.status;
}
if (typeof validAttributes.expression !== 'string') {
delete validAttributes.expression;
}
if (typeof validAttributes.legend !== 'boolean') {
delete validAttributes.legend;
}
if (!((/^(small|large)$/).test(validAttributes.legend_size))) {
delete validAttributes.legend_size;
}
if (typeof validAttributes.highlight !== 'boolean') {
delete validAttributes.highlight;
}
......@@ -137,7 +148,7 @@ module.exports = {
*/
beforeCreate: function (attrs, next) {
if (typeof attrs.attributes !== 'object') {
attrs.attributes = JSON.parse(attrs.attributes);
attrs.attributes = JSON.parse(attrs.attributes);
}
attrs.attributes = StuPicto.getValidAttributes(attrs.attributes);
next();
......
......@@ -37,7 +37,7 @@
-->
<li class="list-group-item">
<div class="checkbox">
<label><input data-toggle="toggle" type="checkbox" ng-model="studentPicto.attributes.legend" ng-change="update_properties()" translate>legend</label>
<input data-toggle="toggle" type="checkbox" ng-model="studentPicto.attributes.legend" ng-change="update_properties()"><label translate>legend</label>
</div>
</ul>
</div>
......
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 sign in to comment