* Add a basic index page at https://danbooru.donmai.us/media_assets. * Add a basic show page at https://danbooru.donmai.us/media_assets/1. * Add ability to search /media_assets.json by metadata. Example: ** https://danbooru.donmai.us/media_assets.json?search[metadata][File:ColorComponents]=3 * Add a "»" link next to the filesize on posts linking to the metadata page. Known issues: * Sometimes the MD5 links on the /media_assets page return "That record was not found" errors. These are unfinished uploads that haven't been made into posts yet. * No good way to search for custom metadata fields in the search form. * Design is ugly.
20 lines
615 B
Plaintext
20 lines
615 B
Plaintext
<div id="c-media-assets">
|
|
<div id="a-show" class="fixed-width-container">
|
|
<h1 class="mb-4">Media Asset</h1>
|
|
|
|
<% if @post.present? %>
|
|
<%= post_preview(@post, show_deleted: true) %>
|
|
<% else %>
|
|
<p>MD5: <%= link_to @media_asset.md5, posts_path(md5: @media_asset.md5) %></p>
|
|
<% end %>
|
|
|
|
<table class="striped aligned-vertical">
|
|
<% @media_asset.metadata.sort.each do |key, value| %>
|
|
<tr>
|
|
<th><%= key %></th>
|
|
<td><%= link_to value, media_assets_path(search: { metadata: { key => value }}) %></td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
</div>
|
|
</div> |