source: Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorPreview.js @ 392

Last change on this file since 392 was 392, checked in by hendrikvanantwerpen, 13 years ago

Prevent duplication of questions on refresh in survey page.
Allow dragging by top bar only for QuestionEditorPreviewItems?.

File size: 1.2 KB
Line 
1define([
2    'dojo/_base/declare',
3    'dojo/_base/lang',
4    'dojo/dom-construct',
5    'dijit/registry',
6    './QuestionEditorPreviewItem',
7    './lists/OrderedList',
8    ], function(declare, lang, domConstruct, registry, QuestionEditorPreviewItem, OrderedList) {
9        return declare("rft.ui.QuestionEditorPreview", [OrderedList], {
10            baseClass: 'surveyEditorPreview',
11            type: 'questionContent',
12            withHandles: true,
13
14            _createAvatarNode: function(item) {
15                return domConstruct.create("span",{
16                    innerHTML: item.type || "Dragging!!!"
17                });
18            },
19            _createListNode: function(item) {
20                var previewItem = new QuestionEditorPreviewItem({
21                    item: item
22                });
23                previewItem.on('close',lang.hitch(this,'removeItem',item));
24                previewItem.startup();
25                return previewItem.domNode;
26            },
27            getItems: function() {
28                return this.source.getAllNodes()
29                .map(function(node){
30                    return registry.byNode(node).get('value');
31                },this);
32            }
33        });
34    });
Note: See TracBrowser for help on using the repository browser.