add revert button, omg its fugly

This commit is contained in:
rick
2010-12-09 18:06:11 -08:00
parent 19ef3710c3
commit d0475a45ed
5 changed files with 15 additions and 48 deletions
+1 -16
View File
@@ -291,7 +291,7 @@ a:hover, a:visited {
}
#wiki-history table tr td.commit-name {
border-right: none;
border-left: 0;
}
#wiki-history table tr td.commit-name span.time-elapsed {
@@ -329,21 +329,6 @@ a:hover, a:visited {
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
padding: 0 0.2em;
}
#wiki-history table tr td.revert-action {
border-left: 0;
min-width: 10em;
text-align: right;
}
#wiki-history table tr td.revert-action a {
font-weight: bold;
}
#wiki-history table tr td.revert-action a span {
font-size: 0.9em;
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
}
.history #wiki-history ul.actions li,
.history #footer ul.actions li {
@@ -50,28 +50,6 @@ $(document).ready(function() {
if ($('#wiki-wrapper').hasClass('history')) {
$('#wiki-history td.checkbox input').click(highlightChecked);
$('#wiki-history td.revert-action a').mouseenter(highlightOn);
$('#wiki-history td.revert-action a').mouseleave(highlightOff);
if ($('td.revert-action a').length) {
$('td.revert-action a').click(function(e) {
e.preventDefault();
var commitSha = $(this).attr('rel');
var truncatedSha = commitSha.toString().substr(0, 7);
// revert action
$.GollumDialog.init({
title: 'Reset to ' + truncatedSha + '?',
body: 'Are you sure you wish to reset to commit <code>' +
truncatedSha + '</code>' +
' ? This will overwrite any previous changes.',
OK: function() {
// TODO add async endpoint to revert here
}
});
});
}
if ($('.history a.action-compare-revision').length) {
$('.history a.action-compare-revision').click(function() {
+11 -4
View File
@@ -1,10 +1,17 @@
<div id="wiki-wrapper" class="compare">
<div id="head">
<h1>History for <strong>{{path}}</strong></h1>
<ul class="actions">
<li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Back to Page History</a></li>
</ul>
<form name="gollum-revert" action="/revert/{{escaped_name}}/{{before}}/{{after}}" method="post">
<div id="gollum-editor">
<ul class="actions">
<li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Back to Page History</a></li>
<li class="minibutton">
<input type="submit" id="gollum-editor-submit" value="Revert" title="Save current changes">
</li>
</ul></div>
</form>
{{>searchbar}}
</div>
<div id="compare-content">
@@ -39,9 +39,6 @@
{{message}}
[<a href="/{{escaped_name}}/{{id}}" title="View commit">{{id7}}</a>]
</td>
<td class="revert-action">
<a href="#" title="Reset to this change" rel="{{id}}">Reset to <span>{{id7}}</span></a>
</td>
</tr>
{{/versions}}
+3 -3
View File
@@ -22,10 +22,10 @@ module Precious
def lines
lines = []
@diff.diff.split("\n")[2..-1].each_with_index do |line, line_index|
lines << { :line => line,
lines << { :line => line,
:class => line_class(line),
:ldln => left_diff_line_number(0, line),
:rdln => right_diff_line_number(0, line) }
:ldln => left_diff_line_number(0, line),
:rdln => right_diff_line_number(0, line) }
end if @diff
lines
end