This project bundles the excellent Burocratik's Outdated Browser detector for use with the rails 4+ asset pipeline.
The version numbers of this gem follow the versioning of
Outdated Browser,
and the gem follows the feature/languages gem, which includes
translations for several languages. The gem uses I18n.locale to select the correct locale, and falls back to en if the selected locale does not exist.
Add this line to your application's Gemfile:
gem 'outdatedbrowser_rails'Add this line to your application.js:
//= require outdatedbrowser/outdatedBrowserAdd this line to your application.css || application.scss:
//= require outdatedbrowser/outdatedBrowserIn the view where you want to use this, add:
<%= render 'outdatedbrowser/outdatedbrowser' %>At the bottom of the body (make sure it's included after application.js), add:
<%= javascript_include_tag 'outdatedbrowser/require_outdatedbrowser' %>- Of course, ideally use an outdated browser to test.
- With an up-to-date browser:
- In the view where you included the partial, check that
#outdatedis present. - See how it looks:
$('#outdated').show()
Feel free to open an issue if you find something that could be improved.
Here are a couple of things worth noting:
- This is a mountable rails engine tested with
rspecandcapybara. For more info or a good reference to make your own, see this good tutorial. - The reference to
outdatedbrowseris a git submodule. For a good reference on how to update git submodules, see this. - The rake task
rake generate:assetscopies the assets from thevendor/outdated-browserfolder (which is a git submodule) to the engineappfolder. - The rake task
cleancleans the copied assets. - To run tests, use
rspec spec.
Finally, to contribute:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Run tests using
rspec spec, and make sure they are green! - Add tests to
spec/features, if necessary. - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request