diff --git a/Gemfile b/Gemfile index bef159b..c58fe8a 100644 --- a/Gemfile +++ b/Gemfile @@ -42,6 +42,10 @@ gem 'autoprefixer-rails', '~> 9.6.1' gem 'bh', '~> 1.3.6' +# Use Diffy for showing translation diffs +gem 'diffy' +gem 'diff-lcs' + gem 'will_paginate', '~> 3.1.8' gem 'will-paginate-i18n', '~> 0.1.15' gem 'will_paginate-bootstrap', '~> 1.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index 780d8ea..beaec11 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,6 +86,8 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) + diff-lcs (1.3) + diffy (3.3.0) docile (1.3.2) erubi (1.8.0) execjs (2.7.0) @@ -252,6 +254,8 @@ DEPENDENCIES codacy-coverage coffee-rails (~> 5.0.0) devise (~> 4.7.1) + diff-lcs + diffy jbuilder (~> 2.9.1) jquery-rails (~> 4.3.5) mysql2 (~> 0.5.2) diff --git a/app/assets/javascripts/mathjax-config.js b/app/assets/javascripts/mathjax-config.js index 9dacc40..45f1478 100644 --- a/app/assets/javascripts/mathjax-config.js +++ b/app/assets/javascripts/mathjax-config.js @@ -3,7 +3,8 @@ window.MathJax = { tex2jax: { inlineMath: [ ["$","$"], ["\\(","\\)"] ], displayMath: [ ["$$","$$"], ["\\[","\\]"] ], - processEscapes: true + processEscapes: true, + ignoreClass: "mathjax_ignore|diff" }, "HTML-CSS": { availableFonts: ["TeX"] } }; \ No newline at end of file diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 0ac4783..da8e9b4 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -55,6 +55,33 @@ body { margin: 20px -30px 0; } +/* Style for translation diffs */ + +.diff { + overflow:auto; + margin-bottom: 20px; + ul{background:#fff;overflow:auto;font-size:13px;list-style:none;margin:0;padding:0;display:table;width:100%;} + del, ins{display:block;text-decoration:none;} + li { + padding:0; + display:table-row; + margin: 0; + height:1em; + ins { + background:#dfd; + color:#080; + strong{font-weight:normal;background:#9f9;} + } + del { + background:#fee; + color:#b00; + strong{font-weight:normal;background:#fcc;} + } + /* try 'whitespace:pre;' if you don't want lines to wrap */ + del, ins, span {white-space:pre-wrap;font-family:courier;} + } +} + /* Custom css for fixing styles within problem content */ .problem-content { diff --git a/app/views/admin/translations/show.html.erb b/app/views/admin/translations/show.html.erb index efe40c1..7e5bd73 100644 --- a/app/views/admin/translations/show.html.erb +++ b/app/views/admin/translations/show.html.erb @@ -7,11 +7,6 @@
<%= t '.changed_title_html', old: @translation.problem.title, new: @translation.title %>
+ <% end %> +%{new} statt %{old}"
accept:
success_message: "Übersetzung wurde erfolgreich akzeptiert!"
decline:
diff --git a/config/locales/views/application/de.yml b/config/locales/views/application/de.yml
index 3f4896d..d4b0076 100644
--- a/config/locales/views/application/de.yml
+++ b/config/locales/views/application/de.yml
@@ -6,8 +6,9 @@ de:
updated_at: Aktualisiert
application:
site_title: "Projekt Euler"
- sign_in: 'Einloggen'
- sign_out: 'Ausloggen'
+ sign_in_with_github: 'Mit GitHub anmelden'
+ logged_in_as_html: "Angemeldet als %{name}"
+ sign_out: 'Abmelden'
info: "Info"
privacy: "Datenschutz"
legal: "Impressum"
diff --git a/db/seeds.rb b/db/seeds.rb
index 6a36b07..f7c26d6 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -10,13 +10,27 @@ Translation.delete_all
Problem.delete_all
User.delete_all
+admin = User.create!(
+ provider: :developer,
+ uid: "admin",
+ name: "admin",
+ role: :admin
+)
-for i in 1..20 do
+translator = User.create!(
+ provider: :developer,
+ uid: "translator",
+ name: "translator",
+ role: :user
+)
+
+for i in 1..60 do
Problem.create!(id: i)
end
for i in 1..10 do
translation = Translation.create!(
+ author: translator,
problem: Problem.find(i),
title: "Problem Nummer #{i}",
content: %Q(Das hier ist der Inhalt von Problem #{i}. @@ -30,19 +44,6 @@ for i in 1..10 do end -User.create!( - provider: :developer, - uid: "admin", - name: "admin", - role: 1 -) - -User.create!( - provider: :developer, - uid: "translator", - name: "translator" -) - p "Created #{Problem.count} problems" p "Created #{Translation.count} translations" p "Created #{User.count} users"