instiki/app/views/wiki/revision.rhtml

104 lines
3.4 KiB
Plaintext
Raw Normal View History

<% @title = "#{@page.plain_name} (Rev ##{@revision.number})" %>
<div id="revision">
<%= @revision.display_content %>
</div>
<div id="changes" style="display: none">
<p style="background: #eee; padding: 3px; border: 1px solid silver">
<small>
Showing changes from revision #<%= @revision.number - 1 %> to #<%= @revision.number %>:
<ins class="diffins">Added</ins> | <del class="diffdel">Removed</del>
</small>
</p>
<%= @revision.display_diff %>
</div>
<div class="byline">
<%= "Revision from #{@revision.pretty_created_at} by" %>
<%= link_to_page @revision.author %>
</div>
<div class="navigation">
<% if @revision.next_revision %>
<% if @revision.next_revision.number < (@page.revisions.length - 1) %>
<%= link_to('Forward in time',
{:web => @web.address, :action => 'revision', :id => @page.name,
:rev => @revision.next_revision.number},
{:class => 'navlink', :name => 'to_next_revision'})
%>
<% else %>
<%= link_to('Forward in time',
{:web => @web.address, :action => 'show', :id => @page.name},
{:class => 'navlink', :name => 'to_next_revision'})
%>
<% end %>
<small>(<%= @revision.page.revisions.length - @revision.next_revision.number %> more)</small>
<% end %>
<% if @revision.next_revision && @revision.previous_revision %>
|
<% end %>
<% if @revision.previous_revision %>
<%= link_to('Back in time',
{:web => @web.address, :action => 'revision', :id => @page.name,
:rev => @revision.previous_revision.number},
{:class => 'navlink', :name => 'to_previous_revision'})
%>
<small>(<%= @revision.previous_revision.number + 1 %> more)</small>
<% end %>
|
<%= link_to('See current', {:web => @web.address, :action => 'show', :id => @page.name},
{:class => 'navlink', :name => 'to_current_revision'})
%>
<% if @revision.previous_revision %>
<span id="show_changes">
| <a href="#" onClick="toggleChanges(); return false;">See changes</a>
</span>
<span id="hide_changes" style="display: none">
| <a href="#" onClick="toggleChanges(); return false;">Hide changes</a>
</span>
<% end %>
|
<%= link_to('Rollback',
{:web => @web.address, :action => 'rollback', :id => @page.name, :rev => @revision.number},
{:class => 'navlink', :name => 'rollback'})
%>
<% if @page.references.length > 0 %>
<small>
| Linked from:
<%= @page.references.collect { |ref|
link_to ref.name, :web => @web.address, :action => 'show', :id => ref.name
}.join(", ")
%>
</small>
<% else %>
Orphan page
<% end %>
</div>
<script language="Javascript">
function toggleChanges() {
if (document.getElementById("changes").style.display == "none") {
document.getElementById("changes").style.display = "block";
document.getElementById("revision").style.display = "none";
document.getElementById("show_changes").style.display = "none";
document.getElementById("hide_changes").style.display = "inline";
} else {
document.getElementById("changes").style.display = "none";
document.getElementById("revision").style.display = "block";
document.getElementById("show_changes").style.display = "inline";
document.getElementById("hide_changes").style.display = "none";
}
}
</script>