From e09a408d34030cd9030734b74fb03738f8cd7490 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Sun, 23 May 2021 13:46:15 +0200 Subject: [PATCH] Update HTML for Bootstrap 5 --- app/assets/javascripts/init.coffee | 2 +- app/helpers/application_helper.rb | 10 ++-- app/views/about/index.de.html.erb | 27 ++++++----- app/views/layouts/_header.html.erb | 64 +++++++++++++------------ app/views/translations/_form.html.erb | 4 +- test/helpers/application_helper_test.rb | 2 +- 6 files changed, 54 insertions(+), 55 deletions(-) diff --git a/app/assets/javascripts/init.coffee b/app/assets/javascripts/init.coffee index cabf848..1f84e32 100644 --- a/app/assets/javascripts/init.coffee +++ b/app/assets/javascripts/init.coffee @@ -18,6 +18,6 @@ App.init = -> $(document).on "turbolinks:load", -> App.init() -$(document).on "click", '#translationTab a[href="#preview"]', -> +$(document).on "click", '#translationTab button[data-bs-target="#preview"]', -> $('#preview .problem-content').html(cm.getValue()) MathJax.Hub.Queue(["Typeset",MathJax.Hub]); \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 66acd86..ef3fbc5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,11 +7,8 @@ module ApplicationHelper capture do flash.each do |msg_type, message| concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} alert-dismissible", role: 'alert') do - concat(content_tag(:button, class: 'close', data: { dismiss: 'alert' }) do - concat content_tag(:span, '×'.html_safe, 'aria-hidden' => true) - concat content_tag(:span, 'Close', class: 'sr-only') - end) concat message + concat content_tag(:button, "", class: 'btn-close', data: { 'bs-dismiss': 'alert' }, 'aria-label': 'Close') end) end nil @@ -29,9 +26,8 @@ module ApplicationHelper end def nav_link_to(body, url) - nav_options = { class: current_page?(url) ? 'nav-item active': 'nav-item' } - content_tag(:li, nav_options) do - link_to body, url, class: 'nav-link' + content_tag(:li, class: 'nav-item') do + link_to body, url, class: current_page?(url) ? 'nav-link active': 'nav-link' end end diff --git a/app/views/about/index.de.html.erb b/app/views/about/index.de.html.erb index f627490..0c9d6c7 100644 --- a/app/views/about/index.de.html.erb +++ b/app/views/about/index.de.html.erb @@ -1,4 +1,4 @@ -
+

Willkommen auf Projekt Euler!

Diese Seite ist eine Übersetzung der englischen Rätsel-Webseite projecteuler.net.

@@ -7,26 +7,27 @@ <% end %>

-
- -
-
+
+
+

Ansehen

Sehen Sie sich die mathematischen Probleme in deutscher Sprache an.

-

- <%= link_to problems_path, class: 'btn btn-primary' do %> - Zu den Problemen » - <% end %> -

+ <%= link_to problems_path, class: 'btn btn-primary' do %> + Zu den Problemen » + <% end %>
-
+
+
+

Übersetzen

Bisher wurden erst <%= Problem.translated_count %> der <%= Problem.count %> Probleme übersetzt. Helfen Sie mit, Übersetzungen zu erstellen und anzupassen!

-
+
+
+

Verbessern

Vermissen Sie eine Funktion auf der Webseite, oder ist Ihnen ein Fehler aufgefallen? Dann helfen Sie beim Entwickeln der Webseite in Ruby on Rails!

-

Projekt Euler auf GitHub »

+ Projekt Euler auf GitHub »
\ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 000b870..a3e50d5 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,44 +1,46 @@ \ No newline at end of file diff --git a/app/views/translations/_form.html.erb b/app/views/translations/_form.html.erb index 86aa359..4ade8a4 100644 --- a/app/views/translations/_form.html.erb +++ b/app/views/translations/_form.html.erb @@ -2,10 +2,10 @@ <%= f.text_field :title %>
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 4a29dc2..302e3c2 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -8,6 +8,6 @@ class ApplicationHelperTest < ActionView::TestCase test "bootstrap flash messages should work" do flash[:error] = "Error" - assert_equal "
Error
", flash_messages + assert_equal "
Error
", flash_messages end end