I currently have a link to a Login screen, but its a separate page althogether. I have created a partial that is just the login box and password, and would like that partial to appear at a place on the page when the user clicks the link. Anyone know where I can find out how to do this? Thanks so much. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You use link_to_remote instead of link_to... then you have the destination
be a controller that just renders your partial and puts the result in that
div. Pretty easy actually.
<%= link_to_remote "Delete this post", :update =>
"login_form",
:url => { :action => "show_login_form",
:controller=>"login" } %>
<div id="login_form">
</div>
Then in your controller, assuming you have a partial at
app/views//login/_form.rhtml you just do
# displays the login form partial... used by an AJAX request
def show_login_form
render :partial=>"login/form"
end
You can do a lot more cool stuff though.. There''s a really good
O''Reilly
shortcut on RJS, but sadly I forget what it''s called.. I think
it''s RJS
Templates for Rails or something. Quality read, and helps you get started
quite quickly.
On 4/20/07, AbsolutZero
<absolut0music-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> I currently have a link to a Login screen, but its a separate page
> althogether. I have created a partial that is just the login box and
> password, and would like that partial to appear at a place on the page
> when the user clicks the link. Anyone know where I can find out how to
> do this?
>
> Thanks so much.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
oh wow that does sound easy, I''m gonna try it out. I''ll respond on how it works out... Thanks so much! On Apr 20, 11:21 am, "Brian Hogan" <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You use link_to_remote instead of link_to... then you have the destination > be a controller that just renders your partial and puts the result in that > div. Pretty easy actually. > > <%= link_to_remote "Delete this post", :update => "login_form", > :url => { :action => "show_login_form", :controller=>"login" } %> > > <div id="login_form"> > </div> > > Then in your controller, assuming you have a partial at > app/views//login/_form.rhtml you just do > > # displays the login form partial... used by an AJAX request > def show_login_form > render :partial=>"login/form" > end > > You can do a lot more cool stuff though.. There''s a really good O''Reilly > shortcut on RJS, but sadly I forget what it''s called.. I think it''s RJS > Templates for Rails or something. Quality read, and helps you get started > quite quickly. > > On 4/20/07, AbsolutZero <absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I currently have a link to a Login screen, but its a separate page > > althogether. I have created a partial that is just the login box and > > password, and would like that partial to appear at a place on the page > > when the user clicks the link. Anyone know where I can find out how to > > do this? > > > Thanks so much.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok so some of it worked, but not all of it. I have the partial "app/
views/login/_login_small.rhtml" that has this:
========================================================<% form_tag do %>
<table id="login">
<tr>
<td class="loginCell">
<label for="name">username:</label>
<%= text_field_tag :name, params[:name] %>
</td>
<td class="loginCell">
<label for="pasword">password:</label>
<%= password_field_tag :password, params[:password] %>
</td>
<td class="loginCell">
<%= submit_tag "Login" %>
</td>
</tr>
</table>
<% end %>
========================================================
and my layout which should be the header for every page, "app/views/
layouts/application.rhtml
========================================================<%= link_to_remote
"Login", :update => "loginPartial", :url =>
{:action => ''show_small_login'', :controller =>
''login''} %>
<div id="loginPartial">
</div>
========================================================
and the problem is that it is rendering the main "login/index.rhtml"
instead of my partial... any idea why?
On Apr 20, 11:21 am, "Brian Hogan"
<bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> You use link_to_remote instead of link_to... then you have the destination
> be a controller that just renders your partial and puts the result in that
> div. Pretty easy actually.
>
> <%= link_to_remote "Delete this post", :update =>
"login_form",
> :url => { :action => "show_login_form",
:controller=>"login" } %>
>
> <div id="login_form">
> </div>
>
> Then in your controller, assuming you have a partial at
> app/views//login/_form.rhtml you just do
>
> # displays the login form partial... used by an AJAX request
> def show_login_form
> render :partial=>"login/form"
> end
>
> You can do a lot more cool stuff though.. There''s a really good
O''Reilly
> shortcut on RJS, but sadly I forget what it''s called.. I think
it''s RJS
> Templates for Rails or something. Quality read, and helps you get started
> quite quickly.
>
> On 4/20/07, AbsolutZero
<absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > I currently have a link to a Login screen, but its a separate page
> > althogether. I have created a partial that is just the login box and
> > password, and would like that partial to appear at a place on the page
> > when the user clicks the link. Anyone know where I can find out how to
> > do this?
>
> > Thanks so much.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
What''s your controller''s action look like that does the rendering? On 4/20/07, AbsolutZero <absolut0music-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Ok so some of it worked, but not all of it. I have the partial "app/ > views/login/_login_small.rhtml" that has this: > > ========================================================> <% form_tag do %> > <table id="login"> > <tr> > <td class="loginCell"> > <label for="name">username:</label> > <%= text_field_tag :name, params[:name] %> > </td> > <td class="loginCell"> > <label for="pasword">password:</label> > <%= password_field_tag :password, > params[:password] %> > </td> > <td class="loginCell"> > <%= submit_tag "Login" %> > </td> > </tr> > </table> > <% end %> > ========================================================> > and my layout which should be the header for every page, "app/views/ > layouts/application.rhtml > > ========================================================> <%= link_to_remote "Login", :update => "loginPartial", :url => > {:action => ''show_small_login'', :controller => ''login''} %> > > <div id="loginPartial"> > </div> > ========================================================> > and the problem is that it is rendering the main "login/index.rhtml" > instead of my partial... any idea why? > > > > > On Apr 20, 11:21 am, "Brian Hogan" <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > You use link_to_remote instead of link_to... then you have the > destination > > be a controller that just renders your partial and puts the result in > that > > div. Pretty easy actually. > > > > <%= link_to_remote "Delete this post", :update => "login_form", > > :url => { :action => "show_login_form", :controller=>"login" } %> > > > > <div id="login_form"> > > </div> > > > > Then in your controller, assuming you have a partial at > > app/views//login/_form.rhtml you just do > > > > # displays the login form partial... used by an AJAX request > > def show_login_form > > render :partial=>"login/form" > > end > > > > You can do a lot more cool stuff though.. There''s a really good O''Reilly > > shortcut on RJS, but sadly I forget what it''s called.. I think it''s RJS > > Templates for Rails or something. Quality read, and helps you get > started > > quite quickly. > > > > On 4/20/07, AbsolutZero <absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I currently have a link to a Login screen, but its a separate page > > > althogether. I have created a partial that is just the login box and > > > password, and would like that partial to appear at a place on the page > > > when the user clicks the link. Anyone know where I can find out how to > > > do this? > > > > > Thanks so much. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Use a link_to_remote for the link. In the action it calls, render :page do page[:id_of_place_on_page].replace(:partial => ''path_to_partial'') end don''t forget to setup the variables used in the partial in the action as well. Niels On Apr 20, 2007, at 11:07 AM, AbsolutZero wrote:> > I currently have a link to a Login screen, but its a separate page > althogether. I have created a partial that is just the login box and > password, and would like that partial to appear at a place on the page > when the user clicks the link. Anyone know where I can find out how to > do this? > > Thanks so much. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Couldn''t you also do this in your controller? # displays the login form partial... used by an AJAX request def show_login_form render :partial=>"login/form", :layout => false end So it wouldn''t render the layout for that action? Jacqui On Apr 20, 9:41 pm, Niels Meersschaert <nmeersscha...-ee4meeAH724@public.gmane.org> wrote:> Use a link_to_remote for the link. In the action it calls, > > render :page do > page[:id_of_place_on_page].replace(:partial => ''path_to_partial'') > end > > don''t forget to setup the variables used in the partial in the action > as well. > > Niels > > On Apr 20, 2007, at 11:07 AM, AbsolutZero wrote: > > > > > I currently have a link to a Login screen, but its a separate page > > althogether. I have created a partial that is just the login box and > > password, and would like that partial to appear at a place on the page > > when the user clicks the link. Anyone know where I can find out how to > > do this? > > > Thanks so much.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here is my action:
=========================================================def show_login_partial
render :update do |page|
page.visual_effect :fade, ''loginPartial''
end
end
=========================================================
Here is the location of the actual link on the rhtml page:
=========================================================<%= link_to_remote
"Login", :update => "loginPartial", :url =>
{:action => ''show_small_login'', :controller =>
''login''} %>
=========================================================
On Apr 20, 3:31 pm, "Brian Hogan"
<bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> What''s your controller''s action look like that does the
rendering?
>
> On 4/20/07, AbsolutZero
<absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > Ok so some of it worked, but not all of it. I have the partial
"app/
> > views/login/_login_small.rhtml" that has this:
>
> > ========================================================> >
<% form_tag do %>
> > <table id="login">
> > <tr>
> > <td class="loginCell">
> > <label
for="name">username:</label>
> > <%= text_field_tag :name, params[:name] %>
> > </td>
> > <td class="loginCell">
> > <label
for="pasword">password:</label>
> > <%= password_field_tag :password,
> > params[:password] %>
> > </td>
> > <td class="loginCell">
> > <%= submit_tag "Login" %>
> > </td>
> > </tr>
> > </table>
> > <% end %>
> > ========================================================>
> > and my layout which should be the header for every page,
"app/views/
> > layouts/application.rhtml
>
> > ========================================================> >
<%= link_to_remote "Login", :update => "loginPartial",
:url =>
> > {:action => ''show_small_login'', :controller =>
''login''} %>
>
> > <div id="loginPartial">
> > </div>
> > ========================================================>
> > and the problem is that it is rendering the main
"login/index.rhtml"
> > instead of my partial... any idea why?
>
> > On Apr 20, 11:21 am, "Brian Hogan"
<bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > You use link_to_remote instead of link_to... then you have the
> > destination
> > > be a controller that just renders your partial and puts the
result in
> > that
> > > div. Pretty easy actually.
>
> > > <%= link_to_remote "Delete this post", :update
=> "login_form",
> > > :url => { :action => "show_login_form",
:controller=>"login" } %>
>
> > > <div id="login_form">
> > > </div>
>
> > > Then in your controller, assuming you have a partial at
> > > app/views//login/_form.rhtml you just do
>
> > > # displays the login form partial... used by an AJAX request
> > > def show_login_form
> > > render :partial=>"login/form"
> > > end
>
> > > You can do a lot more cool stuff though.. There''s a
really good O''Reilly
> > > shortcut on RJS, but sadly I forget what it''s called.. I
think it''s RJS
> > > Templates for Rails or something. Quality read, and helps you get
> > started
> > > quite quickly.
>
> > > On 4/20/07, AbsolutZero
<absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > I currently have a link to a Login screen, but its a
separate page
> > > > althogether. I have created a partial that is just the login
box and
> > > > password, and would like that partial to appear at a place
on the page
> > > > when the user clicks the link. Anyone know where I can find
out how to
> > > > do this?
>
> > > > Thanks so much.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I''m looking for the same effect as http://www.digg.com when you click login... On Apr 23, 12:28 am, AbsolutZero <absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Here is my action: > =========================================================> def show_login_partial > render :update do |page| > page.visual_effect :fade, ''loginPartial'' > end > end > =========================================================> > Here is the location of the actual link on the rhtml page: > =========================================================> <%= link_to_remote "Login", :update => "loginPartial", :url => > {:action => ''show_small_login'', :controller => ''login''} %> > =========================================================> > On Apr 20, 3:31 pm, "Brian Hogan" <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > What''s your controller''s action look like that does the rendering? > > > On 4/20/07, AbsolutZero <absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Ok so some of it worked, but not all of it. I have the partial "app/ > > > views/login/_login_small.rhtml" that has this: > > > > ========================================================> > > <% form_tag do %> > > > <table id="login"> > > > <tr> > > > <td class="loginCell"> > > > <label for="name">username:</label> > > > <%= text_field_tag :name, params[:name] %> > > > </td> > > > <td class="loginCell"> > > > <label for="pasword">password:</label> > > > <%= password_field_tag :password, > > > params[:password] %> > > > </td> > > > <td class="loginCell"> > > > <%= submit_tag "Login" %> > > > </td> > > > </tr> > > > </table> > > > <% end %> > > > ========================================================> > > > and my layout which should be the header for every page, "app/views/ > > > layouts/application.rhtml > > > > ========================================================> > > <%= link_to_remote "Login", :update => "loginPartial", :url => > > > {:action => ''show_small_login'', :controller => ''login''} %> > > > > <div id="loginPartial"> > > > </div> > > > ========================================================> > > > and the problem is that it is rendering the main "login/index.rhtml" > > > instead of my partial... any idea why? > > > > On Apr 20, 11:21 am, "Brian Hogan" <bpho...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You use link_to_remote instead of link_to... then you have the > > > destination > > > > be a controller that just renders your partial and puts the result in > > > that > > > > div. Pretty easy actually. > > > > > <%= link_to_remote "Delete this post", :update => "login_form", > > > > :url => { :action => "show_login_form", :controller=>"login" } %> > > > > > <div id="login_form"> > > > > </div> > > > > > Then in your controller, assuming you have a partial at > > > > app/views//login/_form.rhtml you just do > > > > > # displays the login form partial... used by an AJAX request > > > > def show_login_form > > > > render :partial=>"login/form" > > > > end > > > > > You can do a lot more cool stuff though.. There''s a really good O''Reilly > > > > shortcut on RJS, but sadly I forget what it''s called.. I think it''s RJS > > > > Templates for Rails or something. Quality read, and helps you get > > > started > > > > quite quickly. > > > > > On 4/20/07, AbsolutZero <absolut0mu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I currently have a link to a Login screen, but its a separate page > > > > > althogether. I have created a partial that is just the login box and > > > > > password, and would like that partial to appear at a place on the page > > > > > when the user clicks the link. Anyone know where I can find out how to > > > > > do this? > > > > > > Thanks so much.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can look at the source code of Digg. They have a division where they keep hidden and when you click on it they just show it. Gokhan www.sylow.net <div id="container"><div id="header"><div id="login-form" style="display:none;"> <form action="/login" id="side-login" method="post"> <label for="side-username">Username:</label> <input type="text" name="side-username" id="side-username" size="15" tabindex="1" /> <label for="side-password">Password:</label> <input type="password" name="side-password" id="side-password" size="15" tabindex="2" /> <label for="side-persistent">Remember Me?</label><input type="checkbox" name="side-persistent" id="side-persistent" tabindex="3"/> <input type="submit" value="Sign In" class="log2" tabindex="4" /> <input type="hidden" name="processlogin" value="1" /> </form> </div> and <a href="/login" onclick="return(toggleLogin())">Login</a> Daniel Scrima wrote:> I''m looking for the same effect as http://www.digg.com when you click > login...-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---