Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AJAX Reveal modals break layout on second open #2928

Closed
alecmatias opened this issue Aug 2, 2013 · 6 comments
Closed

AJAX Reveal modals break layout on second open #2928

alecmatias opened this issue Aug 2, 2013 · 6 comments

Comments

@alecmatias
Copy link

I upgraded from 4.0.7 to 4.3.1 because Reveal's AJAX modal wouldn't open. Now it does open, but if you close it and then open it a second time, it won't open within the current view nor darken the page.

Static modals work fine, however.

Bonus issue: AJAX modals don't have the close icon.

@architagr-cs
Copy link

I am also facing the same problem.

Regarding your bonus issue - I moved <a class="close-reveal-modal">&#215;</a> to the file which will be called through ajax request. Like if you are calling /index.html through ajax then add <a class="close-reveal-modal">&#215</a> to index.html.

@architagr-cs
Copy link

Found the solution - just add layout false to any controller whose actions you are calling through ajax.

Or

If you want only for an action then add render :layout => false to that action.

@ghost ghost assigned mhayes Aug 15, 2013
@martin-eberle
Copy link

archit2u, can you tell a little bit more about your solution? Maybe with am example?
I don’t get it …

@architagr-cs
Copy link

Hi Martin,

For e.g. there is a TestsController in your application and you want actions of that controller to render the views in foundation modals. To do that you can do the following in your TestsController:

class TestsController < ApplicationController
#add the following line.
layout false
....
....
end

If you only want to render the view of a particular action you can do the following:

def edit
   respond_to do |format|
         format.html {render :layout => false} #add this line.
   end
end

Hope this helps.

@martin-eberle
Copy link

Hi Archit,

well, i’m using foundation reveal completely different. I only have something like this:

<a href="/link/to/site" data-reveal-id="layout-reveal" data-reveal-ajax="true">Link Text in here</a>

So, there is no controller where i might set the layout property. But maybe, there is also a solution for my case?

Thank you anyway,

Martin

@martin-eberle
Copy link

Ok, i found the solution for our case:

in the via ajax requested site was the complete header again and so foundation was initialized twice …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants