Add artist commentary, fixes #2024

This commit is contained in:
Toks
2013-11-19 10:37:02 -05:00
parent fab4e81669
commit fd4c8c3cd3
16 changed files with 347 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<p>If the artist of this image posted some interesting additional information about this work, you can copy it here.</p>
<%= form_tag(create_or_update_artist_commentaries_path, :class => "simple_form", :method => :put) do %>
<div class="input">
<%= hidden_field :artist_commentary, :post_id, :value => @post.id %>
<label for="artist_commentary_original_title">Original title</label>
<%= text_field :artist_commentary, :original_title, :value => artist_commentary.try(:original_title) %>
<label for="artist_commentary_original_description">Original description</label>
<%= text_area :artist_commentary, :original_description, :size => "40x6", :value => artist_commentary.try(:original_description) %>
<label for="artist_commentary_translated_title">Translated title</label>
<%= text_field :artist_commentary, :translated_title, :value => artist_commentary.try(:translated_title) %>
<label for="artist_commentary_translated_description">Translated description</label>
<%= text_area :artist_commentary, :translated_description, :size => "40x6", :value => artist_commentary.try(:translated_description) %>
</div>
<% end %>

View File

@@ -0,0 +1,26 @@
<h2>Artist's commentary</h2>
<menu id="commentary-sections">
<% if artist_commentary.original_present? && artist_commentary.translated_present? %>
<li><a href="#original">Original</a></li> |
<li><a href="#translated">Translated</a></li>
<% elsif artist_commentary.original_present? %>
<li><b>Original</b></li>
<% elsif artist_commentary.translated_present? %>
<li><b>Translated</b></li>
<% end %>
</menu>
<% if artist_commentary.original_present? %>
<section id="original-artist-commentary">
<h3><%= artist_commentary.original_title %></h3>
<p><%= format_text artist_commentary.original_description %></p>
</section>
<% end %>
<% if artist_commentary.translated_present? %>
<section id="translated-artist-commentary">
<h3><%= artist_commentary.translated_title %></h3>
<p><%= format_text artist_commentary.translated_description %></p>
</section>
<% end %>

View File

@@ -0,0 +1 @@
location.reload();

View File

@@ -0,0 +1,58 @@
<div id="c-artist-commentary-versions">
<div id="a-index">
<h1>Artist Commentary Changes</h1>
<table width="100%" class="striped">
<thead>
<tr>
<th width="5%">Post</th>
<th>Original</th>
<th>Translated</th>
<% if CurrentUser.is_janitor? %>
<th width="10%">IP Address</th>
<% end %>
<th width="10%">Edited By</th>
<th width="10%">Date</th>
<% if CurrentUser.is_member? %>
<th width="7%"></th>
<% end %>
</tr>
</thead>
<tbody>
<% @commentary_versions.each do |commentary_version| %>
<tr>
<td><%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %></td>
<td>
<h3><%= h(commentary_version.original_title) %></h3>
<%= h(commentary_version.original_description) %>
</td>
<td>
<h3><%= h(commentary_version.translated_title) %></h3>
<%= h(commentary_version.translated_description) %>
</td>
<% if CurrentUser.is_janitor? %>
<td>
<%= commentary_version.updater_ip_addr %>
</td>
<% end %>
<td><%= link_to_user commentary_version.updater %></td>
<td><%= compact_time commentary_version.updated_at %></td>
<% if CurrentUser.is_member? %>
<td>
<%= link_to "Revert to", revert_artist_commentary_path(commentary_version.post_id, :version_id => commentary_version.id), :remote => true, :method => :put, :confirm => "Are you sure you want to revert to this version?" %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<%= sequential_paginator(@commentary_versions) %>
<%= render "posts/partials/common/secondary_links" %>
</div>
</div>
<% content_for(:page_title) do %>
Artist Commentary Versions - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -10,6 +10,7 @@
<% else %>
<li><%= link_to "Add notes", "#", :id => "translate", :title => "Shortcut is N" %></li>
<% end %>
<%= link_to "Add artist commentary", "#", :id => "add-commentary" %>
<% if CurrentUser.is_builder? && post.has_notes? %>
<li><%= link_to "Copy all notes", "#", :id => "copy-notes" %></li>
<% end %>

View File

@@ -28,6 +28,7 @@
<li><%= fast_link_to "Notes", note_versions_path(:search => {:post_id => @post.id}) %></li>
<li><%= fast_link_to "Flags", post_flags_path(:search => {:post_id => @post.id}) %></li>
<li><%= fast_link_to "Appeals", post_appeals_path(:search => {:post_id => @post.id}) %></li>
<li><%= fast_link_to "Commentary", artist_commentary_versions_path(:search => {:post_id => @post.id}) %></li>
</ul>
</section>
@@ -46,6 +47,12 @@
<%= @post.presenter.image_html(self) %>
</section>
<% if @post.artist_commentary && @post.artist_commentary.any_field_present? %>
<div id="artist-commentary">
<%= render "artist_commentaries/show", :artist_commentary => @post.artist_commentary %>
</div>
<% end %>
<% if @post.presenter.has_nav_links?(self) %>
<%= render "posts/partials/show/nav_links", :post => @post, :position => "bottom" %>
<% end %>
@@ -92,6 +99,10 @@
<div id="add-to-pool-dialog" title="Add to pool" style="display: none;">
<%= render "pool_elements/new" %>
</div>
<div id="add-commentary-dialog" title="Add artist commentary" style="display: none;">
<%= render "artist_commentaries/form", :artist_commentary => @post.artist_commentary %>
</div>
</div>
<% content_for(:page_title) do %>