@@ -18,6 +18,7 @@ dust.filters.evenodd = function(body) {
18
18
function toggleCollapsed ( ) {
19
19
/* Toggles collapsed/uncollapsed CSS class on the parent of $(this) */
20
20
var listItem = $ ( this ) . parent ( ) ;
21
+ listItem . children ( "ul" ) . slideToggle ( ) ;
21
22
if ( listItem . hasClass ( "uncollapsed" ) ) {
22
23
listItem . removeClass ( "uncollapsed" ) ;
23
24
listItem . addClass ( "collapsed" ) ;
@@ -45,7 +46,9 @@ function showContext(data) {
45
46
$ ( function ( ) {
46
47
$ ( "li > label" ) . click ( toggleCollapsed ) ;
47
48
} ) ;
48
-
49
+ /* Once we get the context, hide the button, show the preview one */
50
+ $ ( "#get-context" ) . hide ( ) ;
51
+ $ ( "#preview-submit" ) . show ( ) ;
49
52
}
50
53
}
51
54
function getContext ( ) {
@@ -97,8 +100,9 @@ $(function () {
97
100
/* Bind UI elements */
98
101
$ ( "#get-context" ) . click ( getContext ) ;
99
102
$ ( "#preview-submit" ) . click ( sendContext ) ;
100
- $ ( "#hide-preview" ) . click ( function ( ) { $ ( "#preview-ui" ) . toggle ( ) ; } ) ;
101
- $ ( "#show-preview" ) . click ( function ( ) { $ ( "#preview-ui" ) . toggle ( ) ; } ) ;
103
+ var togglePreview = function ( ) { $ ( "#preview-ui" ) . fadeToggle ( ) ; } ;
104
+ $ ( "#hide-preview" ) . click ( togglePreview ) ;
105
+ $ ( "#show-preview" ) . click ( togglePreview ) ;
102
106
103
107
/* If the template name is updated, the list of context vars must be
104
108
* updated too. So show only the update button but not the preview button
@@ -108,10 +112,5 @@ $(function () {
108
112
$ ( "#get-context" ) . show ( ) ;
109
113
$ ( "#preview-submit" ) . hide ( ) ;
110
114
} )
111
- /* Once we get the context, hide the button, show the preview one */
112
- $ ( "#get-context" ) . click ( function ( ) {
113
- $ ( "#get-context" ) . hide ( ) ;
114
- $ ( "#preview-submit" ) . show ( ) ;
115
- } ) ;
116
115
} ) ;
117
116
0 commit comments