Javascript goodies for History page.
This commit is contained in:
@@ -505,6 +505,10 @@ table.commits {
|
||||
background-color: #eaf2f5;
|
||||
}
|
||||
|
||||
table.commits tr.selected td {
|
||||
background-color: #FEFFE6;
|
||||
}
|
||||
|
||||
table.commits th {
|
||||
font-weight: normal;
|
||||
border-bottom: 1px solid #ccc;
|
||||
|
||||
@@ -204,4 +204,38 @@ $(function(){
|
||||
})
|
||||
|
||||
$('ul.inline-tabs').tabs()
|
||||
|
||||
var selectedRevisions = []
|
||||
|
||||
$('form#history input[type=checkbox]').change(function() {
|
||||
var id = $(this).val()
|
||||
var i = selectedRevisions.indexOf(id)
|
||||
|
||||
if (i > -1) {
|
||||
selectedRevisions.splice(i, 1)
|
||||
} else {
|
||||
selectedRevisions.push(id)
|
||||
if (selectedRevisions.length > 2) {
|
||||
var shiftedId = selectedRevisions.shift()
|
||||
$('input[value=' + shiftedId + ']').attr('checked', false)
|
||||
}
|
||||
}
|
||||
|
||||
$('form#history tr.commit').removeClass("selected")
|
||||
$('form#history input[type=submit]').attr('disabled', true)
|
||||
|
||||
if (selectedRevisions.length == 2) {
|
||||
$('form#history input[type=submit]').attr('disabled', false)
|
||||
var on = false
|
||||
$('form#history tr.commit').each(function() {
|
||||
if (on) { $(this).addClass("selected") }
|
||||
|
||||
if ($(this).find('input:checked').length > 0) {
|
||||
on = !on
|
||||
}
|
||||
|
||||
if (on) { $(this).addClass("selected") }
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<a href="/{{name}}">« Back</a>
|
||||
</div>
|
||||
<h1>History of {{human_name}}</h1>
|
||||
<form method="post" action="/compare/{{name}}">
|
||||
<form id="history" method="post" action="/compare/{{name}}">
|
||||
<table class="commits" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th colspan="5">
|
||||
Select any two versions to <input type="submit" value="Compare" />
|
||||
Select any two versions to <input type="submit" value="Compare" disabled />
|
||||
</th>
|
||||
{{#versions}}
|
||||
<tr>
|
||||
<tr class="commit">
|
||||
<td class="checkbox">
|
||||
<input name="versions[]" type="checkbox" value="{{id}}" />
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user