This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Tinkering with the default Rails view
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
I've decided that one of the things I don't like about a typical Rails list view is the 'view/edit/delete' links that appear to the right of the record. I need the horizontal screen real estate more than I need those links directly in the view. Besides, I think it makes the page kinda ugly.
Instead, I've adopted the following technique:
<%
@users.each_with_index do |user, index|
index % 2 == 0 ? color = "white" : color = "gray"
status_info = 'whatever'
%>
<tr
bgcolor='<%= color %>'
onClick="window.location.href = '<%= url_for :action => 'show', :id => user.id %>'"
onMouseOver="this.bgColor = '#9C9C9C'; window.status = '<%= status_info %>'"
onMouseOut ="this.bgColor = '<%= color %>'"
>
<% end %>
I use the status bar to show a synopsis of the record and/or include information that wouldn't fit in the main listing. The cursor property is set to 'pointer' within the appropriate CSS file so that users realize that each record is clickable. Clicking on the record takes you to the detailed view, and from there you can view/edit/delete.
I tested this on my own team members first to see if they would "get it", and they had no problem figuring out what was going on and how to navigate. YMMV.
The only downside is that editing or deleting records becomes a two step process instead of a single click. In practice, however, this isn't much of an issue for the users.
I agree that it is ugly, but your solution forgets about people with special needs. A preferable solution is to use icons, such as an 'X' for delete with the alt attribute set to delete.