Ignore:
Timestamp:
06/09/13 17:27:20 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Improve SurveyRun? form and drop Fieldsets as widgets.

  • Improved console message on Page change fail.
  • Renamed some widgets, dropped having Fieldset widgets.
  • Put constraint that survey run start date cannot be before end date.
  • Link to survey from survey summary,
Location:
Dev/trunk/src/client/qed-client/pages
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/pages/surveyRun.js

    r443 r457  
    2121            if ( this._started ) { return; }
    2222            this.inherited(arguments);
    23             this.propertiesForm.on("blur",lang.hitch(this,'_onPropChange'));
     23            this.surveyRunWidget.on("blur",lang.hitch(this,'_onPropChange'));
    2424            if ( this.surveyRunId ) {
    2525                this._loadSurveyRun();
     
    3838        refreshSurveyRun: function() {
    3939            this.titleNode.innerHTML = SurveyRun.DisplayTitle.get(this.surveyRun);
    40             this.surveyNode.set('value',SurveyRun.Survey.get(this.surveyRun));
    41             this.propertiesForm.set('value',this.surveyRun);
     40            this.surveySummaryWidget.set('value',SurveyRun.Survey.get(this.surveyRun));
     41            this.surveyRunWidget.set('value',this.surveyRun);
    4242            this._onPropChange();
    4343        },
     
    7070        },
    7171        _onPropChange: function(e) {
    72             var surveyRun = this.propertiesForm.get('value');
     72            var surveyRun = this.surveyRunWidget.get('value');
    7373            if ( surveyRun.mode === "open" ) {
    7474                this.runURLNode.innerHTML = this._link(this._getGeneralURL(store.getIdentity(this.surveyRun)));
     
    8787        },
    8888        _onSave: function(evt) {
    89             lang.mixin(this.surveyRun,this.propertiesForm.get('value'));
    90             var not = function(p){ return !p; };
    91             func.modPropIf(this.surveyRun,"startDate",not.compose(lang.isString),store.formatDate);
    92             func.modPropIf(this.surveyRun,"endDate",not.compose(lang.isString),store.formatDate);
    93             store.put(this.surveyRun)
    94             .then(function() {
    95                 Router.go('/surveys');
    96             },function(err){
    97                 Content.notify(err);
    98             });
     89            if ( this.surveyRunWidget.validate() ) {
     90                lang.mixin(this.surveyRun,this.surveyRunWidget.get('value'));
     91
     92                var SD = SurveyRun.StartDate;
     93                var ED = SurveyRun.EndDate;
     94                SD.set(this.surveyRun, SD.get(this.surveyRun));
     95                ED.set(this.surveyRun, ED.get(this.surveyRun));
     96
     97                store.put(this.surveyRun)
     98                .then(function() {
     99                    Router.go('/surveys');
     100                },function(err){
     101                    Content.notify(err);
     102                });
     103            }
    99104            event.stop(evt);
    100105            return false;
  • Dev/trunk/src/client/qed-client/pages/templates/previewSurvey.html

    r443 r457  
    1010    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" data-dojo-attach-point="questionsPane">
    1111        <form data-dojo-type="dijit/form/Form" data-dojo-attach-point="questionsForm" style="overflow: auto">
    12             <div data-dojo-type="../model/widgets/SurveyWidget" data-dojo-attach-point="surveyWidget"></div>
     12            <div data-dojo-type="../model/widgets/SurveyRenderWidget" data-dojo-attach-point="surveyWidget"></div>
    1313        </form>
    1414    </div>
  • Dev/trunk/src/client/qed-client/pages/templates/response.html

    r443 r457  
    1111        <form data-dojo-type="dijit/form/Form" data-dojo-attach-point="responseForm"
    1212              data-dojo-attach-event="onSubmit:_ignoreEvent" style="overflow: auto">
    13             <div data-dojo-type="../model/widgets/SurveyWidget" data-dojo-attach-point="surveyWidget"></div>
     13            <div data-dojo-type="../model/widgets/SurveyRenderWidget" data-dojo-attach-point="surveyWidget"></div>
    1414        </form>
    1515    </div>
  • Dev/trunk/src/client/qed-client/pages/templates/survey.html

    r443 r457  
    4040         data-dojo-attach-point="propertiesDialog"
    4141         data-dojo-attach-event="onSubmit:_onPropertiesOk">
    42         <fieldset data-dojo-type="../model/widgets/SurveyFieldset"></fieldset>
     42        <fieldset class="qedFieldset">
     43            <div data-dojo-type="../model/widgets/SurveyWidget"></div>
     44        </fieldset>
    4345        <button data-dojo-type="dijit/form/Button"
    4446                type="submit"
  • Dev/trunk/src/client/qed-client/pages/templates/surveyRun.html

    r443 r457  
    99   
    1010    <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
    11         <div data-dojo-type="../model/widgets/SurveySummary" data-dojo-attach-point="surveyNode"></div>
    12         <div data-dojo-type="dijit/form/Form"
    13              data-dojo-attach-point="propertiesForm">
    14             <fieldset data-dojo-type="../model/widgets/SurveyRunFieldset"></fieldset>
    15         </div>
    1611        <fieldset class="qedFieldset">
     12            <legend>Survey</legend>
     13            <div data-dojo-type="../model/widgets/SurveySummary" data-dojo-attach-point="surveySummaryWidget"></div>
     14        </fieldset>
     15        <fieldset class="qedFieldset">
     16            <legend>Run Details</legend>
     17            <div data-dojo-type="../model/widgets/SurveyRunWidget" data-dojo-attach-point="surveyRunWidget"></div>
     18        </fieldset>
     19        <fieldset class="qedFieldset">
     20            <legend>Response Details</legend>
    1721            <div><div class="qedLabel">General URL</div><div class="qedField" data-dojo-attach-point="runURLNode" style="overflow: ellipsis"></div></div>
    1822            <div><div class="qedLabel">Responses <span data-dojo-attach-point="responsesCountNode"></span></div><div class="qedField qedFill" data-dojo-attach-point="responsesNode"></div></div>
Note: See TracChangeset for help on using the changeset viewer.