From f32e302dc770b37556b7339ef76b70c3d7e245e0 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 19 Oct 2024 09:27:38 +0530 Subject: [PATCH] Review changes --- app/models/competition_tab.rb | 6 +++--- config/locales/en.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/competition_tab.rb b/app/models/competition_tab.rb index b02bd596683..82bc5c0b939 100644 --- a/app/models/competition_tab.rb +++ b/app/models/competition_tab.rb @@ -34,12 +34,12 @@ def slug competition.tabs.where("display_order > ?", display_order).update_all("display_order = display_order - 1") end - validate :verify_if_urls_are_full_urls, on: :update - private def verify_if_urls_are_full_urls + validate :verify_if_full_urls, on: :update + private def verify_if_full_urls content.scan(/\[(.*?)\]\((.*?)\)/).any? do |match| url = match[1] unless url.starts_with?('http://', 'https://') - errors.add(:content, I18n.t('competition_tabs.not_full_url_error_message', url: url)) + errors.add(:content, I18n.t('competitions.errors.not_full_url', url: url)) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index f8ecd972fc9..1f2c3d72df3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1955,6 +1955,7 @@ en: series_distance_km: "The competition is located too far away from %{competition}." series_distance_days: "The competition is scheduled too many days away from %{competition}." must_ask_about_guests_if_specifying_limit: "Must ask about guests if a guest limit is specified." + not_full_url: "You have a relative URL (%{url}) in the content. Please enter full URLs with prefix http:// or https://." new: create_competition: "Create competition" note_clone: "To clone an existing competition visit the information page for that competition and click the \"Clone\" link in the menu." @@ -2139,7 +2140,6 @@ en: tabs_introduction_text: "Here you can add and edit tabs which are shown on the competition info page." edit: edit_tab_title: "Edit %{tab_name} tab" - not_full_url_error_message: "You have a relative URL (%{url}) in the content. Please enter full URLs with prefix http:// or https://." #context: Key used for results (rankings, records, etc.) results: #context: On the rankings page