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

Improve to use HTML5 attributes for laravel 5 #48

Merged
merged 6 commits into from
Jan 9, 2018
Merged

Improve to use HTML5 attributes for laravel 5 #48

merged 6 commits into from
Jan 9, 2018

Conversation

nthachus
Copy link
Collaborator

@nthachus nthachus commented Jan 8, 2018

  • Remove needless .gitkeep files
  • Change .gitignore file to allow using phpStorm to develop this package
  • Use Closure route instead of the RuleController class to make Route become extendable with extend() method
  • Use ServiceProvider::mergeConfigFrom method to load package configuration instead of loading config file manually
  • Import jQuery validation additional methods to asset JS file
  • Pass laravel App facade instances (e.g. $app['url'], $app['translator'], $app['encrypter'],...) to converter classes
    to remove Helper class, and we can customize message-method with our custom plugin
  • Fix all minor bugs:
    • Get the raw attribute name not ending with [] like foo[][bar]
    • Get user friendly validation message with friendly attribute name like laravel Validator
    • Using URL::to to correct routing path
    • Instance converter classes correctly with constructor of abstract Converter to use custom plugin
    • Get type of input correctly for numeric and file types
    • Parses laravel validation rule correctly for multi-parameters rules like: between, mimes, unique,...
    • Pass parameters correctly for Route::convert() method to make Route extendable via extend()
    • Validation rule alphanum should be named as alpha_num
    • Add data-msg-accept for validation rule image
    • Fix validation rule integer with data-rule-integer instead of data-rule-number
    • Rule same should be data-rule-equalto=":input[name='other']" instead of "input[name='other']"
    • alpha and alpha_num rules should not allow whitespace to make them compatible with laravel Validator
    • Correct string format for vsprintf() from %1s,%2s to %1$s,%2$s
  • Improvements:
    • Allow custom namespace for custom Converter plugin
    • Allow HTML5 attributes to pass jQuery validation rules such as: required, pattern, maxlength, min
    • Allow HTML5 input types to pass jQuery validation rules like: <input type="url", <input type="email",... instead of attribute data-rule-*="true"
    • Only append validation message attribute data-msg-* when validation rule exists
    • Allow multiple jQuery remote rules such as: unique + active_url
    • Use jQuery validation message format like: The field must be between {0} and {1}., The field must be a date after {0}.,...
      So, we can change data-rule-* value at the client-side via JavaScript
    • No need to override method FormBuilder::checkable() because it call to FormBuilder::input() method
    • Format validation message with custom attributes for other, values parameters, those are used by same, required_with rules
  • Support more laravel validation methods:
    • different, before, after, mimes
    • required_with, required_without
    • active_url
  • Implement unit-tests for this package classes (except ServiceProvider one)
  • Update README document for those new improvements
  • And some more refactors, improvements :-)

- Use `ServiceProvider::mergeConfigFrom` method to load package configuration instead of loading config file manually
- Add some more new rules such as: active_url, mimes, before, after
- Fix formName setting/getting for FormBuilder
- Pass all App instances to converter classes directly instead of using Facades
- Fix Validation rules parsing method to support multi-parameters rules such as: between, unique
- Allow to detect input of `file` type
- And many improvements...
@bgultekin
Copy link
Owner

Great job again thanks :)

@bgultekin bgultekin merged commit c8e66ec into bgultekin:master Jan 9, 2018
@chosten
Copy link

chosten commented Apr 17, 2019

Hi, could you explain why it is better to use a closure for the route ? I don't understand what you mean by making Route extendable.
And is there any way to use route caching ?

Thank you

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

Successfully merging this pull request may close these issues.

3 participants