Flash Notice Alert dismiss-able bootstrap and rails -- Cannot Delete flash notice -
i using emailer ruby on rails , has flash notice on completion. cannot seem delete bootstrap flash notice when press x button listed next flash notice. have tried jquery.
whenever put class close on button. button not show clicked. here of code. create.html.erb
<div> <% flash.each |key, value| %> <div class="alert-dismissible flash_notice" role="alert"> <button type="button" data-dismiss="alert" aria-label="close">xxx<span aria-hidden="true">×</span></button> <%= value %> </div> <% end %> </div>
this contact controller emails me contact me form , renders flash notice
class contactscontroller < applicationcontroller def new @contact = contact.new end def create @contact = contact.new(params[:contact]) @contact.request = request if @contact.deliver flash.now[:notice] = 'thank message. contact soon!' else flash.now[:error] = 'cannot send message.' render :new end end end
here of application.js code... messy , have tried of following , left them show have done far in attempts.
//= require jquery //= require jquery_ujs //= require turbolinks //= require bootstrap-sprockets //= require_tree . $('.delete_notice').click(function() { $('.alert-dismissible').hide(); }); $('.delete_notice').click(function() { $('.alert-dismissible').close(); }); $('.delete_notice').click(function() { $('.flash_notice').hide(); }); $('.delete_notice').click(function() { $('.delete_notice').close(); });
Comments
Post a Comment