Modal window don't work times to times in any browser - ruby-on-rails

I create application on ruby on rails and add modal window for login. I put modal code in partial layouts/header. I expect it must work on every page of my app but not. Modal don't open in home/index. It's start work on home/about. I don't understand why. I'll update my ask If needs code. Can anyone help me understand?
I try to move modal code on another pages but get same effect.

home/index and home/about is URI?
Make sure you use the same layout (header file) and the modal element exist in HTML of home/index (you can use dev tool - f12 for checking)
Please, Does the modal need to be triggered by a button or something?

Related

JQM Popup doesn't popup when url has GET details in it

I have a page which displays a calendar/diary and lets you navigate back and forth using a form so the URL often looks like:
calendar.php?&month=6&year=2014
The popup works fine initially before there is any string after the .php. However, once the "&month=" etc is there the popup doesn't work. I note as soon as the popup loads it shows up #&ui-state=dialog in the url.
Is there a simple solution for this? (Other than changing the form to method=post, which I haven't yet tried).
Many thanks.
The simplest solution is to add:
data-history="false"
to your popup <div>. That will avoid URL modification when the popup is open.

Templates and sub Templates aren't working in Nav

So, I've got this app I'm working on. I've got a nav built and it sort of works. But not right. I'm pretty confident I'm screwing this up some where.
The nav looks like this. The problem is, that it never shows the current view highlighted in the nav (except for dashboard) unless i go directly to that page. But, if I do go directly to the page, none of the angular stuff works? The second problem is, under the Admin menu, I can't get any views to appear. But, if I refresh the page, then I can? That seems odd.
This is what my routes look like. What am I missing?
UPDATE:
Ok, so, if I start from dashboard, then navigate to other pages (such as admin/create or admin/manage) then it doesn't work (except for /properties) and I don't see the view update correctly (again, except for /properties). However, if I start in /properties, refresh the page, I see the content (minus any of the angular stuff), but I can navigate to admin/create and admin/manage. Again, Angular doesn't work, but I can at least navigate and see the rails partials.
UPDATE 2:
So, I figured out my own first mistake. I needed to add the routes into the angular side as well as the rails side. Now, I just need to figure out why highlighting isn't working?
Move the partials to it's own foler:
example: app/views/shared/_partial_name.html.erb
right now, you have the partials under the layout folder. And my guess is that is causing the rendering problem.
Keep application.html.erb as the only file under the layouts
then render the partials as shared/partial_name

Modal window in AngularJS does not open on first click

Please see the plunkr code demonstrating an issue I am seeing with the modal service in AngularJS.
Basically, I have moved the HTML contents for the modal window into a separate file, now when the button is clicked the backdrop appears but the modal window does not - on the first click.
If you then press escape to dismiss the backdrop and then click the button the modal window appears.
I am assuming that this is because the file is not loaded the first time when I click the button-but if so how do I use the templateUrl property to enable me to store the content for the modal window in a separate file?
Thanks for your help on this.
The issue does appear to be due to the separate file specified in the templateUrl not yet having been downloaded when the first click happens and I have now been able to work out a solution by adding the following line into the index.html file:
<div ng-include="'mymodalcontent.html'"></div>
This directive adds a reference to the file which loads the templateUrl so that when the button is clicked the first time the modal window will appear as expected.
Please note the value in the ng-include attribute has to have single quotes in order to work as detailed in the documentation for the ng-include directive. This detail is mentioned in the section named arguments and advises:
If the source is a string constant, make sure you wrap it in quotes
I have updated the plunkr code to include the fix.
The only downside to this is the original purpose behind moving the modal window contents into a separate file was to only download the contents if the user clicked the button thus saving bandwidth for users accessing the site on a mobile device.

Link from modal in modal

I am using VirtueMart 2.0.10 and Joomla 2.5 and the products page is set to open in a modal popup. In this way any additions to the cart trigger a second modal (modal in modal, if you like) that includes links. At the moment the links open in the first modal that opened, but I would like the pages to open in the original window from where we started.
How do I modify the href links to open in the original window not in the modal popup? Or do I need to write some script for this?
Thanks for any help!!!

Render 2 views at the same time?

I'm kinda new to rails so forgive if this is a stupid question.
The scenario is:
I got my events controller with a index view that shows all events on the page. Now, what i want to achieve is: User clicks on one of the events, lightbox comes up showing all info about about that one event, with all the other events still behind the dark background of the lightbox. User closes the light box and process repeats. Pinterest is a good example of what i'm trying to do.
At the moment, i got these 2 views working properly. User clicks on the event and is taken to the show action.
So i'm wondering if what i'm trying to do is RESTfully achievable(without too much hacking around) in rails(3.2.8) and if so, would appreciate some insight as to where i should start from.
Thanks a lot.
As far as I understand what you want to achieve, it has nothing to do with actually rendering 2 views at the same time. What you're describing is simply making an ajax call with lightbox that opens up an URL that renders another view in the shown DIV or IFRAME (whatever lightbox uses)...
Depending on which version of Rails you use the implementation of this looks a bit different. But actually what you have to do is simply include LightBox2 in your Rails app, by simply adding the appropriate JS and CSS files and then supply the necessary class at your link_to calls...
Hope it's clear what I mean.
UPDATE
See this link for further info.

Resources