Open up a pop-up window, select an item and go back to main window in Rails 3.2 - ruby-on-rails

Inside a page called Program edit, there will be a button named Select image and as it is clicked, a Pop-up window will open which shows list of images. After selecting an image from the list and click to the Add button, pop-up will close up and selected pictures ID will be passed to main window. It should be available to use at program's params after closing image list popup.
Here is the scenario I would like to have.
Which way should I follow while doing this?

You need a version of responds_to_parent rails plugin. That can do the trick.

I've learnt that I can do it via JavaScript and AJAX. Similar to this: http://snipplr.com/view/7461/get-selected-value/

Related

Vaadin 14: Trying to open Page in background from Dialog while keeping the dialog opened

I have a dialogue box that is:
Draggable
Modal
Requirement:
I have a requirement where I don't need to close my dialogue and have to load the different pages in the background on the selection of data from the grid that is on Dialogue.
What did I do:
I know how to open the page in the background with the help of a de-attached listener.
vehicleInfoPopUpView.addDetachListener(e -> {
UI.getCurrent().navigate(AssignmentPageContainer.class,
String.valueOf(vehicleInfoPopUpView.getCanFileNumber()));
});
The above code (in the parent page) loads/opens a new page but to do this I have to close my dialogue box (which I don't have to do, I have to keep the dialogue box open).
I cannot find any resource that tells me How to load/open a new page in the background from the dialogue box without closing it
Any small help! Thanks for the help in advance.
First of all: Don't.
Keeping a modal dialog open whilst navigating to a different page/route makes no UX sense. A modal window means you cannot interact with the background.
Just call UI.getCurrent().navigate(AssignmentPageContainer.class) directly (outside of detach listener) to open the view based on the selection. The user will open the dialog again himself, if he will want to. You can trigger this on some button click.
Secondly, as a workaround you could store the state of the dialog in a #UIScoped service and open & reinitialize the dialog f.e. in the afterNavigation method.

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!!!

Why using select boxes with data-native-menu="false" in chained dialogs generates url hashes that leads to closing the current dialog?

I use chained dialog boxes to collect some input data. Every dialog has a select box, a next button and a popup menu that enables the user to jump back to every dialog in the chain before the current one.
On a startpage a button opens the first dialog box. When you select an entry from the select box and go over to the next dialog by clicking the next-button everything works fine. Jumping back to the first dialog by selecting the entry in the popup-menu also works fine. But after clicking again on the next-button to get back to the second dialog, selecting an entry in its select-box leads to closing the dialog and showing the startpage again.
Why is that? I think it has something to do with the ui-state=dialog-URL-adds in the hash (issue 949), issue 1030)
I use data-native-menu="false" in my select boxes. When I use the default data-native-menu="true" everything works fine.
JQ V1.8.2
JQM V1.2.0
Tested in FF, Safari
I also started an issue ticket on the JQM githup page.
The mentioned ticket brought the solution. This behaviour will be fixed in the next release. Here you can test my problem and here you can try the solution that brings the next release.
By the way: In the meantime you can use this piece of code to make the current release work:
$.mobile.pushStateEnabled = false;

jQuery tabs reloading content

I have an application that uses jQuery tabs to display different dynamic content for the user. The user has the ability to subscribe to various information feeds into "pods" on each tab. So for example the first tab might have 4 pods and each pod on the tab displays different information. The user has the ability to select a different template for each tab (like 4 smaller pods, or 2 larger ones, etc).
I have built a user interface to allow the user to rename the tab and to change the template that is displayed in that tab. The problem is when the user changes the template for a tab, the tab does not refresh/reload to show the new template. The only way to display the new template is to reload the whole screen.
I have tried using the following code after the tab has been updated in the database
$("#tabselector").tabs("load", tabindex);
However the above does not seem to reload the tab. I am not sure what I am doing wrong. Any suggestions would be greatly appreciated.
I'm not sure I got your question, but I'll try to guess what you are after from the last paragraph of your question.
If you want to change the URL of the remote/AJAX tab, you need to use the .tabs( "url" , index , url ) method. The load method will not load the tab again if it is already loaded. See the documentation.

Resources