Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Paragraphed anchors and notice layout in generators

#593
  1. In the view generators (new edit show) anchors at the bottom are not nested in a paragraph - this is a pain to add every time you generate scaffold
  2. The layout generated includes and unnecessary empty paragraph if there isn't a notice. Also it has inline style. Used content_tag to generate paragraph unless the flash is blank with id #notice. Moved style into style.css. Less obtrusive.

See attached patch.

Reported by Andrew Chalkley · July 10th, 2008 @ 04:25 PM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Clemens Kofler
    Clemens Kofler
    • Tag changed from 2.1, generators, patch to 2.1, generators, patch, railties

    All tests pass. Although I think the scaffold shouldn't be used anyways (or, rather, that you usually throw away the views), it kinda makes sense.

    • 1/2 ;-)

    July 11th, 2008 @ 10:57 AM

  2. Pratik
    Pratik
    • State changed from new to wontfix

    I don't really see much value in this patch. Scaffolding is really meant as a learning tool. Apart from that, as you've moved some stuff to styles.css, it'll make things ugly when people upgrades Rails and when they already have styles.css in their public directory.

    July 17th, 2008 @ 01:25 AM

  3. Andrew Chalkley
    Andrew Chalkley

    Hi Pratik,

    The idea of making the changes was to help the rails developer starting off on the right foot. Unobtrusive CSS, well formatted HTML etc, etc.

    Having the notice auto generate a paragraph if present is a good for learning, surly?

    styles.css doesn't get "generated" in their public directory but scaffold.css doesn't it?

    When people upgrade Rails adding a bit of CSS wouldn't be that big of an issue since environments/initialisers have been known to change between updates. I'd imagine mature rails projects will have it's own CSS for notices anyway. But since I would imaging scaffolding would be used primarily at the beginning of a project anyway this wouldn't be a big problem.

    Or am I missing something :S ?

    July 17th, 2008 @ 01:55 AM

  4. dan (at danwebb)
    dan (at danwebb)

    I want to support this one. Yes, it is a learning tool and not to be used in production but that why it's a even more important to make sure its not full of nasty markup and inline CSS. Rails is promoting best practices right? I don't think the style.css/upgrade issue is anywhere near enough of a problem to can this and the markup stuff is very worth putting in.

    July 28th, 2009 @ 11:17 AM

  5. Glenn Gillen
    Glenn Gillen

    For what it's worth, I'd give this a +1.

    "I don't really see much value in this patch."

    I don't see much justification for knowingly generating bad markup.

    July 28th, 2009 @ 11:30 AM

  6. Pratik
    Pratik
    • State changed from wontfix to new

    I'm pretty sure there was a long discussion in the ML about rejecting this change. But as I cannot find it, I'm reopening the ticket.

    Thanks.

    July 30th, 2009 @ 05:07 PM

  7. Pratik
    Pratik

    Also, I think the following :

    <% if flash[:notice].present? %>
      <p style="color: green"><%%= flash[:notice] %></p>
    <% end %>
    

    is better than :

    <%%= content_tag(:p, flash[:notice],:id => "notice") unless flash[:notice].blank? %>
    

    July 30th, 2009 @ 05:08 PM

  8. José Valim
    José Valim
    • Assigned user set to José Valim
    • Milestone cleared.

    August 10th, 2009 @ 10:48 AM

  9. Andrew Chalkley
    Andrew Chalkley
    • Tag changed from 2.1, generators, patch, railties to 3.0, generators, patch, railties

    Well, it'd be nice to have the notice in the id attribute and not have inline styling...


    <% if flash[:notice].present? %>

    <%%= flash[:notice] %>

    <% end %>

    August 10th, 2009 @ 01:30 PM

  10. Repository
  11. José Valim
    José Valim
    • State changed from new to resolved

    September 1st, 2009 @ 12:16 PM

  12. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to

    October 15th, 2010 @ 11:01 PM