Hi, am a rails newbie. I had problems with 2 tasks i have created a guestbook app just to try out rails users sign guestbook by leaving name and message currently, the list action shows plain text like this: Joe Smith love your guestbook but i would like to add formating to the name field, say different colour, bold, and add time eg: Joe Smith (in red colour) wrote 5 days ago love your guestbook The app also has an admin interface to edit and delete guest entries i want any entry which was edited by the admin to append a note to the message, saying "this entry was modified by admin" how do i achieve the above 2 tasks? database table guests has 2 columns, name and message -- Posted via http://www.ruby-forum.com/.
Hi Pedro, pedro alvarez wrote:> i would like to add formating to the name field, > say different colour, bold,This is a basic HTML question having nothing at all to do with Ruby or Rails. There''s an excellent reference site for this type of question at http://www.w3schools.com/ and add time eg:> Joe Smith (in red colour) wrote 5 days agoCheck out the time_ago_in_words method at http://api.rubyonrails.org/ To test out how the various methods work, you should get used to using irb (interactive ruby). You start it by entering ''ruby script\console'' at the command prompt in an application directory in Windows. And remember, Google is your friend. ;-)> The app also has an admin interface to edit and > delete guest entries i want any entry which was > edited by the admin to append a note to the > message, saying "this entry was modified by admin"Assuming you have a login / authentication system in place, you''d add a column to your table that allows you to record who does what to an entry. Recommend you pick up a book or two: "Agile Web Development with Rails" and "Programming Ruby" are the two most of us start with. Also recommend working through one or more of the tutorials available online before striking out on your own. The questions you''ve asked here are things you''ll learn in a couple of hours with most any of those. hth, Bill
pedro alvarez wrote:> Hi, am a rails newbie. I had problems with 2 tasks > i have created a guestbook app just to try out rails > users sign guestbook by leaving name and message > > currently, the list action shows plain text like this: > Joe Smith > love your guestbook > > but i would like to add formating to the name field, say different > colour, bold, and add time eg: > Joe Smith (in red colour) wrote 5 days ago > love your guestbook > > The app also has an admin interface to edit and delete guest entries > i want any entry which was edited by the admin to append a note to the > message, saying "this entry was modified by admin" > > how do i achieve the above 2 tasks? > > database table guests has 2 columns, name and messageI hope I understand you corretly but I think so. What you want is best done with css. If you have a <td> or a <div>, or what ever, you just add a class to it and define it in a stylesheet. If you''ve done a scaffold you have a scaffold.css in the /public/stylesheets folder. Or another css. Add a class to the td in the view page like <td class="myredstyle">balalala</td> Then in the css add .myredstyle {color: red; font-weight: bold} As Bill said http://www.w3schools.com/css/default.asp is good. -- Posted via http://www.ruby-forum.com/.
keep creating... Kris -- Posted via http://www.ruby-forum.com/.