Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

add #html_attr_name method #62

Open
catmando opened this issue Feb 9, 2018 · 3 comments
Open

add #html_attr_name method #62

catmando opened this issue Feb 9, 2018 · 3 comments

Comments

@catmando
Copy link
Contributor

catmando commented Feb 9, 2018

just a handy helper to add the ActiveRecordBase (on the client) (it would jus be added to InstanceMethods module)

  def html_attr_name(attr)
    "#{model_name}#{to_key}-#{attr}"
  end

See ruby-hyperloop/hyper-react#244 for details on to_key

@sfcgeorge
Copy link
Contributor

This seems less useful than to_key unless for and name params do some magic, which I think they probably shouldn't. As there's no obvious "right" way of naming for/name in HTML (there's probably multiple competing conventions like there are with BEM/OO CSS etc), so I guess many would override this anyway, so we could just leave them to add it in ApplicationRecord themselves.

If Hyerloop had its own form_builder replacement smart input components then this would be a part of it.

But a one size fits all form builder is hard. The Rails one isn't flexible enough to work with frameworks like Bootstrap, so then there was SimpleForm but that's nowhere near simple, I hate it. I'd suggest holding off on this issue until we have a more concrete use-case for it.

@catmando
Copy link
Contributor Author

catmando commented Feb 9, 2018

are the conventions used by any code? As in would I ever "have" to use the convention, or is it just simply a convention to keep things tidy. In which case it seems like it might be helpful. but I dunno. We can drop it from 1.0 if all agree...

@sfcgeorge
Copy link
Contributor

sfcgeorge commented Feb 9, 2018

See ruby-hyperloop/hyper-react#245 for how I use this in a smart form input component. Simply some human readable and useful yet unique identifier to link name and from

@catmando catmando removed this from the Release 0.15 milestone Mar 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants