lcreid / devise-bootstrap-form Goto Github PK
View Code? Open in Web Editor NEWGenerate Bootstrap-styled views for Devise using `bootstrap_form`.
License: MIT License
Generate Bootstrap-styled views for Devise using `bootstrap_form`.
License: MIT License
The wrapper around all the forms may be a good idea for one use case, but it's not really generalizable. For example, if you want the login to appear both stand-alone, and in the middle of the landing page, you might want to use the same views but rendered in different contexts.
Also, we might not want the same context for all the views. The password reset, resend confirmation, etc. views may have a different look than the simple sign-in/sign-up views.
It might be better to just document ways to address how to make the views consistent without building it into this gem.
DEPRECATION WARNING: [Devise] `DeviseHelper#devise_error_messages!` is deprecated and will be
removed in the next major version.
Devise now uses a partial under "devise/shared/error_messages" to display
error messages by default, and make them easier to customize. Update your
views changing calls from:
<%= devise_error_messages! %>
to:
<%= render "devise/shared/error_messages", resource: resource %>
To start customizing how errors are displayed, you can copy the partial
from devise to your `app/views` folder. Alternatively, you can run
`rails g devise:views` which will copy all of them again to your app.
The _error_messages.html.erb
has translations in it, even for the un-internationalized version of the views.
The shared links don't look that great as links, and the spacing of them sucks if you convert them to buttons. The generated templates could be more friendly to modifying the styles and spacing.
It would be more flexible if the wrapper for the devise-bootstrap-forms
views were a partial around each view:
devise-bootstrap-form
's formatting.We use the default behaviour of bootstrap_form
to report errors, meaning that the errors are displayed "in line", in an area below the field that corresponds to the error. The views still have the call to devise_error_messages!
in them, so errors are reported twice.
If we remove the call to devise_error_messages!
, we still have to account for errors that might not correspond to a field. I believe the Rails documentation suggests that they should get a key of :base
in the error collection (need to confirm this).
One solution would be to override devise_error_messages!
, but I'm not a fan of magically overriding expected behaviour.
We could create a devise_bootstrap_form_error_messages!
that output error messages for :base
formatting consistently with the rest of the look and feel of the form.
Bonus marks if this method could detect if the form had the in-line option set, and produce the full set of messages if not. That would imply that the error message method would take the form builder as an argument.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.