From c0d43171a44a90b489bc471b89c4586a6e969222 Mon Sep 17 00:00:00 2001 From: Dan Elbert Date: Wed, 29 Jun 2016 19:14:17 -0500 Subject: [PATCH] fixed ingredient bug; added button --- app/assets/javascripts/typeahead_search.js | 5 +++++ app/views/ingredients/index.html.erb | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/app/assets/javascripts/typeahead_search.js b/app/assets/javascripts/typeahead_search.js index c52b822..0b8c3bc 100644 --- a/app/assets/javascripts/typeahead_search.js +++ b/app/assets/javascripts/typeahead_search.js @@ -11,6 +11,11 @@ return this.each(function() { var options = $.extend({}, defaultOptions, opts); var $this = $(this); + + if ($this.data(pluginName)) { + return; + } + $this.data(pluginName, {options: options}); var $inputGroup = $('
'); diff --git a/app/views/ingredients/index.html.erb b/app/views/ingredients/index.html.erb index 2a89361..5d0f8b6 100644 --- a/app/views/ingredients/index.html.erb +++ b/app/views/ingredients/index.html.erb @@ -8,6 +8,10 @@

No Ingredients

<% else %> + <%= link_to 'New Ingredient', new_ingredient_path, class: 'btn btn-default' %> + +
+