Ignore:
Timestamp:
03/23/12 17:26:55 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Mockup included.

Location:
Dev/branches/rest-dojo-ui/client/rft/pages
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/pages/questions.js

    r305 r316  
    1010                this._store = store.getStore('Question');
    1111                this._list = new AccordionList({
    12                     store: this._store,
    1312                    actions: {
    1413                        'Edit': lang.hitch(this,'_editQuestion')
    1514                    },
     15                    idProperty: this._store.idProperty,
    1616                    categoryProperty: 'category',
    1717                    titleProperty: 'title'
     
    2121            },
    2222            _refresh: function() {
    23                 this._list.refresh();
     23                Deferred.when(this._store.query())
     24                .then(lang.hitch(this,function(items){
     25                    this._list.setItems(items);
     26                }));
    2427            },
    2528            onNewQuestion: function() {
  • Dev/branches/rest-dojo-ui/client/rft/pages/survey.html

    r303 r316  
    11<div data-dojo-type="rft.pages.survey">
    22    <h1 data-rft-attach-point="header">(default)</h1>
    3     <div>Created by <span data-rft-attach-point="creator"></span><div>
     3    <div>Created by <span data-rft-attach-point="creator"></span></div>
    44    <form data-dojo-type="dijit.form.Form" data-rft-attach-point="form" data-rft-attach-event="onSubmit:onSave">
    55        <div style="display: block; clear: both;">
     
    1111        <label for="description" class="loginLabel">Description</label>
    1212        <textarea name="description" data-dojo-type="dijit.form.SimpleTextarea" class="loginInput"></textarea>
     13        <div>
     14            <div style="width: 45%; float: left; clear: left;"><div data-rft-attach-point="allQuestions"></div></div>
     15            <div style="width: 45%; float: left;"><div data-rft-attach-point="surveyQuestions"></div></div>
     16        </div>
    1317    </form>
    1418</div>
  • Dev/branches/rest-dojo-ui/client/rft/pages/survey.js

    r311 r316  
    1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dojo/_base/Deferred','rft/store','rft/ui/_Page','rft/api'],
    2     function(declare,lang,event,Deferred,store,_Page,api){
     1define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event',
     2    'dojo/_base/Deferred','rft/ui/AccordionList','rft/ui/LineWithActionsWidget',
     3    'rft/store','rft/ui/_Page','rft/api'],
     4    function(declare,lang,event,Deferred,AccordionList,LineWithActionsWidget,store,_Page,api){
    35        return declare('rft.pages.survey',[_Page],{
    46            object: null,
    57            postCreate: function() {
    68                this.inherited(arguments);
    7                 this._store = store.getStore('Survey');
     9                this._surveyStore = store.getStore('Survey');
     10                this._questionStore = store.getStore('Question');
    811            },
    912            onVisit: function() {
    1013                if ( this.pageArgs.uid ) {
    11                     Deferred.when(this._store.get(this.pageArgs.uid))
     14                    Deferred.when(this._surveyStore.get(this.pageArgs.uid))
    1215                    .then(lang.hitch(this,function(obj){
    1316                        this.object = obj;
     
    1720                    .then(lang.hitch(this,function(obj){
    1821                        this.creator.innerHTML = (obj && obj.email) || 'unknown';
     22                    }));
     23                    Deferred.when(this._questionStore.query())
     24                    .then(lang.hitch(this,function(items){
     25                        this._questionList = new AccordionList({
     26                            store: this._surveyStore,
     27                            actions: {
     28                                'Add': lang.hitch(this,'_addQuestion')
     29                            },
     30                            idProperty: this._questionStore.idProperty,
     31                            categoryProperty: 'category',
     32                            titleProperty: 'title'
     33                        },this.allQuestions);
     34                        this._questionList.startup();
     35                        this._questionList.setItems(items);
    1936                    }));
    2037                } else {
     
    4259                this.header.innerHTML = "Edit survey '"+(obj.title || '(undefined)')+"'";
    4360                obj && this.form.set('value',obj);
     61            },
     62            _addQuestion: function(obj) {
     63                var d = {};
     64                d.widget = new LineWithActionsWidget({
     65                    title:obj.title,
     66                    userObj: obj,
     67                    actions:{
     68                        "Remove": lang.hitch(this,'_removeQuestion',d)
     69                    }
     70                });
     71                d.widget.placeAt(this.surveyQuestions);
     72            },
     73            _removeQuestion: function(data,obj) {
     74                data.widget.destroy();
    4475            }
    4576        });
Note: See TracChangeset for help on using the changeset viewer.