Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Update the dropbox with the actual status immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
vpit committed Jul 30, 2010
1 parent 6864851 commit 0a59305
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cherrymaint.pm
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ get '/mark' => sub {
}
$data->{$commit} = $state;
save_datafile($data);
return join ' ', @{ $state->[1] || [] };
return join ' ', $state->[0], @{ $state->[1] || [] };
};

true;
36 changes: 26 additions & 10 deletions views/index.tt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
<script type="text/javascript">
var statusList = [
'Unexamined',
'Rejected',
'Requested',
'Seconded',
'Approved',
'Cherry-picked',
'To be discussed',
];
function markCommit(commit,value) {
$.ajax({
url: '/mark?commit=' + commit + '&value=' + value,
Expand All @@ -7,15 +16,22 @@ function markCommit(commit,value) {
cache: false,
async: false,
success: function(res) {
$('#tr' + commit).removeClass("status0");
$('#tr' + commit).removeClass("status1");
$('#tr' + commit).removeClass("status2");
$('#tr' + commit).removeClass("status3");
$('#tr' + commit).removeClass("status4");
$('#tr' + commit).removeClass("status5");
$('#tr' + commit).removeClass("status6");
$('#tr' + commit).addClass('status' + value);
$('#votes' + commit).html(res);
var tokens = res.split(' ');
var status = tokens.shift();
var voters = tokens.join(' ');
for (var i = 0; i < statusList.length; i++) {
$('#tr' + commit).removeClass("status" + i);
}
$('#tr' + commit).addClass('status' + status);
$('#votes' + commit).html(voters);
var options = '';
for (var i = 0; i < statusList.length; i++) {
var selected = i == status ? 'selected' : '';
options += '<option value="' + i + '" ' + selected + '>'
+ statusList[i]
+ '</option>';
}
$('#pick' + commit).html(options);
},
error: function(req, st, error) {
alert("Couldn't update the DB");
Expand All @@ -28,7 +44,7 @@ function markCommit(commit,value) {
<% FOREACH commit IN commits %>
<tr id="tr<% commit.sha1 %>" class="status<% commit.status %>">
<td>
<select name="status<% commit.sha1 %>" onChange="markCommit('<% commit.sha1 %>',this.value)">
<select id="pick<% commit.sha1 %>" onChange="markCommit('<% commit.sha1 %>',this.value)">
<option value="0" <% commit.status == 0 ? "selected" : "" %>>Unexamined</option>
<option value="1" <% commit.status == 1 ? "selected" : "" %>>Rejected</option>
<option value="2" <% commit.status == 2 ? "selected" : "" %>>Requested</option>
Expand Down

0 comments on commit 0a59305

Please sign in to comment.