Hi, I would like to hear your opinions about how do you think I can implement this. I have a @events array where I have events each one with its datetime, and ordered by it. I would like to show a list of these events in a table. I would like to put a blank row in the table after each group of events with the same date. I don''t know if it is better to separate the events in groups in the controller or if I can use an ''if'' in the view to insert this blank row. Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
2009/3/4 Juan Kinunt <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Hi, > > I would like to hear your opinions about how do you think I can > implement this. > I have a @events array where I have events each one with its datetime, > and ordered by it. > I would like to show a list of these events in a table. I would like to > put a blank row in the table after each group of events with the same > date. > I don''t know if it is better to separate the events in groups in the > controller or if I can use an ''if'' in the view to insert this blank row. >I would suggest this is to do with how you want to view the data, it is not inherent in the data itself, so it should go in the view.> > Thanks. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Ok. That makes sense to me. Can I store values in variables in the view? I think it would be possible by storing the datetime of the previous event and comparing it with the current event datetime. I think what I want to do is similar to pagination... Colin Law wrote:> 2009/3/4 Juan Kinunt <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > >> I don''t know if it is better to separate the events in groups in the >> controller or if I can use an ''if'' in the view to insert this blank row. >> > > I would suggest this is to do with how you want to view the data, it is > not > inherent in the data itself, so it should go in the view.-- 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 -~----------~----~----~----~------~----~------~--~---
You can write pretty much any ruby in the view, local vars are no problem. I feel there may be an elegant way to skip a row or otherwise leave a gap on date change but at the moment it escapes me. Any suggestions from those with more experience? 2009/3/4 Juan Kinunt <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > Ok. That makes sense to me. Can I store values in variables in the view? > I think it would be possible by storing the datetime of the previous > event and comparing it with the current event datetime. I think what I > want to do is similar to pagination... > > Colin Law wrote: > > 2009/3/4 Juan Kinunt <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > > >> I don''t know if it is better to separate the events in groups in the > >> controller or if I can use an ''if'' in the view to insert this blank row. > >> > > > > I would suggest this is to do with how you want to view the data, it is > > not > > inherent in the data itself, so it should go in the view. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
On Wed, 2009-03-04 at 19:08 +0000, Colin Law wrote:> You can write pretty much any ruby in the view, local vars are no > problem. I feel there may be an elegant way to skip a row or otherwise > leave a gap on date change but at the moment it escapes me. Any > suggestions from those with more experience?CSS. Wrap each date-group in a <div class=''whatever''> and style it with a top/bottom margin to get the spacing you''re looking for. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ 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 I do not see is how to build those ''date-groups'' because what I have now is only @events = Event.find(:all, :order => ''date'') In the view I do: <%= for event in @events %> [...] bill walton wrote:> CSS. Wrap each date-group in a <div class=''whatever''> and style it with > a top/bottom margin to get the spacing you''re looking for.-- 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 -~----------~----~----~----~------~----~------~--~---