source: Dev/trunk/client/qed/model/widgets/QuestionEditorPreview.js @ 441

Last change on this file since 441 was 441, checked in by hendrikvanantwerpen, 12 years ago

Big cleanup of the question content.

  • Replaced old list implementations with a new one that behaves like a form widget.
  • All question content is now in separate widgets, not in the factory itself.
  • Added form and widget validation for question editing.
File size: 1018 bytes
Line 
1define([
2    "../../widgets/ListWidget",
3    "./QuestionEditorPreviewItem",
4    "dijit/registry",
5    "dojo/_base/array",
6    "dojo/_base/declare",
7    "dojo/_base/lang",
8    "dojo/dom-construct"
9], function(ListWidget, QuestionEditorPreviewItem, registry, array, declare, lang, domConstruct) {
10    return declare([ListWidget], {
11        baseClass: 'surveyEditorPreview',
12        type: 'questionContent',
13        withHandles: true,
14
15        createAvatar: function(id, item) {
16            return domConstruct.create("div",{
17                innerHTML: item.type || "(unkown)"
18            });
19        },
20        createListElement: function(id, item) {
21            var previewItem = new QuestionEditorPreviewItem({
22                id: id,
23                value: item
24            });
25            this.own(previewItem.on('destroy',
26                                    lang.hitch(this,'removeItem',id)));
27            previewItem.startup();
28            return previewItem;
29        }
30    });
31});
Note: See TracBrowser for help on using the repository browser.