Fix #4231: Allow artist commentary titles to be formatted with DText.

This commit is contained in:
evazion
2019-12-28 12:19:22 -06:00
parent c95108d37b
commit bb4be383b9
6 changed files with 41 additions and 43 deletions

View File

@@ -0,0 +1,15 @@
module ArtistCommentariesHelper
def format_commentary_title(title, classes: "")
tag.h3 do
tag.span(class: "prose #{classes}") do
format_text(title, disable_mentions: true, inline: true)
end
end
end
def format_commentary_description(description, classes: "")
tag.div(class: "prose #{classes}") do
format_text(description, disable_mentions: true)
end
end
end

View File

@@ -25,7 +25,7 @@ kbd.key {
} }
/* used for "(deleted)" messages */ /* used for "(deleted)" messages */
span.inactive { div.inactive, span.inactive {
color: var(--muted-text-color); color: var(--muted-text-color);
} }

View File

@@ -13,28 +13,23 @@
<% if artist_commentary.original_present? %> <% if artist_commentary.original_present? %>
<%= tag.section id: "original-artist-commentary", style: ("display: none" if artist_commentary.translated_present?) do %> <%= tag.section id: "original-artist-commentary", style: ("display: none" if artist_commentary.translated_present?) do %>
<h3><%= artist_commentary.original_title %></h3> <%= format_commentary_title(artist_commentary.original_title) %>
<div class="prose"> <%= format_commentary_description(artist_commentary.original_description) %>
<%= format_text(artist_commentary.original_description, :disable_mentions => true) %>
</div>
<% end %> <% end %>
<% end %> <% end %>
<% if artist_commentary.translated_present? %> <% if artist_commentary.translated_present? %>
<section id="translated-artist-commentary"> <section id="translated-artist-commentary">
<h3> <% if artist_commentary.translated_title.present? %>
<% if artist_commentary.translated_title.present? %> <%= format_commentary_title(artist_commentary.translated_title) %>
<%= artist_commentary.translated_title %> <% else %>
<% else %> <%= format_commentary_title(artist_commentary.original_title, classes: "inactive") %>
<span class="inactive"><%= artist_commentary.original_title %></span> <% end %>
<% end %>
</h3> <% if artist_commentary.translated_description.present? %>
<div class="prose"> <%= format_commentary_description(artist_commentary.translated_description) %>
<% if artist_commentary.translated_description.present? %> <% else %>
<%= format_text(artist_commentary.translated_description, :disable_mentions => true) %> <%= format_commentary_description(artist_commentary.original_description, classes: "inactive") %>
<% else %> <% end %>
<span class="inactive"><%= format_text(artist_commentary.original_description, :disable_mentions => true) %></span>
<% end %>
</div>
</section> </section>
<% end %> <% end %>

View File

@@ -17,16 +17,12 @@
<tr> <tr>
<td><%= PostPresenter.preview(commentary.post, :tags => "status:any") %></td> <td><%= PostPresenter.preview(commentary.post, :tags => "status:any") %></td>
<td> <td>
<h3><%= h(commentary.original_title) %></h3> <%= format_commentary_title(commentary.original_title) %>
<div class="prose"> <%= format_commentary_description(commentary.original_description) %>
<%= format_text(commentary.original_description, :disable_mentions => true) %>
</div>
</td> </td>
<td> <td>
<h3><%= h(commentary.translated_title) %></h3> <%= format_commentary_title(commentary.translated_title) %>
<div class="prose"> <%= format_commentary_description(commentary.translated_description) %>
<%= format_text(commentary.translated_description, :disable_mentions => true) %>
</div>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -20,16 +20,12 @@
<tr> <tr>
<td><%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %></td> <td><%= link_to commentary_version.post_id, post_path(commentary_version.post_id) %></td>
<td> <td>
<h3><%= h(commentary_version.original_title) %></h3> <%= format_commentary_title(commentary_version.original_title) %>
<div class="prose"> <%= format_commentary_description(commentary_version.original_description) %>
<%= format_text(commentary_version.original_description, :disable_mentions => true) %>
</div>
</td> </td>
<td> <td>
<h3><%= h(commentary_version.translated_title) %></h3> <%= format_commentary_title(commentary_version.translated_title) %>
<div class="prose"> <%= format_commentary_description(commentary_version.translated_description) %>
<%= format_text(commentary_version.translated_description, :disable_mentions => true) %>
</div>
</td> </td>
<% if CurrentUser.is_moderator? %> <% if CurrentUser.is_moderator? %>
<td> <td>

View File

@@ -19,16 +19,12 @@
<td><%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %></td> <td><%= PostPresenter.preview(commentary_version.post, :tags => "status:any") %></td>
<td><%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %></td> <td><%= link_to "#{commentary_version.post_id}.#{commentary_version.id}»", artist_commentary_versions_path(search: {post_id: commentary_version.post_id}) %></td>
<td> <td>
<h3><%= h(commentary_version.original_title) %></h3> <%= format_commentary_title(commentary_version.original_title) %>
<div class="prose"> <%= format_commentary_description(commentary_version.original_description) %>
<%= format_text(commentary_version.original_description, :disable_mentions => true) %>
</div>
</td> </td>
<td> <td>
<h3><%= h(commentary_version.translated_title) %></h3> <%= format_commentary_title(commentary_version.translated_title) %>
<div class="prose"> <%= format_commentary_description(commentary_version.translated_description) %>
<%= format_text(commentary_version.translated_description, :disable_mentions => true) %>
</div>
</td> </td>
<% if CurrentUser.is_moderator? %> <% if CurrentUser.is_moderator? %>
<td> <td>