Code Monkey home page Code Monkey logo

Comments (8)

dsandstrom avatar dsandstrom commented on August 30, 2024

Good idea, however, I feel it might be a mess to have to deal with column classes.

One of their examples:

<div class="row collapse">
  <div class="small-3 large-2 columns">
    <span class="prefix">http://</span>
  </div>
  <div class="small-9 large-10 columns">
    <input type="text" placeholder="Enter your URL...">
  </div>
</div>

The erb might be:

<%= f.text_field :url, label: "URL", placeholder: "Enter your URL...", prefix: "http://", prefix_column_class: "small-3 large-2", input_column_class: "small-9 large-10" %>

from foundation_rails_helper.

dsandstrom avatar dsandstrom commented on August 30, 2024

Or maybe

<%= f.text_field :url, label: "URL", placeholder: "Enter your URL...", prefix: "http://", prefix_small_columns: 3, prefix_large_columns: 10 %>

Then, subtract 12 from each to get the input's columns classes.

from foundation_rails_helper.

dsandstrom avatar dsandstrom commented on August 30, 2024

Actually, it would be better to keep the prefix settings separate:

<%= f.text_field :url, label: "URL", placeholder: "Enter your URL...", prefix: { value: "http://", small: 3, large: 10 } %>

@djkz, If you want to work on a pull request, we can merge it.

from foundation_rails_helper.

djkz avatar djkz commented on August 30, 2024

It gets a bit complicated if you want to support buttons and mixed prefixes and postfixes. I wonder if using flex would be a cleaner solution? http://philipwalton.github.io/solved-by-flexbox/demos/input-add-ons/

from foundation_rails_helper.

dsandstrom avatar dsandstrom commented on August 30, 2024

That looks nice. However, does foundation have any flexbox built into their styles? I don't think we should add css to this gem.

from foundation_rails_helper.

djkz avatar djkz commented on August 30, 2024

Looks like not yet, it's planned for the next version: http://zurb.com/article/1333/foundation-a-new-grid

Wrapping everything into a row and calculating main element's size from the 12 - prefix - postfix is the way to go for now, not sure if it's possible to also support buttons and other elements that they showed in their example. Maybe by passing the content_tag for the element directly into the prefix: property but that can get pretty complicated really fast.

from foundation_rails_helper.

dsandstrom avatar dsandstrom commented on August 30, 2024

As you say, anything more complicated than a span is probably a bad idea. The user can always fallback to making the row/columns themselves. And if they only need to support IE 10+, they can use flexbox.

from foundation_rails_helper.

dsandstrom avatar dsandstrom commented on August 30, 2024

Fix merged.

from foundation_rails_helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.