Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML 5 inputs #387

Closed
justinfrench opened this issue Oct 10, 2010 · 14 comments
Closed

HTML 5 inputs #387

justinfrench opened this issue Oct 10, 2010 · 14 comments

Comments

@justinfrench
Copy link
Member

Most (if not all) of the work done here:

http://github.com/asanghi/formtastic/commit/73e71b6d4104879369df3e7f29c101d5e338ce8c

@justinfrench
Copy link
Member Author

This looked so close I merged it in, the sooner we start using this stuff, the sooner it'll be done done.

Do we want to do some auto-guessing of these new input types based on column names, (eg columns with email to the email input)?

I'll do some checks for any CSS tweaking needed in the major browsers.

Anything else we need?

@asanghi
Copy link
Contributor

asanghi commented Oct 10, 2010

Nope, just need a bit of logic around auto guessing and tests for that. I'll send another pull request shortly.

@justinfrench
Copy link
Member Author

Pulled in changes, leaving this open for some CSS/browser checking.

@justinfrench
Copy link
Member Author

And the specs fail under Rails 2.x because url_field et al aren't defined, so we need to either find a fall back when they're not defined, or we need to define them, or we need to make them Rails 3 only and find a way for the specs to pass. Not quite there yet!

@asanghi
Copy link
Contributor

asanghi commented Oct 11, 2010

Ah, sorry about that. Justin, you need to make a design call here. I'll patch accordingly.

In my humble opinion, i think this should be a Rails 3 only thing just to keep the code simple and make formtastic in line with what Rails 3 provides.

That said, we can obviously make the code more robust by doing a respond_to check on the method before calling (having text_field as fallback).

Making the specs pass using conditional Rails3 utility method (check for type url in Rails3 and text otherwise).

Sending another pull as soon as i can figure out how to do rake specs with Rails 2.x environment. (Feel free to PM pointers to me).

@justinfrench
Copy link
Member Author

I'm struggling with Rails 2 specs right now too. Quite puzzled, will investigate.

Anyway, in regards to the design decisions:

  1. Yes, happy for it to be Rails 3 only functionality with a helpful error message under Rails 2, no need for a fallback I think.
  2. Yes, we just need to the specs to "pass" under Rails 2, not fussy on how.

@asanghi
Copy link
Contributor

asanghi commented Oct 11, 2010

Do we really need rspec 1.2.x for Rails 2.x? Cant we spec Rails 2.x using rspec 2?

@asanghi
Copy link
Contributor

asanghi commented Oct 11, 2010

Please have a look at the latest commits on my HTML5 branch. I think this should make it work in Rails 2. There are 2 commits, the last one changes it such that an error is raised if Rails does not respond to the helper. Also there is no auto-guessing on HTML5 fields in Rails2. Pull if you think they look satisfactory.

Again, i'm sorry, i've not yet been successful in executing the spec under Rails 2 (but i predict they will pass when one is able to execute them, famous last words :D ).

Do let me know how you went with running specs on Rails 2, anyway.

@justinfrench
Copy link
Member Author

Am looking into Rspec 2.0 for Rails 2.x right now.

@justinfrench
Copy link
Member Author

Okay, have a local branch which "runs" the specs under Rspec 2 with either Rails 2 or 3. All tests pass with a Rails 3 gemset, some fail under a Rails 2 gemset. Some of this is because of recent commits, some is a small mystery. Will review on the train and merge / push up whatever I have, because Rails 3 is passing.

Looks like I'm ditching the Gemfile until we go Rails3-only in 2.0, but will confirm soon.

@justinfrench
Copy link
Member Author

Awesome, specs passing with both a Rails 2 or 3 gemset in master (had to ditch the Gemfile), ended up merging in both the "fallback" and "raise" solutions for Rails 2, then reverting the "raise", which I think is a better path forward.

Leaving this open purely for CSS testing which I'll do. Thanks everyone!

@asanghi
Copy link
Contributor

asanghi commented Oct 11, 2010

That's Legendary, Mr. French!

@justinfrench
Copy link
Member Author

replicate the styles on string-like fields to the newer HTML5 fields like email and URL, as needed to closed by a020620

@justinfrench
Copy link
Member Author

Added styles in a020620, closing. Thanks everyone.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants