Files
danbooru/app/views/post_versions/index.html.erb

82 lines
3.1 KiB
Plaintext

<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 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>
<% @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>
</table>
</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>