The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Tinkering with the default Rails view

1 reply on 1 page. Most recent reply: Jan 13, 2007 6:00 AM by Ron Lambkin

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Tinkering with the default Rails view Posted: Jan 10, 2007 2:22 PM
Reply to this message Reply

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.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
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.

Read: Tinkering with the default Rails view


Ron Lambkin

Posts: 1
Nickname: bytesyte
Registered: Jan, 2007

Re: Tinkering with the default Rails view Posted: Jan 13, 2007 6:00 AM
Reply to this message Reply
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.

Flat View: This topic has 1 reply on 1 page
Topic: How Rails made me a better programmer Previous Topic   Next Topic Topic: My New Job

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use