Different preferences per rate/chart.

This commit is contained in:
Simon MacMullen 2012-12-12 12:59:03 +00:00
parent 843bc745fc
commit f906dda156
4 changed files with 12 additions and 8 deletions

View File

@ -48,7 +48,8 @@ function render_chart(div) {
}
function update_rate_options(sammy) {
store_pref('rate-mode', sammy.params['mode']);
store_pref('chart-size', sammy.params['size']);
var id = sammy.params['id'];
store_pref('rate-mode-' + id, sammy.params['mode']);
store_pref('chart-size-' + id, sammy.params['size']);
partial_update();
}

View File

@ -570,7 +570,7 @@ function rates_chart_or_text(id, stats, items, rates_counts) {
if (keys(stats).length > 0) {
var res;
var mode = get_pref('rate-mode');
var mode = get_pref('rate-mode-' + id);
if (mode == 'chart') {
res = rates_chart(id, items, stats, rates_counts);
}
@ -585,11 +585,12 @@ function rates_chart_or_text(id, stats, items, rates_counts) {
res = '<p>Currently idle</p>';
}
return res + '<p class="rate-options-p"><span class="rate-options">(...)</span></p>';
return res + '<p class="rate-options-p"><span class="rate-options" for="' +
id + '">(...)</span></p>';
}
function rates_chart(id, items, stats, rates_counts) {
var size = get_pref('chart-size');
var size = get_pref('chart-size-' + id);
var show = false;
chart_data[id] = {};
for (var i in items) {

View File

@ -435,7 +435,7 @@ function postprocess() {
help($(this).attr('id'))
});
$('.rate-options').die().live('click', function() {
show_popup('help', format('rate-options', {}));
show_popup('help', format('rate-options', {span: $(this)}));
});
$('input, select').live('focus', function() {
update_counter = 0; // If there's interaction, reset the counter.

View File

@ -1,9 +1,11 @@
<%
var mode = get_pref('rate-mode');
var size = get_pref('chart-size');
var id = span.attr('for');
var mode = get_pref('rate-mode-' + id);
var size = get_pref('chart-size-' + id);
%>
<form action="#/rate-options" method="put" class="auto-submit">
<input type="hidden" name="id" value="<%= id %>"/>
<table class="form">
<tr>
<th><label>Display:</label></th>