diff --git a/app/controllers/admin/registrars_controller.rb b/app/controllers/admin/registrars_controller.rb index 17a618273..b925a8156 100644 --- a/app/controllers/admin/registrars_controller.rb +++ b/app/controllers/admin/registrars_controller.rb @@ -3,6 +3,7 @@ module Admin load_and_authorize_resource before_action :set_registrar, only: [:show, :edit, :update, :destroy] helper_method :registry_vat_rate + helper_method :iban_max_length def index @q = Registrar.joins(:accounts).ordered.search(params[:q]) @@ -80,5 +81,9 @@ module Admin def registry_vat_rate Registry.current.vat_rate end + + def iban_max_length + Iban.max_length + end end end diff --git a/app/models/iban.rb b/app/models/iban.rb new file mode 100644 index 000000000..260aca827 --- /dev/null +++ b/app/models/iban.rb @@ -0,0 +1,5 @@ +class Iban + def self.max_length + 34 + end +end \ No newline at end of file diff --git a/app/views/admin/registrars/form/_billing.html.erb b/app/views/admin/registrars/form/_billing.html.erb index fa1583ca8..8d1375f64 100644 --- a/app/views/admin/registrars/form/_billing.html.erb +++ b/app/views/admin/registrars/form/_billing.html.erb @@ -73,7 +73,7 @@ <%= f.label :iban %>
- <%= f.text_field :iban, class: 'form-control' %> + <%= f.text_field :iban, maxlength: iban_max_length, class: 'form-control' %>
diff --git a/test/models/iban_test.rb b/test/models/iban_test.rb new file mode 100644 index 000000000..8455c4e86 --- /dev/null +++ b/test/models/iban_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class IbanTest < ActiveSupport::TestCase + def test_returns_max_length + assert_equal 34, Iban.max_length + end +end \ No newline at end of file