diff --git a/app/views/metadata_fields/_licences.html.erb b/app/views/metadata_fields/_licences.html.erb index 719440ae7..6d93f8ca7 100644 --- a/app/views/metadata_fields/_licences.html.erb +++ b/app/views/metadata_fields/_licences.html.erb @@ -28,24 +28,6 @@ %> <% end %> -
-

How users apply

- -

Enter either the website where users can apply for the licence, or the licence identifier.

-
- -<%= render layout: "shared/form_group", locals: { f: f, field: :licence_transaction_will_continue_on, label: "Name of website where users apply" } do %> - <%= f.text_field :licence_transaction_will_continue_on, class: 'form-control' %> -<% end %> - -<%= render layout: "shared/form_group", locals: { f: f, field: :licence_transaction_continuation_link, label: "Link to where users apply" } do %> - <%= f.text_field :licence_transaction_continuation_link, class: 'form-control' %> -<% end %> - -<%= render layout: "shared/form_group", locals: { f: f, field: :licence_transaction_licence_identifier, label: "Licence identifier" } do %> - <%= f.text_field :licence_transaction_licence_identifier, class: 'form-control' %> -<% end %> - <%= render "shared/form_group", f: f, field: :primary_publishing_organisation, label: "Publishing organisation" do %> <%= f.select :primary_publishing_organisation, organisations_options, @@ -72,3 +54,27 @@ } %> <% end %> + +
+

How users apply

+ + <% if field_has_errors(@document, :base) %> +
+

<%= t("activemodel.errors.models.licence_transaction.attributes.base.link_and_identifier_exists") %>

+
+ <% else %> +

Enter either the website where users can apply for the licence, or the licence identifier.

+ <% end %> +
+ +<%= render layout: "shared/form_group", locals: { f: f, field: :licence_transaction_will_continue_on, label: "Name of website where users apply" } do %> + <%= f.text_field :licence_transaction_will_continue_on, class: 'form-control' %> +<% end %> + +<%= render layout: "shared/form_group", locals: { f: f, field: :licence_transaction_continuation_link, label: "Link to where users apply" } do %> + <%= f.text_field :licence_transaction_continuation_link, class: 'form-control' %> +<% end %> + +<%= render layout: "shared/form_group", locals: { f: f, field: :licence_transaction_licence_identifier, label: "Licence identifier" } do %> + <%= f.text_field :licence_transaction_licence_identifier, class: 'form-control' %> +<% end %> diff --git a/spec/features/creating_a_licence_spec.rb b/spec/features/creating_a_licence_spec.rb index 7fed45e84..a95888103 100644 --- a/spec/features/creating_a_licence_spec.rb +++ b/spec/features/creating_a_licence_spec.rb @@ -44,6 +44,9 @@ expect(page).to have_content(attributes[:summary][:blank]) expect(page).to have_content(attributes[:body][:blank]) expect(page).to have_content(attributes[:licence_transaction_industry][:blank]) + within(".additional-field-context-section p.elements-error-message") do + attributes[:base][:link_and_identifier_exists] + end end scenario "saving a new licence with valid data" do