I am seeking feedback in a materialize-css modal view:
<% @contents.each do |content| %>
some form elements
<%=button_to('Comments', new_comment_path, :method => :get, params: { :content_id => content.id }, :class=> 'modal-trigger', 'data-target'=>'modal4'+content.id.to_s) %>
<% end %>
modal=>
<div id="modal4<%=content.id%>" class="modal modal-fixed-footer">
<div class="modal-content">
<%= form_for Comment.new, remote: true do |f| %>
…
…
<%= f.submit 'Send’ %>
<% end %>
CommentsController =>
def create
@comment = Comment.new(comment_params)
end
The values are stored in the database: Rendered comments/create.js.erb (0.0ms)
However, I am facing an issue where the modal does not close after submission.
create.js =>
Attempts made with
$('#modal4').closeModal();
$('#modal4').modal('close');
$('modal4<%<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="516c11323e3c3c343f257f323e3f25343f25">[email protected]</a>_id%>').closeModal();
$("modal4<%<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="162b5675797b7b7378623875797862737862">[email protected]</a>_id%>").modal('close');
Unfortunately, none of these methods were successful.