To clean this up to not stretch a one liner theme... <%= link_to "Inbox (#[email protected]_messages.count})", messages_path if logged_in? && [email protected]_messages.empty? %>
Or if logged in @p is set, so you could write the shorter one liner in an even shorter way: <%= link_to "Inbox (#[email protected]_messages.count})", messages_path if @p && [email protected]_messages.empty? %> -- Matt On Mar 4, 2009, at 11:43 AM, Jason Keenan wrote: > Hey there, > > Just wondering if anyone had any little lovd snippets, handy one > liners, little additions or fixes that people can implement. The one > below is stretching the one liner theme but is one to get started. > > > The private messages function is hidden in the bowels of lovd and > takes a while to find. Slip the following snippet just before <%= > link_to 'Newest Stuff', home_path %> in app/views/layouts/ > application.html.erb to add an 'Inbox(1)' that links to new messages > with the counter telling you how many you have. > > > <% if logged_in? %><%= link_to 'Inbox' + '(' + > @p.unread_messages.count.to_s + ')', messages_path unless > @p.unread_messages.empty? %><% end %> > > > Enjoy. > > Jason ;) > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lovd by Less" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/lovdbyless?hl=en Who loves ya baby? -~----------~----~----~----~------~----~------~--~---
