Forum: Ruby on Rails how to show waiting msg while rails is doing something else

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
sayoyo (Guest)
on 2007-01-05 17:20
Hi,

I have some calculation to do in some part of my ruby-rails application,
I wish to show a "waiting message" whilw rails is calculating the result
and when the result is already, I can remove the waiting message and put
the final result. I have no idea how I can do this. can some one give me
a clue????

Thanks you very much

Sayoyo
Nobody E. (Guest)
on 2007-01-05 17:44
sayoyo wrote:
> Hi,
>
> I have some calculation to do in some part of my ruby-rails application,
> I wish to show a "waiting message" whilw rails is calculating the result
> and when the result is already, I can remove the waiting message and put
> the final result. I have no idea how I can do this. can some one give me
> a clue????
>
> Thanks you very much
>
> Sayoyo

This action might be a great candidate to use AJAX for...  Check out
this simple tutorial on the subject:

http://www.onlamp.com/pub/a/onlamp/2005/06/09/rail...

It should help you out.

- Greetz,

Danny
sayoyo (Guest)
on 2007-01-05 17:56
Hi,

Thanks you very much for the info. But, we have already tried, but it
doesn't really what we need, since we have to tell the users how many
percentage the task has been completed, ajax just allow us the change
the html contain once, but not a interval of time.... also, we render to
a new /controller/action when the calculation happens. so ajax can't
hardly apply here,

Thanks you very much for the information

Saiho


Daniel Owen van Dommelen wrote:
> sayoyo wrote:
>> Hi,
>>
>> I have some calculation to do in some part of my ruby-rails application,
>> I wish to show a "waiting message" whilw rails is calculating the result
>> and when the result is already, I can remove the waiting message and put
>> the final result. I have no idea how I can do this. can some one give me
>> a clue????
>>
>> Thanks you very much
>>
>> Sayoyo
>
> This action might be a great candidate to use AJAX for...  Check out
> this simple tutorial on the subject:
>
> http://www.onlamp.com/pub/a/onlamp/2005/06/09/rail...
>
> It should help you out.
>
> - Greetz,
>
> Danny
Nobody E. (Guest)
on 2007-01-05 18:00
sayoyo wrote:
> Hi,
>
> Thanks you very much for the info. But, we have already tried, but it
> doesn't really what we need, since we have to tell the users how many
> percentage the task has been completed, ajax just allow us the change
> the html contain once, but not a interval of time.... also, we render to
> a new /controller/action when the calculation happens. so ajax can't
> hardly apply here,
>
> Thanks you very much for the information
>
> Saiho
>

Ajax does have methods for doing your interval thing. Just check the
second page of the tutorial it speaks of it a little... Consider this
little extract from the tutorial:

<label for="searchtext">Live Search:</label>
<%= text_field_tag :searchtext %>
<%= observe_field(:searchtext,
                 :frequency => 0.25,
                 :update => :search_hits,
                 :url => { :action => :live_search }) %>
<p>Search Results:</p>
<div id="search_hits"></div>

Just check the Internet a little for some info. Since I'm currently
actually learning Rails (have to know enough to work in it by monday) I
can't really help you specifically, but Ajax is definately the way to go
here, I believe anyway...
sayoyo (Guest)
on 2007-01-05 18:18
Hi Daniel,

Once again thanks you for the informatin, however, "the interval" you
have mentionned works on a specific html component(oberver field), I'm
really not sure that it will work on a currently running rails processus
(I may be wrong), what we are trying to do is gathering information from
user, than compute the information, to activate the computation, we use
a normal "rails-button" from a form it means, it will send the result on
a new /controller/action. but between the old /controller/action and the
new one, there will pass a several seconds, 10 -20 sec. but since the
"post/get" is already send to server, the browser is waiting.... and we
would like to have some "waiting message", just want to keep the user
eye busy...

Thanks you bery much

Saiho






Daniel Owen van Dommelen wrote:
> sayoyo wrote:
>> Hi,
>>
>> Thanks you very much for the info. But, we have already tried, but it
>> doesn't really what we need, since we have to tell the users how many
>> percentage the task has been completed, ajax just allow us the change
>> the html contain once, but not a interval of time.... also, we render to
>> a new /controller/action when the calculation happens. so ajax can't
>> hardly apply here,
>>
>> Thanks you very much for the information
>>
>> Saiho
>>
>
> Ajax does have methods for doing your interval thing. Just check the
> second page of the tutorial it speaks of it a little... Consider this
> little extract from the tutorial:
>
> <label for="searchtext">Live Search:</label>
> <%= text_field_tag :searchtext %>
> <%= observe_field(:searchtext,
>                  :frequency => 0.25,
>                  :update => :search_hits,
>                  :url => { :action => :live_search }) %>
> <p>Search Results:</p>
> <div id="search_hits"></div>
>
> Just check the Internet a little for some info. Since I'm currently
> actually learning Rails (have to know enough to work in it by monday) I
> can't really help you specifically, but Ajax is definately the way to go
> here, I believe anyway...
Kad K. (Guest)
on 2007-01-05 18:29
sayoyo wrote:
> Hi Daniel,
>
> Once again thanks you for the informatin, however, "the interval" you
> have mentionned works on a specific html component(oberver field), I'm
> really not sure that it will work on a currently running rails processus
> (I may be wrong), what we are trying to do is gathering information from
> user, than compute the information, to activate the computation, we use
> a normal "rails-button" from a form it means, it will send the result on
> a new /controller/action. but between the old /controller/action and the
> new one, there will pass a several seconds, 10 -20 sec. but since the
> "post/get" is already send to server, the browser is waiting.... and we
> would like to have some "waiting message", just want to keep the user
> eye busy...
>
> Thanks you bery much
>
> Saiho

why don't you try backgroundrb  ?

http://backgroundrb.rubyforge.org/
sayoyo (Guest)
on 2007-01-05 18:41
OK,

thanks for the information I will have a close look on it!



> why don't you try backgroundrb  ?
>
> http://backgroundrb.rubyforge.org/
koloa (Guest)
on 2007-01-05 18:58

there is a rjs tutorial from oreilly for 6 bucks.. i highly recommend it
because it shows how awesome it is to use rjs + ajax.

sayoyo


 wrote:
> Hi,
>
> I have some calculation to do in some part of my ruby-rails application,
> I wish to show a "waiting message" whilw rails is calculating the result
> and when the result is already, I can remove the waiting message and put
> the final result. I have no idea how I can do this. can some one give me
> a clue????
>
> Thanks you very much
>
> Sayoyo
Stephan W. (Guest)
on 2007-01-06 00:34
I think what you are after goes under the title "Progress Bar".

Maybe search the web for that.

Stephan
This topic is locked and can not be replied to.