stubbed in view code from old danbooru; only janitors can lock a wiki page

This commit is contained in:
albert
2011-02-28 14:18:39 -05:00
parent 6d0157265c
commit 9e7efbd295
47 changed files with 1124 additions and 79 deletions

View File

@@ -1,21 +1,67 @@
<div class="post_versions">
<div class="index">
<h1>Post Versions</h1>
<table class="striped">
<div>
<div style="margin-bottom: 1em;">
<div class="history-search-row">
<div class="history-search-label">
<label for="user_name">User</label>
</div>
<div>
<% form_tag({:action => "index"}, :method => :get) do %>
<%= text_field_tag "user_name", params[:user_name], :id => "user_name", :size => 20 %> <%= submit_tag "Search" %>
<% end %>
</div>
</div>
<div class="history-search-row">
<div class="history-search-label">
<label for="post_id">Post ID</label>
</div>
<div>
<% form_tag({:action => "index"}, :method => :get) do %>
<%= text_field_tag "post_id", params[:post_id], :id => "post_id", :size => 10 %> <%= submit_tag "Search" %>
<% end %>
</div>
</div>
</div>
<div style="clear: left;">
<table width="100%" class="highlightable" id="history">
<thead>
<tr>
<th>Date</th>
<th>Updater</th>
<th>Changes</th>
<th width="1%"></th>
<th width="4%">Post</th>
<th width="15%">Date</th>
<th width="10%">User</th>
<th width="5%">Rating</th>
<th width="5%">Parent</th>
<th width="10%">IP Address</th>
<th width="50%">Tags</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="8">
<%= button_to_function "Undo", "PostTagHistory.undo()", :id => "undo" %>
<%= button_to_function "Revert to", "PostTagHistory.revert()", :id => "revert" %>
</td>
</tr>
</tfoot>
<tbody>
<% @post_versions.each do |post_version| %>
<tr>
<td><%= time_ago_in_words post_version.updated_at %></td>
<td><%= post_version.presenter.updater_name %></td>
<td><%= post_version.presenter.changes %></td>
<% @change_list.each do |change| %>
<tr class="<%= cycle 'even', 'odd' %>" id="r<%= change[:change].id %>" >
<td style="background: <%= id_to_color(change[:change].post_id) %>;"></td>
<td><%= link_to change[:change].post_id, :controller => "post", :action => "show", :id => change[:change].post_id %></td>
<td><%= change[:change].created_at.strftime("%Y-%m-%d %H:%M") %></td>
<td><%= link_to change[:change].author, :controller => "user", :action => "show", :id => change[:change].user_id %></td>
<td><%= change[:change].rating %></td>
<td><%= change[:parent_id] %></td>
<td>
<% if @current_user.is_admin? %>
<%= change[:ip_addr] %>
<% end %>
</td>
<td>
<span class="added-tags"><%= tag_list(change[:added_tags], :obsolete => change[:obsolete_added_tags], :prefix => "+") %></span>
<span class="removed-tags"><%= tag_list(change[:removed_tags], :obsolete=>change[:obsolete_removed_tags], :prefix=>"-") %></span>
<span class="unchanged-tags"><%= tag_list(change[:unchanged_tags], :prefix => "") %></span>
</td>
</tr>
<% end %>
</tbody>
@@ -23,3 +69,13 @@
</div>
</div>
<script type="text/javascript">
<% @change_list.each do |change| %>
PostTagHistory.add_change(<%= change[:change].id %>, <%= change[:change].post_id %>, '<%= escape_javascript(change[:change].author) %>')
<% end %>
PostTagHistory.init()
</script>
<div id="paginator">
<%= tag_history_pagination_links(@changes) %>
</div>