-
- <%= form_for '', url: templates_upload_path, method: :post, class: 'hidden' do %>
-
-
-
- <% end %>
-
+
diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml
index 0739846b..cb4c112b 100644
--- a/config/locales/i18n.yml
+++ b/config/locales/i18n.yml
@@ -937,6 +937,9 @@ en: &en
your_email_address_has_been_changed: Your email address has been changed
the_email_address_for_your_account_has_been_changed_to_new_email: The email address for your account has been changed to %{new_email}.
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: If you did not make this change, please contact us by replying to this email.
+ open_file_from: 'Open file from'
+ cancel: Cancel
+ open: Open
devise:
confirmations:
confirmed: Your email address has been successfully confirmed.
@@ -1987,6 +1990,9 @@ es: &es
your_email_address_has_been_changed: Tu dirección de correo electrónico ha sido cambiada
the_email_address_for_your_account_has_been_changed_to_new_email: La dirección de correo electrónico de tu cuenta ha sido cambiada a %{new_email}.
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: Si no realizaste este cambio, contáctanos respondiendo a este correo electrónico.
+ open_file_from: 'Abrir archivo desde'
+ cancel: Cancelar
+ open: Abrir
devise:
confirmations:
confirmed: Tu dirección de correo electrónico ha sido confirmada correctamente.
@@ -3037,6 +3043,9 @@ it: &it
your_email_address_has_been_changed: Il tuo indirizzo email è stato modificato
the_email_address_for_your_account_has_been_changed_to_new_email: L'indirizzo email del tuo account è stato modificato in %{new_email}.
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: Se non hai effettuato questa modifica, contattaci rispondendo a questa email.
+ open_file_from: 'Aprire file da'
+ cancel: Annulla
+ open: Apri
devise:
confirmations:
confirmed: Il tuo indirizzo email è stato confermato con successo.
@@ -4084,6 +4093,9 @@ fr: &fr
your_email_address_has_been_changed: Votre adresse e-mail a été modifiée
the_email_address_for_your_account_has_been_changed_to_new_email: "L'adresse e-mail de votre compte a été modifiée en %{new_email}."
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: Si vous n'avez pas effectué ce changement, veuillez nous contacter en répondant à cet e-mail.
+ open_file_from: 'Ouvrir le fichier depuis'
+ cancel: Annuler
+ open: Ouvrir
devise:
confirmations:
confirmed: Votre adresse e-mail a été confirmée avec succès.
@@ -5134,6 +5146,9 @@ pt: &pt
your_email_address_has_been_changed: Seu endereço de e-mail foi alterado
the_email_address_for_your_account_has_been_changed_to_new_email: O endereço de e-mail da sua conta foi alterado para %{new_email}.
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: Se você não fez essa alteração, entre em contato conosco respondendo a este e-mail.
+ open_file_from: 'Abrir arquivo de'
+ cancel: Cancelar
+ open: Abrir
devise:
confirmations:
confirmed: Seu endereço de e-mail foi confirmado com sucesso.
@@ -6184,6 +6199,9 @@ de: &de
your_email_address_has_been_changed: Ihre E-Mail-Adresse wurde geändert
the_email_address_for_your_account_has_been_changed_to_new_email: Die E-Mail-Adresse Ihres Kontos wurde in %{new_email} geändert.
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: Wenn Sie diese Änderung nicht vorgenommen haben, kontaktieren Sie uns bitte, indem Sie auf diese E-Mail antworten.
+ open_file_from: 'Datei öffnen von'
+ cancel: Abbrechen
+ open: Öffnen
devise:
confirmations:
confirmed: Ihre E-Mail-Adresse wurde erfolgreich bestätigt.
@@ -7635,6 +7653,9 @@ nl: &nl
your_email_address_has_been_changed: Uw e-mailadres is gewijzigd
the_email_address_for_your_account_has_been_changed_to_new_email: Het e-mailadres van uw account is gewijzigd naar %{new_email}.
if_you_did_not_make_this_change_please_contact_us_by_replying_to_this_email: Als u deze wijziging niet hebt aangebracht, neem dan contact met ons op door op deze e-mail te antwoorden.
+ open_file_from: 'Bestand openen van'
+ cancel: Annuleren
+ open: Openen
devise:
confirmations:
confirmed: Uw e-mailadres is succesvol bevestigd.
diff --git a/spec/system/templates_upload_spec.rb b/spec/system/templates_upload_spec.rb
new file mode 100644
index 00000000..84dbf6d9
--- /dev/null
+++ b/spec/system/templates_upload_spec.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+RSpec.describe 'Templates Upload' do
+ let!(:account) { create(:account) }
+ let!(:user) { create(:user, account:) }
+
+ before do
+ sign_in(user)
+ end
+
+ context 'when url param is present' do
+ let(:file_url) { 'https://example.com/document.pdf' }
+
+ before do
+ stub_request(:get, file_url).to_return(
+ body: Rails.root.join('spec/fixtures/sample-document.pdf').read,
+ headers: { 'Content-Type' => 'application/pdf' }
+ )
+ end
+
+ it 'shows a confirm page and creates template on submit' do
+ visit "/new?url=#{CGI.escape(file_url)}"
+
+ expect(page).to have_text('Open file from')
+ expect(page).to have_link('example.com/document.pdf')
+
+ click_button 'Open'
+
+ expect(Template.last.name).to eq('document')
+ end
+ end
+
+ context 'when url param is missing' do
+ it 'redirects to root' do
+ visit '/new'
+
+ expect(page).to have_current_path(root_path)
+ end
+ end
+end