Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljames-dj committed Oct 19, 2024
1 parent 3ee1ccd commit f32e302
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/models/competition_tab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f32e302

Please sign in to comment.