diff --git a/app/controllers/admin/communication/websites/posts/curations_controller.rb b/app/controllers/admin/communication/websites/posts/curations_controller.rb index 028c45310dfd317acfce08da54362b96dbdb6a8f..98bb804cfcd3a1f2ad685d67e1337c19681ee6d9 100644 --- a/app/controllers/admin/communication/websites/posts/curations_controller.rb +++ b/app/controllers/admin/communication/websites/posts/curations_controller.rb @@ -10,7 +10,8 @@ class Admin::Communication::Websites::Posts::CurationsController < Admin::Commun notice: t('admin.successfully_created_html', model: @curator.post.to_s) else breadcrumb - flash[:alert] = "Erreur lors de la curation" + @url = curation_params[:url] + flash[:alert] = t('curation.error') render :new, status: :unprocessable_entity end end diff --git a/app/services/curator.rb b/app/services/curator.rb index 003f5e358edecba93ca5cb82bb1d017347cacb46..e00294534042c9eab0d457130569b7ca4a65b832 100644 --- a/app/services/curator.rb +++ b/app/services/curator.rb @@ -7,6 +7,7 @@ class Curator @url = url create_post! attach_image! unless page.image.blank? + rescue end def valid? diff --git a/app/views/admin/communication/websites/posts/curations/new.html.erb b/app/views/admin/communication/websites/posts/curations/new.html.erb index 4a8e7f5f4e392986432f7e002f1c36dce0125138..8f90ef1ec73c43c413ca14dcc79f6e73b993702b 100644 --- a/app/views/admin/communication/websites/posts/curations/new.html.erb +++ b/app/views/admin/communication/websites/posts/curations/new.html.erb @@ -3,8 +3,9 @@ <%= simple_form_for :curation, url: admin_communication_website_post_curations_path, html: { id: 'new_communication_website_post_curation' } do |f| %> <%= f.error_notification %> <%= f.input :url, - label: 'URL', - value: params.dig(:curation, :url) %> + label: t('curation.label'), + placeholder: t('curation.placeholder'), + input_html: { value: @url } %> <% content_for :action_bar_right do %> <%= submit f %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index dae2f8766da766491e3e24652a23f644273c3330..fbb565b77adc6c189ddcb0a16b756d2481ddf6b5 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -667,6 +667,10 @@ en: persons: Staff teachers: Educational staff url: URL + curation: + error: Import error, be sure to use a valid URL + label: URL of the post to import + placeholder: https://... simple_form: hints: communication_extranet: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index e970a60ca8d6a23cd1cd0ab56f2e3e419148674f..f72d4be3864c6f3546915e3387d4a3473bf416aa 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -669,6 +669,10 @@ fr: persons: Équipe teachers: Équipe pédagogique url: URL + curation: + error: Erreur lors de la curation, veillez à utiliser une URL valide + label: URL de l'article à importer + placeholder: https://... simple_form: hints: communication_extranet: