From e5e046eabb95d9d7aad76ea429b47243d4315e70 Mon Sep 17 00:00:00 2001
From: Marc Anguera Insa
Date: Tue, 5 Jan 2021 16:40:48 +0100
Subject: [PATCH] DRY default select2 initialization
---
app/assets/javascripts/application.js | 4 ++++
app/views/shared/_post_form.html.erb | 7 -------
app/views/transfers/new.html.erb | 8 --------
3 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index e276396e6..d2af575af 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -23,3 +23,7 @@ $(document).on('click', 'span.show-password', function(event) {
$(this).prev('input').attr('type', inputType);
$(this).find('.material-icons').html(icon);
});
+
+$(function() {
+ $("#select2").select2();
+});
diff --git a/app/views/shared/_post_form.html.erb b/app/views/shared/_post_form.html.erb
index 625ef5d0e..7a1ec2b82 100644
--- a/app/views/shared/_post_form.html.erb
+++ b/app/views/shared/_post_form.html.erb
@@ -58,10 +58,3 @@
<%= f.button label_button, class: "btn btn-default", style: "margin-bottom: 20px;" %>
<% end %>
-
diff --git a/app/views/transfers/new.html.erb b/app/views/transfers/new.html.erb
index 8154b2eac..a0e717578 100644
--- a/app/views/transfers/new.html.erb
+++ b/app/views/transfers/new.html.erb
@@ -40,11 +40,3 @@
<% end %>
-
-