Browse Source

Fix JS for previous commit.

master
Ben Kurtovic 4 years ago
parent
commit
6d8e8443b1
2 changed files with 8 additions and 10 deletions
  1. +4
    -1
      static/main.js
  2. +4
    -9
      templates/_default.mako

+ 4
- 1
static/main.js View File

@@ -33,8 +33,11 @@ $(function() {

// Switch style immediately without reloading the page:
$("#style-options form").submit(function() {
var style = $(this).find('input[type="submit"]').prop("value");
var style = $(this).find('input[type="submit"]').data("style");
var stylesheet = "/static/styles/" + style + ".css";
$("#user-style").prop("href", stylesheet);
$("#style-options .cur").removeClass("cur").find(":submit")
.prop("disabled", false);
$(this).addClass("cur").find(":submit").prop("disabled", true);
});
});

+ 4
- 9
templates/_default.mako View File

@@ -15,15 +15,10 @@
stitle = style.title()
url = url_for('staticv', filename='images/style/{}.png'.format(style))
%>
% if style == cur_style:
<div class="cur">
<div style="background-image: url('${url}')">${stitle}</div>
</div>
% else:
<form action="${url_for('set_style', style=style)}" method="post">
<input type="submit" title="${stitle}" value="${stitle}" style="background-image: url('${url}')">
</form>
% endif
<form action="${url_for('set_style', style=style)}" method="post"${' class="cur"' if style == cur_style else ''}>
<input type="submit" title="${stitle}" value="${stitle}" data-style="${style}"${' disabled' if style == cur_style else ''}
style="background-image: url('${url}')">
</form>
% endfor
</div>
</div>


Loading…
Cancel
Save