Skip to content

Commit aefd50c

Browse files
committed
More UI improvements
1 parent ff55fe7 commit aefd50c

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

template_previewer/static/css/template_previewer/preview.css

+1-5
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ body {
2525
cursor: default;
2626
margin-left: -0.8em;
2727
}
28-
#context-tree li.collapsed ul {
29-
display: none;
30-
}
31-
3228
#context-tree li input {
3329
float: right;
34-
width: 130px;
30+
width: 180px;
3531
}
3632
#context-tree label {
3733
font-family: "monospace";

template_previewer/static/js/template_previewer/previewer.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dust.filters.evenodd = function(body) {
1818
function toggleCollapsed() {
1919
/* Toggles collapsed/uncollapsed CSS class on the parent of $(this) */
2020
var listItem = $(this).parent();
21+
listItem.children("ul").slideToggle();
2122
if (listItem.hasClass("uncollapsed")) {
2223
listItem.removeClass("uncollapsed");
2324
listItem.addClass("collapsed");
@@ -45,7 +46,9 @@ function showContext(data) {
4546
$(function () {
4647
$("li > label").click(toggleCollapsed);
4748
});
48-
49+
/* Once we get the context, hide the button, show the preview one */
50+
$("#get-context").hide();
51+
$("#preview-submit").show();
4952
}
5053
}
5154
function getContext() {
@@ -97,8 +100,9 @@ $(function () {
97100
/* Bind UI elements */
98101
$("#get-context").click(getContext);
99102
$("#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);
102106

103107
/* If the template name is updated, the list of context vars must be
104108
* updated too. So show only the update button but not the preview button
@@ -108,10 +112,5 @@ $(function () {
108112
$("#get-context").show();
109113
$("#preview-submit").hide();
110114
})
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-
});
116115
});
117116

0 commit comments

Comments
 (0)