diff --git a/app/assets/javascripts/featurer_web/anchors_to_delete.js b/app/assets/javascripts/featurer_web/anchors_to_delete.js deleted file mode 100644 index d2f979e..0000000 --- a/app/assets/javascripts/featurer_web/anchors_to_delete.js +++ /dev/null @@ -1,20 +0,0 @@ -$(document).ready(function() { - $("a[data-method=delete]").on('click', function(e) { - e.preventDefault(); - - if (confirm("Are you sure?") == true) { - theElement = $(this); - - $.ajax({ - url: $(this).attr("href"), - type: "DELETE", - success: function() { - row = theElement.closest("tr"); - row.fadeOut(400, function() { - row.remove(); - }); - } - }); - } - }); -}); diff --git a/app/assets/javascripts/featurer_web/application.js b/app/assets/javascripts/featurer_web/application.js index b362f49..646c5ab 100644 --- a/app/assets/javascripts/featurer_web/application.js +++ b/app/assets/javascripts/featurer_web/application.js @@ -10,5 +10,6 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // - +//= require jquery +//= require jquery_ujs //= require_tree . diff --git a/app/controllers/featurer_web/features_controller.rb b/app/controllers/featurer_web/features_controller.rb index f55a9da..df0a72a 100644 --- a/app/controllers/featurer_web/features_controller.rb +++ b/app/controllers/featurer_web/features_controller.rb @@ -23,7 +23,8 @@ def create def destroy Featurer.delete(params[:id]) - head 200 + flash[:info] = "Feature deleted" + redirect_to root_path end private diff --git a/app/views/layouts/featurer_web/application.html.erb b/app/views/layouts/featurer_web/application.html.erb index ee06b7d..71d0a35 100644 --- a/app/views/layouts/featurer_web/application.html.erb +++ b/app/views/layouts/featurer_web/application.html.erb @@ -7,10 +7,10 @@ + <%= csrf_meta_tags %> <%= stylesheet_link_tag "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css", media: "all" %> <%= stylesheet_link_tag "featurer_web/application", media: "all" %> - <%= javascript_include_tag "https://code.jquery.com/jquery-3.1.1.min.js" %> <%= javascript_include_tag "featurer_web/application" %> diff --git a/featurer_web.gemspec b/featurer_web.gemspec index 53c8957..e7d4c1b 100644 --- a/featurer_web.gemspec +++ b/featurer_web.gemspec @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- $LOAD_PATH.push File.expand_path('../lib', __FILE__) # Maintain your gem's version: @@ -18,4 +19,5 @@ Gem::Specification.new do |s| s.add_dependency 'rails', '>= 4.2.7' s.add_dependency 'featurer', '~> 0.1.1' + s.add_dependency 'jquery-rails', '>= 1.0' end diff --git a/lib/featurer_web/engine.rb b/lib/featurer_web/engine.rb index 12b21d0..a7764e4 100644 --- a/lib/featurer_web/engine.rb +++ b/lib/featurer_web/engine.rb @@ -1,5 +1,6 @@ module FeaturerWeb class Engine < ::Rails::Engine + require 'jquery-rails' isolate_namespace FeaturerWeb end end