mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Merge pull request #11387 from jibees/10957-missing-translation-invalid-url
Admin, White Label: add translation for invalid URL in white label context
This commit is contained in:
@@ -452,7 +452,7 @@ class Enterprise < ApplicationRecord
|
||||
uri = URI(white_label_logo_link)
|
||||
self.white_label_logo_link = "http://#{white_label_logo_link}" if uri.scheme.nil?
|
||||
rescue URI::InvalidURIError
|
||||
errors.add(:white_label_logo_link, I18n.t(:invalid_url))
|
||||
errors.add(:white_label_logo_link, I18n.t(:invalid_url, url: white_label_logo_link))
|
||||
end
|
||||
|
||||
def image_url_for(image, name)
|
||||
|
||||
@@ -90,6 +90,8 @@ en:
|
||||
preferred_discount_amount: "Calculator Discount Amount:"
|
||||
preferred_unit_from_list: "Calculator Unit From List:"
|
||||
preferred_per_unit: "Calculator Per Unit:"
|
||||
enterprise:
|
||||
white_label_logo_link: "Link for the logo used in shopfront"
|
||||
errors:
|
||||
models:
|
||||
enterprise_fee:
|
||||
@@ -3177,6 +3179,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
amount: "Amount"
|
||||
invoice_number: "Invoice Number"
|
||||
invoice_file: "File"
|
||||
invalid_url: "'%{url}' is an invalid URL"
|
||||
state_names:
|
||||
ready: Ready
|
||||
pending: Pending
|
||||
|
||||
@@ -716,6 +716,20 @@ describe '
|
||||
it_behaves_like "edit link with", "www.openfoodnetwork.org", "http://www.openfoodnetwork.org"
|
||||
it_behaves_like "edit link with", "openfoodnetwork.org", "http://openfoodnetwork.org"
|
||||
end
|
||||
|
||||
shared_examples "edit link with invalid" do |url|
|
||||
it "url: #{url}" do
|
||||
fill_in "enterprise_white_label_logo_link", with: url
|
||||
click_button 'Update'
|
||||
expect(page)
|
||||
.to have_content "Link for the logo used in shopfront '#{url}' is an invalid URL"
|
||||
expect(distributor1.reload.white_label_logo_link).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context "can not edit white label logo link" do
|
||||
it_behaves_like "edit link with invalid", "invalid url"
|
||||
end
|
||||
end
|
||||
|
||||
it "can check/uncheck the hide_groups_tab attribute" do
|
||||
|
||||
Reference in New Issue
Block a user