71 lines
2.0 KiB
Plaintext
71 lines
2.0 KiB
Plaintext
<%= render :partial => "sidebar" %>
|
|
|
|
<div class="content">
|
|
<% form_tag({:action => "diff"}, :method => :get) do %>
|
|
<%= hidden_field_tag "title", params[:title] %>
|
|
|
|
<table width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th width="5%">From</th>
|
|
<th width="5%">To</th>
|
|
<th width="10%">IP Address</th>
|
|
<th width="80%">Last edited</th>
|
|
</tr>
|
|
</thead>
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="2"><%= submit_tag "Compare" %></td>
|
|
</tr>
|
|
</tfoot>
|
|
<tbody>
|
|
<% @wiki_pages.each_with_index do |wiki_page, i| %>
|
|
<tr class="<%= cycle 'even', 'odd' %>">
|
|
<td><%= radio_button_tag "from", wiki_page.version, i==1, :id => "from_#{wiki_page.version}" %></td>
|
|
<td><%= radio_button_tag "to", wiki_page.version, i==0, :id => "to_#{wiki_page.version}" %></td>
|
|
<td>
|
|
<% if @current_user.is_admin? %>
|
|
<%= h wiki_page.ip_addr %>
|
|
<% end %>
|
|
</td>
|
|
<td><%= link_to wiki_page.updated_at.strftime("%m/%d/%Y %I:%M"), :action => "show", :title => wiki_page.title, :version => wiki_page.version %> by <%= link_to h(wiki_page.author), :controller => "user", :action => "show", :id => wiki_page.user_id %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% end %>
|
|
|
|
<script type="text/javascript">
|
|
var from;
|
|
var to;
|
|
|
|
function validateFrom(self)
|
|
{
|
|
if(Number(self.value) >= to) return false;
|
|
from = new Number(self.value);
|
|
return true;
|
|
}
|
|
|
|
function validateTo(self)
|
|
{
|
|
if(Number(self.value) <= from) return false;
|
|
to = new Number(self.value);
|
|
return true;
|
|
}
|
|
|
|
for(var i=1, elem; i <= <%= @wiki_pages.length %>; i++)
|
|
{
|
|
elem = $("from_"+i);
|
|
elem.onclick = function() {return validateFrom(this);};
|
|
if(elem.checked) from = i;
|
|
|
|
elem = $("to_"+i);
|
|
elem.onclick = function() {return validateTo(this);};
|
|
if(elem.checked) to = i;
|
|
}
|
|
</script>
|
|
</div>
|
|
|
|
|
|
<%= render :partial => "footer" %>
|