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 */
span.inactive {
div.inactive, span.inactive {
color: var(--muted-text-color);
}

View File

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

View File

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

View File

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

View File

@@ -19,16 +19,12 @@
<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>
<h3><%= h(commentary_version.original_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.original_description, :disable_mentions => true) %>
</div>
<%= format_commentary_title(commentary_version.original_title) %>
<%= format_commentary_description(commentary_version.original_description) %>
</td>
<td>
<h3><%= h(commentary_version.translated_title) %></h3>
<div class="prose">
<%= format_text(commentary_version.translated_description, :disable_mentions => true) %>
</div>
<%= format_commentary_title(commentary_version.translated_title) %>
<%= format_commentary_description(commentary_version.translated_description) %>
</td>
<% if CurrentUser.is_moderator? %>
<td>