Skip to content

Commit

Permalink
DRY default select2 initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
markets committed Jan 5, 2021
1 parent 13d0e41 commit e5e046e
Showing 3 changed files with 4 additions and 15 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -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();
});
7 changes: 0 additions & 7 deletions app/views/shared/_post_form.html.erb
Original file line number Diff line number Diff line change
@@ -58,10 +58,3 @@
</p>
<%= f.button label_button, class: "btn btn-default", style: "margin-bottom: 20px;" %>
<% end %>
<script>
$("#select2").select2({
formatNoMatches: function () {
return "<%= j t('application.tips.user_not_found') %>";
}
});
</script>
8 changes: 0 additions & 8 deletions app/views/transfers/new.html.erb
Original file line number Diff line number Diff line change
@@ -40,11 +40,3 @@
<label class="js-error-amount error invisible"><%= t ".error_amount" %></label>
</div>
<% end %>

<script type="text/javascript">
$("#select2").select2({
formatNoMatches: function() {
return "<%= j t('application.tips.user_not_found') %>";
}
});
</script>

0 comments on commit e5e046e

Please sign in to comment.