Forum: Ruby on Rails Modal Ackowledge

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
140c065a9604b5321768cbe02e91ef30?d=identicon&s=25 Anton Aylward (Guest)
on 2007-02-25 00:46
(Received via mailing list)
At the moment I have controller that deal with error messages and
acknowledgements.  I redirect to this with a message parameter and the
of event (which determines if the icon is a smilie, a bomb, an
mark or a question mark) and the url to go to on the OK button.

You are probably familiar with this kind of thing on the GUI of your
operating system :-)

However it seems heavy handed to send a complete new page in many
conditions.  For example, access control errors could probably be better
served by a pop-up that when ack'd leaves the user where he was.

I realise that this will require identifying what parts of the code need
pop-up modal rather than a sequential modal.

My question is this:  Is there a simple way to "render" a pop-up modal?

Second question:
Am I better off with

  @item = Item.find( .... )
  if @item.access.edit?
  else # Modal page
      redirect_to ( :controller = 'oops',
                          :action => 'accesscontrol',
        :class => 'Item', :object => @item,
        :message => "Cannot edit",
        :return_url => ???????

or am I better trying to set up some kind of exception handler?

Opportunities multiply as they are seized.
    --Sun Tzu
2017657725dd1bce83dc8a1e2e991d04?d=identicon&s=25 Luke Ivers (Guest)
on 2007-02-26 20:57
(Received via mailing list)
Since a pop-up window would be something opened on the client's PC, you
would be required to use javascript to open one.
This is relatively easy, all you have to do is have an onclick function
whatever generates the error (say they have bad info in a form, and when
they click on submit, you want to use a popup... then you would add an
onclick to the submit button), and have the JS for the onclick be
like alert('You screwed up the form... no soup for you!')

There are plenty of sites on the internet showing how to use the JS
function... you can check w3c, they tend to have some good reference
material on things of this nature.
140c065a9604b5321768cbe02e91ef30?d=identicon&s=25 Anton Aylward (Guest)
on 2007-02-26 23:23
(Received via mailing list)
Yes, I've hunted down a few like RedBox.

But they all see to work by having the page already on the client having
 stuff that the popup is made of.

So.imagine a wiki page like - yes I know this isn't Rails -
there are 84 "internal" links, that is links that get dealt with by the
engine.  Some pages have a lot more!

Each one of those would need the ability to trigger at least one RedBox.
(One for access control but maybe others)

I find this a bit overwhelming.  A DRY violation?

It also puts the process into the generation of the page and not at the
response at the server - where the information about the page being
to resides.  This doesn't make sense to me.

Now even if I can just get one RedBox on each page that is somehow
by the ... I don't know what ... it still seems I have to embed in the
all the information that I was trying to encapsulate in the "Oops" error
handler (oops_controller.rb)

This doesn't make sense to me.

Then there is the matter of fall-back in the absence of JavaScript to
way I'm doing it at the moment with the Oops controller being a
and handing out pages and having a "return to" or "go to next" in the

I'm now hoping that there is some way to mix AJAX and RedBox, having a
generic box that the Oops controller can modify the DOM to produce the
'popup' modal dialogue box, fill it AND deal with the response.

But I'm afraid putting it all together is beyond me, so I'm hoping there
a genius out there who can.

Luke Ivers said the following on 02/26/2007 02:56 PM:
> reference material on things of this nature.
>                               :action => 'accesscontrol',
>     --
>     Opportunities multiply as they are seized.
>         --Sun Tzu
> >

Give a man a fish, and you'll feed him for a day. Give him a religion,
and he'll starve to death while praying for a fish.
    --Timothy Jones
This topic is locked and can not be replied to.