javascript - Twitter Bootstrap Modal not popping up for user login -
When a login bootstrap pop-over model has been made for a user at my home, For Login / Signup page can I have spent some time but have not had any success till now. As of now, when I click on the "Login" button which is associated with the model, the site refreshes but there is no model.
apps / views / layout / _header.html.slim (my Application.erb file is called in other partial)
li = link_to "login", "data -Toggle "=> "Model", "Data-Target" = & gt; "# Login_model" ,: class = & gt; "BTN BTN-Small" li = link_to "Free Registration", "Data-Toggle" = & gt; "Model", "Data-Target" = & gt; "#sign_up_modal",: class = & gt; "BTN BTN-Small"
I have two partial (sign_up_modal, login_modal) which are almost identical ...
'BTN BTN-Small BTN-Success'% & gt; & Lt; / Div & gt; & Lt; / P & gt; & Lt; P & gt; & Lt; A href = "#" class = "btn btn-small" data-discarded = "model" & gt; Close & lt; / A & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt;% end% & gt; & Lt; / Div & gt;
In my application. Coffee has made sure that Twitter / Bootstrap is required
# = Twitter / Bootstrap requirement
and I have ensured that the gem Add to my gemfile
Mani "Twitter-BootStrap-Rail"
When I click on either "Sign up" or "Login" Just refresh the page..I believe I have added all my code, to stack overflow A sorry!
apps / controllers / sessions_controller.rb
Classroom Session Controller & lt; ApplicationController def new end def user = User.from_omniauth (env ["omniauth.auth"] session [: user_id] = user.id redirect_to root_path end DR deleted session [: user_id] = zero redirect_to root_path end and
This model is triggered on this button
& lt;% = Link_to "login", new_user_session_path ,: remote => true, 'data-toggle' = & gt; 'model', 'data-target' = & gt; '#your_modal_id' ,: class = & gt; "BTN BTN-Primary" ,: Method: 'Go'%>
To work for this you have to answer sess to answer AJAX requests Ions #new
and registration # new
. You can do this, as if blocking a response on both of these actions.
Response_to do | format | Format.js end
Then your app / view / devise / registrations
and app / view / devise / session
create New.js.erb
files You can remove login and sign-up form from the modal and send javascript to the formats located in these new.js.erb
files. Can present inside I
You can remove the form and form the loading GIF from the modal-body
form. You can instead add a form in part and put it in the app / ideas / devise / sessions / _login_form.html.erb
. Then you do something like this in app / visual / devise / session / new.js.erb
.
$ ('# your_modal_id'). Removal-Data $ ('modal-header') Html ("& lt;% = escape_javascript (render '/ path / per / partial / with / header / content')%>); $ ('Modal-body'). Html ("& lt;% = escape_javascript (render '/ path / to / partial'))%>;); $ ('Modal-footer') Html ("& lt;% = escape_javascript (render '/ path / to / partial'))%>;);
Comments
Post a Comment