This project is archived and is in readonly mode.

#593 ✓resolved
Andrew Chalkley

Paragraphed anchors and notice layout in generators

Reported by Andrew Chalkley | July 10th, 2008 @ 04:25 PM | in 3.0.2

  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.

Comments and changes to this ticket

  • Clemens Kofler

    Clemens Kofler July 11th, 2008 @ 10:57 AM

    • 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 ;-)
  • Pratik

    Pratik July 17th, 2008 @ 01:25 AM

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

  • Andrew Chalkley

    Andrew Chalkley July 17th, 2008 @ 01:55 AM

    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 ?

  • dan (at danwebb)

    dan (at danwebb) July 28th, 2009 @ 11:17 AM

    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.

  • Glenn Gillen

    Glenn Gillen July 28th, 2009 @ 11:30 AM

    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.

  • Pratik

    Pratik July 30th, 2009 @ 05:07 PM

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

  • Pratik

    Pratik July 30th, 2009 @ 05:08 PM

    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? %>
    
  • José Valim

    José Valim August 10th, 2009 @ 10:48 AM

    • Assigned user set to “José Valim”
    • Milestone cleared.
  • Andrew Chalkley

    Andrew Chalkley August 10th, 2009 @ 01:30 PM

    • 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 %>
  • Repository
  • José Valim

    José Valim September 1st, 2009 @ 12:16 PM

    • State changed from “new” to “resolved”
  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages