1
0
mirror of https://github.com/projekteuler/projekteuler.git synced 2026-01-27 02:28:50 +01:00

Prefill original title and content from projecteuler.net

This commit is contained in:
2020-05-02 20:18:04 +02:00
parent 3e85290fc6
commit 38633d6e79
21 changed files with 178 additions and 72 deletions

View File

@@ -3,9 +3,10 @@
<h1><%= t('.administration') %></h1>
</div>
<%= link_to t('.view_translations'), admin_translations_path, class: 'btn btn-primary' %>
<h1><%= t('.update_problem_count') %></h1>
<%= form_tag '/admin/update_problem_count', method: :post, class: 'form-inline' do %>
<%= number_field_tag 'problem_count', @current_problem_count, min: @current_problem_count, class: 'form-control' %>
<%= submit_tag t('.update'), class: 'btn btn-warning' %>
<% end %>
<p>
<%= t('.number_of_problems') %>: <%= @current_problem_count %><br/>
<% if @most_recent_pull.present? %>
<%= t('.time_since_last_pull') %>: <%= time_ago_in_words @most_recent_pull %>
<% end %>
</p>
<%= button_to t('.pull_problems'), '/admin/pull_problems', method: :post, class: 'btn btn-warning' %>

View File

@@ -28,12 +28,10 @@
<% if problem.is_translated? %>
<%= link_to problem.title, problem %>
<% else %>
<i><%= t 'problems.not_yet_translated' %></i>
<%= link_to new_problem_translation_path(problem), class: 'btn btn-primary btn-sm' do %>
<%= icon('fas', 'edit') %> <%= t '.suggest_translation' %>
<% end %>
<%= link_to problem do %>
<i><%= problem.original_title %> <%= t 'problems.not_translated_yet' %></i>
<% end %>
<% end %>
</td>
</tr>
<% end %>

View File

@@ -1,7 +1,13 @@
<% provide(:title, t('problems.show.problem_subtitle', id: @problem.id)) %>
<div class="pb-2 mt-4 mb-2">
<h1><%= @problem.title %></h1>
<h1>
<% if @problem.is_translated? %>
<%= @problem.title %>
<% else %>
<i><%= @problem.original_title %> <%= t 'problems.not_translated_yet' %></i>
<% end %>
</h1>
</div>
<% if Problem.exists?(@problem.id-1) %>
<%= link_to problem_path(@problem.id-1), title: t('problems.show.problem_subtitle', id: @problem.id-1), class: 'problem-prev' do %>
@@ -19,15 +25,26 @@
</div>
<div class="problem-buttons">
<%= link_to new_problem_translation_path(@problem), class: 'problem-buttons-inner btn btn-primary btn-sm' do %>
<%= icon('fas', 'edit') %> <%= t '.improve_translation' %>
<%= icon('fas', 'edit') %>
<% if @problem.is_translated? %>
<%= t '.improve_translation' %>
<% else %>
<%= t '.suggest_translation' %>
<% end %>
<% end %>
</div>
<div class="card-body problem-content">
<%= sanitize @problem.content, scrubber: TranslationContentScrubber.new %>
</div>
<div class="card-footer text-muted">
<%= render 'shared/authors', authors: @problem.authors, has_anonymous_author: @problem.has_anonymous_author? %>
<% if @problem.is_translated? %>
<%= sanitize @problem.content, scrubber: TranslationContentScrubber.new %>
<% else %>
<%= sanitize @problem.original_content, scrubber: TranslationContentScrubber.new %>
<% end %>
</div>
<% if @problem.is_translated? %>
<div class="card-footer text-muted">
<%= render 'shared/authors', authors: @problem.authors, has_anonymous_author: @problem.has_anonymous_author? %>
</div>
<% end %>
</div>
<div class="text-center">
<%= link_to t('.view_original_problem'), @problem.original_url, target: '_blank' %>

View File

@@ -1,10 +0,0 @@
<% provide(:title, t('problems.show.problem_subtitle', id: @problem.id)) %>
<div class="pb-2 mt-4 mb-2 border-bottom">
<h1><%= t 'problems.show.problem_subtitle', id: @problem.id %></h1>
</div>
<%= t 'problems.not_yet_translated' %>
<%= link_to new_problem_translation_path(@problem), class: 'btn btn-primary btn-sm' do %>
<%= icon('fas', 'edit') %> <%= t 'problems.index.suggest_translation' %>
<% end %>

View File

@@ -1,15 +1,12 @@
<div class="card">
<div class="card mb-3">
<div class="card-header">
Hinweise zur Erstellung von Übersetzungen
</div>
<div class='card-body'>
<ul>
<li>Als Basis für jede Übersetzung dient der HTML-Quelltext von projecteuler.net.
Dazu gehen Sie auf die entsprechende <%= link_to "Problem-Seite", @problem.original_url, target: '_blank' %>.
Dort öffnen Sie den HTML-Quelltext (z.B. mit <code>Strg+U</code> in Firefox) und kopieren alles zwischen <code>&lt;div class=&quot;problem_content&quot; role=&quot;problem&quot;&gt;</code> und <code>&lt;/div&gt;</code>.
Diesen Quelltext fügen Sie auf dieser Seite ein.
In Zukunft sollen diese Schritte automatisch passieren.</li>
<li>Der HTML-Quelltext sollte im Allgemeinen unverändert bleiben.</li>
<li>Als Basis für jede Übersetzung dient der <%= link_to "Text von projecteuler.net", @problem.original_url, target: '_blank' %>.</li>
<li>Der Originaltitel und Text im untenstehenden Formular sind zu übersetzen.</li>
<li>Der HTML-Quelltext in seiner Struktur sollte im Allgemeinen unverändert bleiben.</li>
<li>Querverweise zu anderen Problemen sollten in der Form <code>/problem=??</code> erfolgen.</li>
<li>Wenn Grafiken oder Dateien verwendet werden, sollte die URL <code>https://projecteuler.net/...</code> verwendet werden.</li>
<li>Die Sie-Form benutzen.</li>