The modal is popping up for agent.page.at("a.name-page-link")["href"]
, but not new.html.erb
. Why?
A user clicks "+ Challenge" on create.html.erb
:
header.html.erb
A modal pops up for <%= link_to new_challenge_path, data: { modal: true } do %>
<span class="glyphicon glyphicon-plus"></span> <b>Challenge</b>
<% end %>
:
new.html.erb
<%= simple_form_for(@challenge, html: { data: { modal: true } }) do |f| %>
etc...
<% end %>
And once the user clicks def new
@challenge = Challenge.new
respond_modal_with @challenge
end
def create
@challenge = Challenge.new(challenge_params)
if params[:step] == '2'
respond_modal_with @challenge
@challenge = current_user.challenges.build(challenge_params)
@challenge.save
end
end
on f.submit
he is redirected_to new.html.erb
since it is create.html.erb
in the process. I want :step, 2
to also be in a modal though, which for some reason it is not.
create.html.erb