Ignore:
Timestamp:
03/27/14 14:44:36 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Return to using truly ISO formatted dates, including milliseconds.
  • Also set constraint on surveyrun dates when value is initially set.
  • Separate runs & results from surveys and questions.
  • Moved date & email format to schema itself.
File:
1 edited

Legend:

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

    r529 r531  
    1818            this.draftsTab.set('title','Drafts (<span class="qedLoading"></span>)');
    1919            this.publishedTab.set('title','Published (<span class="qedLoading"></span>)');
    20             this.runsTab.set('title','Runs (<span class="qedLoading"></span>)');
    2120            this.refresh();
    2221        },
     
    5655        _onRunSurvey:function(survey){
    5756            var surveyRun = surveyRuns.create();
    58             surveyRun.title = 'Run of "' + survey.title + '" of '+(new Date().toString());
     57            surveyRun.title = 'Run of "'+survey.title+'" of '+
     58                              (new Date().toString());
    5959            surveyRun.survey = survey;
    6060            surveyRuns.save(surveyRun)
    6161            .then(lang.hitch(this,function(surveyRun){
    62                 this._onRunDetails(surveyRun);
    63             }),lang.hitch(this,function(err){
    64                 this.notify(err.error,'error');
    65             }));
    66         },
    67         _onRunDetails: function(surveyRun) {
    68             Router.go(surveyRuns.getObjectPath(surveyRun));
    69         },
    70         _onRunDelete: function(surveyRun) {
    71             if ( !confirm("Are you sure you want to delete this survey run?") ) {
    72                 return;
    73             }
    74             surveyRuns.remove(surveyRun)
    75             .then(lang.hitch(this,function(){
    76                 this.notify("SurveyRun successfully deleted.");
    77                 this.refreshRuns();
     62                Router.go(surveyRuns.getObjectPath(
     63                    surveyRuns.getId(surveyRun)));
    7864            }),lang.hitch(this,function(err){
    7965                this.notify(err.error,'error');
     
    8369            this.refreshDrafts();
    8470            this.refreshPublished();
    85             this.refreshRuns();
    8671        },
    8772        refreshDrafts: function() {
    88             this.draftsContainer.set('content','');
     73            this.draftsContainer.set('content','Loading draft surveys <span class="qedLoading"></span>');
    8974            when(surveys.query({drafts:true}), lang.hitch(this,function(surveys) {
    9075                this.draftsTab.set('title','Drafts ('+surveys.length+')');
     76                this.draftsContainer.set('content','');
    9177                array.forEach(surveys,function(survey){
    9278                    var w = new LineWithActionsWidget({
     
    127113        },
    128114        refreshPublished: function() {
    129             this.publishedContainer.set('content','');
     115            this.publishedContainer.set('content','Loading published surveys <span class="qedLoading"></span>');
    130116            when(surveys.query({published:true}), lang.hitch(this, function(surveys) {
     117                this.publishedContainer.set('content','');
    131118                this.publishedTab.set('title','Published ('+surveys.length+')');
    132119                array.forEach(surveys,function(survey){
     
    152139                },this);
    153140            }));
    154         },
    155         refreshRuns: function() {
    156             this.runsContainer.set('content','');
    157             when(surveyRuns.query(), lang.hitch(this,function(surveyRuns){
    158                 this.runsTab.set('title','Runs ('+surveyRuns.length+')');
    159                 array.forEach(surveyRuns,function(surveyRun){
    160                     var w = new LineWithActionsWidget({
    161                         title: surveyRun.title || "",
    162                         actions:[{
    163                             callback: lang.hitch(this,'_onRunDetails',surveyRun),
    164                             properties: {
    165                                 label: 'Details',
    166                                 tooltip: 'Show details for this run',
    167                                 icon: 'Edit'
    168                             }
    169                         },{
    170                             callback: lang.hitch(this,'_onRunDelete',surveyRun),
    171                             properties: {
    172                                 label: 'Delete',
    173                                 tooltip: 'Delete this run',
    174                                 icon: 'Delete'
    175                             }
    176                         }]
    177                     });
    178                     this.runsContainer.addChild(w);
    179                 },this);
    180             }));
    181141        }
    182142    });
Note: See TracChangeset for help on using the changeset viewer.