1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2025-12-10 00:36:42 +01:00
projekteuler/app/views/admin/translations/show.html.erb

46 lines
2.1 KiB
Plaintext

<% provide(:title, t('problems.show.problem_subtitle', id: @translation.problem_id)) %>
<div class="pb-2 mt-4 mb-2">
<p class="text-muted">
<%= render 'shared/authors', authors: Array(@translation.author) %>
</p>
<h1><%= @translation.title %> <small><%= t 'problems.show.problem_subtitle', id: @translation.problem_id %></small></h1>
</div>
<% if @translation.pending? %>
<div class="problem-buttons">
<div class="btn-group problem-buttons-inner">
<%= link_to admin_translation_decline_path(@translation), method: :post, class: 'btn btn-danger btn-sm' do %>
<%= icon('fas', 'times') %> <%= t '.decline_translation' %>
<% end %>
<%= link_to admin_translation_accept_path(@translation), method: :post, class: 'btn btn-success btn-sm' do %>
<%= icon('fas', 'check') %> <%= t '.accept_translation' %>
<% end %>
</div>
</div>
<% end %>
<div class="card mb-3">
<div class="card-body problem-content">
<%= sanitize @translation.content, scrubber: TranslationContentScrubber.new %>
</div>
</div>
<% if @translation.problem.is_translated? %>
<% if @translation.title != @translation.problem.title %>
<h3><%= t 'activerecord.attributes.translation.title' %></h3>
<p><%= t '.changed_title_html', old: @translation.problem.title, new: @translation.title %></p>
<% end %>
<h3><%= t 'activerecord.attributes.translation.content' %></h3>
<%= raw Diffy::Diff.new(@translation.problem.content, @translation.content, allow_empty_diff: false).to_s(:html) %>
<div class="alert alert-warning" role="alert"><%= t('.already_translated') %> <%= link_to t('.visit_current_translation'), @translation.problem, target: '_blank', class: 'alert-link' %></div>
<% else %>
<h2><%= t 'activerecord.attributes.translation.content' %></h2>
<%= raw Diffy::Diff.new(@translation.content, @translation.content, allow_empty_diff: false).to_s(:html) %>
<div class="alert alert-info" role="alert"><%= t('.is_new_translation') %></div>
<% end %>
<div class="text-center">
<%= link_to t('problems.show.view_original_problem'), @translation.problem.original_url, target: '_blank' %>
</div>