source: Dev/branches/rest-dojo-ui/client/rft/ui/SurveyEditorPreviewItem.js @ 356

Last change on this file since 356 was 355, checked in by tjcschipper, 13 years ago
  • surveyEditor more or less works! Only needed change is addition of "topic" property in question objects (database-side), and the change from "category"(string) to "categories"(string[]).
  • surveyEditor still needs removal function and infofunction to be written properly!
  • Added all files belonging to SurveyAdvanced?. Most do not work properly yet, but at least there will not be a 404 page when you click btnPreview on survey.html.
File size: 1.9 KB
Line 
1define([
2        'dojo/_base/declare',
3        'dojo/_base/fx',
4        'dijit/_WidgetBase',
5        'dojo/dom-class',
6        'dojo/_base/lang',
7        'dijit/_TemplatedMixin',
8        'dijit/_WidgetsInTemplateMixin',
9        'dojo/text!./templates/SurveyEditorPreviewItem.html',
10        ], function(declare, fx, _WidgetBase, domClass, lang, _TemplatedMixin, _WidgetsInTemplateMixin, templateFull) {
11                return declare("rft.ui.SurveyEditorPreviewItem", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
12
13                        version: "full",
14                        templateString: templateFull,
15                        baseClass: "surveyEditorPreviewItem",
16                        previousContentHeight: 200,
17                        innerWidget: null,
18                        foldDuration: [250, 250],
19                        animation: null,
20                       
21                        postCreate: function() {
22                                this.foldButtonNode.onClick = lang.hitch(this, this.toggleFold);
23                        },
24                        toggleFold: function() {
25                                if (!this.animation) {
26                                        if (!domClass.contains(this.domNode, "fold")) {
27                                                this.previousContentHeight = dojo.marginBox(this.innerNode).h;
28                                                this.animation = fx.animateProperty({
29                                                        node: this.innerNode,
30                                                        duration: this.foldDuration[0],
31                                                        properties: {
32                                                                height: 1                                               
33                                                        },
34                                                        onEnd: lang.hitch(this, function(){
35                                                                domClass.add(this.domNode, "fold");
36                                                                this.animation = null;
37                                                        })
38                                                }).play();
39                                                this.foldButtonNode.iconNode.className = this.foldButtonNode.iconNode.className.replace("rftIconHalfArrowUp", "rftIconHalfArrowDown");
40                                        } else {
41                                                this.animation = fx.animateProperty({
42                                                        node: this.innerNode,
43                                                        duration: this.foldDuration[1],
44                                                        properties: {
45                                                                height: this.previousContentHeight                             
46                                                        },
47                                                        onEnd: lang.hitch(this, function(){
48                                                                domClass.remove(this.domNode, "fold");
49                                                                this.animation = null;
50                                                        })
51                                                }).play();
52                                                this.foldButtonNode.iconNode.className = this.foldButtonNode.iconNode.className.replace("rftIconHalfArrowDown", "rftIconHalfArrowUp");
53                                        }
54                                }
55                        },
56
57                });
58});
Note: See TracBrowser for help on using the repository browser.