How can I make the jquery ui dialog opened even after page reload - ruby

I have a webapp that store a layout,
And on its edit mode the user should click on the layout option inside a jquery ui dialog.
After the user choose the template that he/she want, the page will automatically reload.
I want the jquery-ui keep open even after the page was reloaded...
Hope it makes sense.
Hoping for your replys.
King Pangilinan

I guess your whole page is being reloaded? If so you can't keep the dialog open but re-open it when your dom has been loaded. To do so you can do:
$(document).ready(function() {
$("dialog_selector").dialog('open');
});
That just opens it. Now if you want to do it on a page reload you would have to embed this javascript code in some conditional ERB-code (if you're using ERB) or similar which meets your conditions...
Hope it's clear what I mean.

Related

Reusing the instance of CKEditor in the Jquery UI Dialog

First, I create an instance of CKEditor named 'richEditor' in a webPage.
Second, upon a button click I am making ajax call, which returns html data, and showing it in a jquery UI dialog.Then I am copying the HTML of 'richEditor' instance already present in the webpage and pasting it in a div in the dialog.
But the reused 'richEditor' instance does not work.Any button click in the editor is throwing javascript error and neither the textarea nor the source text area is editable.
Any help or thought is really appreciated.
You cannot basically copy the HTML of the editor and reuse it. First of all, DOM structure of the instance is strictly connected to the JS code driving the editor (and vice versa). It's much deeper than plain HTML. The second reason is that the editor you use is based on the iframe, which cannot be copied preserving its content.
In other words: You have to create another instance of the editor to run it somewhere else. Please refer to the official guide and API docs to know more about CKEDITOR.replace(), CKEDITOR.appendTo() and CKEDITOR.destroy().

N2CMS: how to add popup conent

I have a news-type website that I am looking to create using N2CMS, but besides the regular operations (being able to see a calendar, viewing lists of news, viewing news details etc.), part of the content in the website is displayed in "modal" popups (similar to the ModalPopupExtender from the AjaxToolkit) inside the page (for example if you click Login, a popup panel appears with the login controls).
My question is: is there a way of adding a handler for a link, and displaying a "modal" popup when the link is clicked? If so, can this be done from the template GUI editor (and how)?
Thank you
N2CMS doesn't have any built-in handlers to create modal pop-ups for links. However, N2CMS does ship with the Jquery JavaScript library. My suggestion would be to use JavaScript in your site template to select and format the desired links with modal dialogs -- but that can't be done from the GUI editor, you'd need to do it in the template code directly.

Ordering issue in modal window

I have a problem with a component that loads in to a modal window. I am using the Alpha User Points system and it has a component that gives you a full list of yous site's users. It also gives you the ability to order by username, by points etc. If I use it outside of modal window it works fine. If I use it in to modal window, ordering don't work!!! When I put my mouse over table's headers, outside of modal window gives this...javascript:tableOrdering('aup.referreid','asc','');In to modal window I see this...javascript:tableOrdering('aup.referreid','asc','');?ml=1 Using Firebug, I remove this ?ml=1 and it works into modal also!!! So the question is, why in to modal window gives this ?ml=1, what is this? And how will I remove it?
Well here is the answer... I use the Modalizer extension of nonumber.nl. I was loading my component through modalizer's modal box, this is why I had this issue. So, if anyone use Modalizer to popup components and have the same problem with me, just go to modalizer's Plugin Manager, find the option Convert Links inside Window and disable it!!! But, after this, if you want to add link in to modal window and you don't want to show-up the whole front page but only the component or what ever this is, you have to add at the end of the link this &ml=1.

Loading inline content from an iframe

First of all, I had all my buttons which opened the Colorbox using the "ajax" class. That class however caused me many problems:
1-When I open one window, it will appear, when I close it and re-click the same button, it will be loaded twice (so I need to click twice to close)
Is there a fix for this?
What I have done for the moment:
Use iframes; my only problem now is I cant load the other colorboxes that are linked in that iframe. I am using the inline class.
Let me re-phrase that: I click on button "generate" it opens first colorbox with the iframe class. Inside that iframe I have a "generate_2" button which has inline content. Once I click that second button nothing happens. This used to work when I had the first button set to ajax.
What can I do?
thanks!
I had the same problem before. Since JavaScript cannot affect iframes, you must add the JavaScript code inside a script tag in the iframe page itself.
when I close it and re-click the same button, it will be loaded twice (so I need to click twice to close) Is there a fix for this?
I'd wager you are using ajax to open a complete HTML document, aren't you? You shouldn't be doing that. It's not valid HTML to nest one HTML document inside another, and you are causing the scripts from both to be applied to the original document. Each time you load that content, those scripts are being loaded and executed all over again.

fast Javascript templating engine that works with jQuery superfish?

I have a project with a very standard layout so I suspect this is a common problem:
<body>
HEADER-CONTAINER DIV - includes superfish jQuery menu plugin but am open to other menu options if necessary.
CONTENT-CONTAINER DIV - depending on the page, contains several other jQuery plugins, HTML, javaScript, etc.
FOOTER-CONTAINER DIV
</body>
I'm looking for a elegant and well performing way to have a superfish menu click load the CONTENT-CONTAINER DIV with new content. The content contains both HTML and javaScript. I also want the solution to change the URL so if someone returns later to /my/page it will reload to the correct location (similar my understanding of Backbone.Router).
Any suggestions? If possible, please provide a link to a page loading into a div example and running any javaScript included in the load.
Superfish or not this is not really a problem. Whenever you add html to the page the browser will execute any javascript or load any javascript file this new html snippet will contain.
So when you click on your menu, you load (or generate) new html and replace your content div with this new content, the browser will execute the scripts.
You will have to rebind all events on that newly inserted content because jQuery will loose track of that.
I searched around and found the a decent example that shows how to take any #url and reload a div. Example found at http://thomasdavis.github.com/examples/restful-app/

Resources