Newbie Formating output

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 S.
love your guestbook

but i would like to add formating to the name field, say different
colour, bold, and add time eg:
Joe S. (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

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 S. (in red colour) wrote 5 days ago

Check 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. :wink:

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 D. 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 S.
love your guestbook

but i would like to add formating to the name field, say different
colour, bold, and add time eg:
Joe S. (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

I hope I understand you corretly but I think so.

What you want is best done with css. If you have a

or a
, 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

balalala

Then in the css add

.myredstyle {color: red; font-weight: bold}

As Bill said http://www.w3schools.com/css/default.asp is good.

Tolle Seite! Hat mir sehr gefallen. Weiter so!

keep creating… Kris

Unbelievable! Liam O’ Keefe

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs