How to close color box automatic with .js.erb - ruby-on-rails

How to close colorbox automatically, and stay on the page ... neither redirect to another page nor reload the page ...
I have tried to use
parent.$.fn.colorbox.close();
or
$.fn.colorbox.close();
or
$.colorbox.close();
but those were not work
Any idea? Thx u

Those all work depending on the situation. There isn't an alternative answer to how to close colorbox, you have something setup incorrectly. Maybe you are loading colorbox twice or something. There isn't enough information to determine why it isn't working from your post. Consider adding a demo.

Related

Masonry JQuery with Rails for Transistions - Need to refresh page for it to work

I am using masonry rails gem in order to have my posts nicely transition depending on the screen size and stuff but for some reason I always need to refresh the page in order for masonry to start working. Whenever I first visit a page it has all the posts in one column on the left hand side of the screen, then when I refresh the page is displays the posts properly using the masonry transitions. Has any one experienced this before or possible know a solution to resolve this?
Thanks in advanced!
UPDATE: looking into the console as I thought maybe some css ids or classes weren't being applied on the first load but they all are. I also had disable cache checked so I thought that could have been causing it but after unchecking it the problem persists.
I would greatly appreciate any input on what may be causing this.
UPDATE2: I have tried deleted the masonry code to see if its the masonry causing this to occur or previous styling. It appears to be the styling as the page loads with everything in one column on the left when the masonry is disabled. I am not sure why this happening.
I was able to figure it out. I was not including
*= require 'masonry/basic'
in my application.css.scss
After applying this and fixing all the post divs to be the same size masonry is working as it should an no longer are the columns all being pushed to one side. Hooraahh!!

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.

Using codemirror in jquery.ui.dialog loses focus onload

i try to use codemirror in a jquery ui dialog.
here you can see the result in jsfiddle.
http://jsfiddle.net/HtntY/
the problem is that the content in codemirror does not appear on first load. it only appears after you set focus on the editor and than type something, after that the preloaded content appears.
can this be fixed somehow. i tried to do it with the refresh() function without success.
thanks for you short time.
Looks like jQuery UI hasn't actually unhid the DIV when the opener runs. Putting a refresh call in a timeout (as in http://jsfiddle.net/NP9SL/ ) seems to do the trick.
I ran into the same problem and wound up running the editor.refresh() off the focus event, FWIW. I thought I'd mention another, somewhat related problem. If you try to take advantage of the CodeMirror dialog/search functionality inside of JQueryUI modal dialog, the integrated search dialog fails to get focus and you can't type into it. Interestingly I can paste text into the search field, but I cant type. Have yet to find a way around this other than setting modal to false.

Sharepoint webpart- edit mode Display

I have developed a custom webpart which is being displayed correctly and has some external parameters and being supplied when it is used in the page.
There is a problem in displaying that webpart in edit mode. In edit mode it is not visible as the page footer comes up and only little portion of the webpart is being displayed. To see the whole webpart I need to scroll through. This problem is happening only when the web part is in edit mode.
In Display mode it is Fantastic.
The Way it looks on the Page in Edit Mode is:
Could anyone point me whats being missed and why it is happening?
Thank You
Hari Gillala
Two things to check:
If you have edited the master page/page layout, you might not have closed a html tag, or the styling might be wrong.
With the custom toolpart, is it outputting valid html?, check that you have built the table correctly, and are using the correct styles.

Display Artefacts when Switching Pages in TMS TAdvOfficePager

I'm using TAdvOfficePagercomponent from TMS Software. Inside each page I use a frame. When switching between pages I get some ugly display artefacts like this:
The controls from the old page and the controls from the new page are both visible for some time.
Is there anything I can do about this?
Note: There's nothing happening in the OnShow event handler, it's really just the page switch causing the artefact.
Thanks for your help in advance.
tms have a lot of problem in theirs components. solutions:
1) try redraw the component
2) sometimes enable->false and then enable->true can solve it(also try with visible)
3) take the code, digg in it and resolve the problem by yourself....
best regards,

Resources