# Popup questions

**URL:** <https://www.ruby-forum.com/t/popup-questions/122665>\
**Category:** Rails\
**Created:** [December 10, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/popup-questions/122665 "2007-12-10T14:42:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [December 10, 2007, 2:42pm UTC](https://www.ruby-forum.com/t/popup-questions/122665/1 "2007-12-10T14:42:11Z")

</div>

I’m OK with the idea of a help button that is a  
link\_to (… :popup  
that produce a modal box.

Q1: Can I make it produce a non-modal box?  
So the help text stays up but the user can continue working?

But I’m trying to to deal with modal dialogue boxes.  
The most obvious one is a logo box. I’d like to do the login without  
actually changing the page behind the dialogue box.

Q2: Can :popup produce dialogue boxes? I presume they would be based  
on  
partial, but would they need special actions

Its nice to have a ‘login’ pop-up from a link\_to button but suppose I  
need that same UI popup generated programatically.

def read

```
 if ! @page.acllist.nil? # page has restricted access
   if @current_user.nil?
begin
    # trigger login dialogue box if javascript *****
    # redirect to login page if no javascript *****

end
  # either logged in or not
        if @current_user.nil
raise Application::AccessControlError \
                              "You must be logged in
      return false
        end
        if @page.acllist["read"].include(@current_user.name).nil?
raise Application::AccessControlError \
  "You don't have permission to read that"
return false
  end
  ..... # continue processing page

```

Q3: Is there a way to determine if javascript is available?  
Failing that, how can the “if javascript then …  
else redirect and return here”  
be handled?

Q4: Will things in the controller actually be updated by a modal  
dialogue box? Or would I have to re-scan the database to  
update @current\_user? How would I cope with non-database  
variables? Suppose the modal dialogue box asked for a discount  
code?

Q5: Can I link error handling to dialogue boxes?  
If so, how can I hand over more parameters (e.g. a redirect to  
as opposed to a ‘stay where you are’)?

I know that’s a lot for one post, but as you see the questions are  
related and I’m sure this is something a lot of other people would find  
useful.

–  
Five exclamation marks, the sure sign of an insane mind.  
– Terry Pratchett _Reaper Man_
