Changeset 512 for Dev


Ignore:
Timestamp:
03/13/14 01:19:07 (11 years ago)
Author:
hendrikvanantwerpen
Message:

Small fixes fir urls and validation.

Location:
Dev/trunk/src/client/qed-client
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/model/widgets/QuestionEditorPreviewItem.js

    r511 r512  
    149149            if ( this.innerWidget !== null ) {
    150150                if ( this._editing === true ) {
    151                     this._onChange();
     151                    this.triggerOnChange();
    152152                }
    153153                this.removeChild(this.innerWidget);
  • Dev/trunk/src/client/qed-client/model/widgets/SurveyRunWidget.js

    r506 r512  
    88        templateString: template,
    99        postCreate: function() {
     10            this.inherited(arguments);
    1011            var endDateBox = this.endDateBox;
    1112            this.own(this.startDateBox.on('change', function(value){
    1213                endDateBox.constraints.min  = value;
    1314            }));
     15        },
     16        startup: function() {
     17            this.inherited(arguments);
    1418        },
    1519        _getValueAttr: function() {
  • Dev/trunk/src/client/qed-client/model/widgets/SurveySummary.js

    r493 r512  
    1818        _setValueAttr: function(survey) {
    1919            this.titleNode.innerHTML = survey.title || "";
    20             domAttr.set(this.titleNode, "href", survey && surveys.getObjectPath(survey));
     20            domAttr.set(this.titleNode, "href",
     21                        survey && ('#!'+surveys.getObjectPath(survey)));
    2122            this.descriptionNode.innerHTML = survey.description || "";
    2223            this.questionsNode.innerHTML = survey.questions.length;
  • Dev/trunk/src/client/qed-client/model/widgets/templates/SurveyWidget.html

    r492 r512  
    11<form class="${baseClass}">
    22    <label for="title">Title</label>
    3     <input data-dojo-type="dijit/form/TextBox" name="title"/><br/>
     3    <input data-dojo-type="dijit/form/ValidationTextBox"
     4           data-dojo-props="required: true"
     5           name="title"/><br/>
    46    <label for="description">Description</label>
    57    <textarea data-dojo-type="dijit/form/Textarea" name="description"></textarea><br/>
  • Dev/trunk/src/client/qed-client/pages/survey.js

    r503 r512  
    55    "../model/widgets/TabbedQuestionBrowser",
    66    "./_ObjectPage",
     7    "dojo/Deferred",
    78    "dojo/_base/array",
    89    "dojo/_base/declare",
     
    1213    "require",
    1314    "dojo/text!./templates/survey.html"
    14 ], function(Router, surveys, QuestionListView, TabbedQuestionBrowser, _ObjectPage, array, declare, event, lang, when, require, template) {
     15], function(Router, surveys, QuestionListView, TabbedQuestionBrowser, _ObjectPage, Deferred, array, declare, event, lang, when, require, template) {
    1516    return declare([_ObjectPage],{
    1617        contextRequire: require,
     
    7778        },
    7879        _handleQuestionsChange: function() {
    79             this.object.questions = this.questionList.get('value');
     80            this._updateObject();
    8081            this.markDirty();
    8182            this._refresh();
    8283        },
    8384        _handlePropertiesChange: function() {
    84             lang.mixin(this.object, this.propertiesForm.get('value').survey);
     85            this._updateObject();
    8586            this.markDirty();
    8687            this._refresh();
    8788            this.layout();
     89        },
     90        _updateObject: function() {
     91            this._isValid = this.propertiesForm.validate();
     92            lang.mixin(this.object, this.propertiesForm.get('value').survey);
     93            this.object.questions = this.questionList.get('value');
     94            return this._isValid;
    8895        },
    8996        _onSave: function(evt) {
     
    109116            });
    110117        },
     118        _save: function() {
     119            if ( this._updateObject ) {
     120                return this.inherited(arguments);
     121            } else {
     122                return new Deferred().reject({error:"Please correct invalid values."});
     123            }
     124        },
    111125        markDirty: function() {
    112             this.saveBtn.set('disabled',false);
    113             this.saveAndCloseBtn.set('disabled',false);
     126            this.saveBtn.set('disabled',!this._isValid);
     127            this.saveAndCloseBtn.set('disabled',!this._isValid);
    114128            this.discardBtn.set('label','Discard & Close');
    115129            this.inherited(arguments);
  • Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js

    r511 r512  
    4646            });
    4747        },
    48         // Yuk, this function is taken directly from _FromMixin only
    49         // to add the priorityChange parameter
    5048        _getValueAttr: function() {
    5149            this.value = this.inherited(arguments);
    5250            return this.value;
    5351        },
     52        // Yuk, _setValueAttr is taken directly from _FromMixin only
     53        // to add the priorityChange parameter
    5454                _setValueAttr: function(obj, priorityChange) {
    5555            this.value = obj;
     
    9999        _handleChange: function(evt) {
    100100            if ( evt.target !== this.domNode ) {
    101                 this._onChange();
     101                this.triggerOnChange();
    102102                if ( evt ) { event.stop(evt); }
    103103                return false;
     
    120120            return false;
    121121        },
    122         _onChange: function() {
     122        triggerOnChange: function() {
    123123            if ( this._onChangeActive &&
    124124                 !(this.readOnly || this.disabled) ) {
Note: See TracChangeset for help on using the changeset viewer.