Changeset 421


Ignore:
Timestamp:
12/27/12 17:46:05 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Show responses with links in SurveyRun? overview.

Location:
Dev/branches/rest-dojo-ui
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/admin.html

    r420 r421  
    22<html>
    33    <head>
    4         <title>QED</title>
     4        <title>QED - Researcher</title>
    55        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    66        <link rel="stylesheet" type="text/css" href="qed/css/main.css" />
  • Dev/branches/rest-dojo-ui/client/qed/css/hva-mods.css

    r420 r421  
    1818}
    1919
     20#rft.claro .qedField.qedFill {
     21    width: 350px;
     22}
     23
    2024#rft.claro .qedFieldset {
    2125    margin: 1em 0px;
  • Dev/branches/rest-dojo-ui/client/qed/main-admin.js

    r420 r421  
    66    'qed/app/Router',
    77    'qed/ui/MainMenu',
    8     'qed/routes',
     8    'qed/routes-admin',
    99    'qed/store',
    1010    'qed/stddeps',
  • Dev/branches/rest-dojo-ui/client/qed/model/widgets/QuestionWidgetFactory.js

    r417 r421  
    353353
    354354    var MultipleChoiceInputEdit = declare([_WidgetBase, _Container], {
    355         _codeInput: null,
    356355        _multipleInput: null,
    357356        postCreate: function() {
    358357            var table = new TableContainer({ cols: 1, customClass: "labelsAndValues"} );
    359 
    360             this._codeInput = new TextBox({
    361                 title: "Code"
    362             });
    363             table.addChild(this._codeInput);
    364             this._codeInput.startup();
    365358
    366359            this._multipleInput = new CheckBox({
     
    390383
    391384        _setValueAttr: function(value) {
    392             this._codeInput.set('value', value.code || "");
    393385            this._multipleInput.set('checked', value.multiple);
    394386            this._optionsList.deleteItems();
     
    398390            return {
    399391                type: "MultipleChoiceInput",
    400                 code: this._codeInput.get('value') || "",
    401392                multiple: this._multipleInput.get('checked'),
    402393                items: array.map(this._optionsList.getItems(),function(item){
  • Dev/branches/rest-dojo-ui/client/qed/pages/surveyRun.js

    r420 r421  
    1010    '../app/Page',
    1111    '../model/classes/SurveyRun',
     12    '../widgets/LineWithActionsWidget',
    1213    'dojo/text!./templates/surveyRun.html'
    13 ],function(declare,event,lang,when,Content,Router,func,store,Page,SurveyRun,template){
     14],function(declare,event,lang,when,Content,Router,func,store,Page,SurveyRun,LineWithActionsWidget,template){
    1415    return declare([Page],{
    1516        templateString: template,
     
    2122            if ( this.surveyRunId ) {
    2223                this._loadSurveyRun();
     24                this._loadResponses();
    2325            } else {
    2426                throw "No valid uid or survey passed!";
     
    2931            .then(lang.hitch(this,function(surveyRun){
    3032                this.surveyRun = surveyRun;
    31                 this.refresh();
     33                this.refreshSurveyRun();
    3234            }));
    3335        },
    34         refresh: function() {
     36        refreshSurveyRun: function() {
    3537            this.titleNode.innerHTML = SurveyRun.DisplayTitle.get(this.surveyRun);
    3638            this.surveyNode.set('value',SurveyRun.Survey.get(this.surveyRun));
     
    3840            this._onPropChange();
    3941        },
     42        _loadResponses: function() {
     43            when(store.query("_design/responses/_view/by_surveyrun",{key:this.surveyRunId}))
     44            .forEach(lang.hitch(this,function(response){
     45                var actions = {
     46                    view: {
     47                        callback: function(){},
     48                        properties: {
     49                            title: "View response"
     50                        }
     51                    }
     52                };
     53                if ( !response.publicationDate ) {
     54                    actions.remove = {
     55                        callback: function(){},
     56                        properties: {
     57                            title: "Remove response"
     58                        }
     59                    };
     60                }
     61                var w = new LineWithActionsWidget({
     62                    actions: actions
     63                });
     64                var responseId = store.getIdentity(response);
     65                w.set('title',this._link(this._getResponseURL(this.surveyRunId,responseId),responseId));
     66                w.placeAt(this.responsesNode);
     67            }));
     68        },
    4069        _onPropChange: function(e) {
    4170            var surveyRun = this.propertiesForm.get('value');
    4271            if ( surveyRun.mode === "open" ) {
    43                 var url = 'response.html#!/'+store.getIdentity(this.surveyRun);
    44                 this.runURLNode.innerHTML = '<a target="_black" href="'+url+'">'+url+'</a>';
     72                this.runURLNode.innerHTML = this._link(this._getGeneralURL(store.getIdentity(this.surveyRun)));
    4573            } else {
    4674                this.runURLNode.innerHTML = "No general URL. Add individual respondents below.";
    4775            }
     76        },
     77        _getGeneralURL: function(surveyRunId) {
     78            return 'response.html#!/'+surveyRunId;
     79        },
     80        _getResponseURL: function(surveyRunId,responseId) {
     81            return 'response.html#!/'+surveyRunId+'!id='+responseId;
     82        },
     83        _link: function(url,label) {
     84            return '<a target="_black" href="'+url+'">'+(label || url)+'</a>';
    4885        },
    4986        _onSave: function(evt) {
  • Dev/branches/rest-dojo-ui/client/qed/pages/templates/surveyRun.html

    r420 r421  
    1616        <fieldset class="qedFieldset">
    1717            <div><div class="qedLabel">General URL</div><div class="qedField" data-dojo-attach-point="runURLNode" style="overflow: ellipsis"></div></div>
     18            <div><div class="qedLabel">Responses <span data-dojo-attach-point="responsesCountNode"></span></div><div class="qedField qedFill" data-dojo-attach-point="responsesNode"></div>
    1819        </fieldset>
    1920    </div>
  • Dev/branches/rest-dojo-ui/client/response.html

    r420 r421  
    22<html>
    33    <head>
    4         <title>Survey</title>
     4        <title>QED - Respondent</title>
    55        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    66        <link rel="stylesheet" type="text/css" href="qed/css/main.css" />
  • Dev/branches/rest-dojo-ui/server/couchdb-admin/config/data/design-docs.js

    r415 r421  
    100100                }
    101101            }
     102        },
     103        "qed/_design/responses": {
     104            __configAction: "replace",
     105            _id: "_design/responses",
     106            language: "javascript",
     107            views: {
     108                by_surveyrun: {
     109                    map: function(doc){
     110                        if ( doc.type !== 'Response' ) { return; }
     111                        emit(doc.surveyRunId, doc);
     112                    }
     113                }
     114            }
    102115        }
    103116    };
Note: See TracChangeset for help on using the changeset viewer.