diff options
| author | Teddy Wing | 2018-04-27 17:32:03 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-04-27 17:32:03 +0200 |
| commit | ae387752e9ae26a296b5d1a016cd3b53bf7f298c (patch) | |
| tree | 9b595561baf809a32dbc4f2eef2240d4bed2dfdc | |
| parent | 1a6804e95d269adf741157314d32a4db6d8d76ea (diff) | |
| download | chouette-core-ae387752e9ae26a296b5d1a016cd3b53bf7f298c.tar.bz2 | |
Add Chouette favicon6627-add-chouette-favicon
Adds a favicon to the site to respond to these errors:
ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
Using `favicon_link_tag` allows us to get the image from the asset
pipeline, which makes it easier to update if necessary, since browsers
tend to cache the default `/favicon.ico` indeterminably (source:
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#method-i-favicon_link_tag).
According to some Stack Overflow posts I've been reading, it looks like
it's advisable to put the `favicon.ico` file in both `/assets/images/`
and `/public/`:
- https://stackoverflow.com/questions/15687506/actioncontrollerroutingerror-no-route-matches-get-favicon-ico-in-rails#15688041
- https://stackoverflow.com/questions/11071445/favicon-in-ruby-on-rails-application
This way, you can serve the favicon from the asset pipeline, but if any
requesters try to get `/favicon.ico`, the server will respond with the
image instead of an error.
To be honest, when I was testing locally, I couldn't get the icon in
`/public` to display, both without a `link` tag and with the following
`link` tag:
/ application.html.slim
/ ...
link href='/favicon.ico' rel='shortcut icon'
As a result, I'm adding the image to `/public` with fingers crossed that
it's going to work if requested.
I generated the `favicon.ico` file with a 256x256px PNG supplied by
Cyrielle in the Redmine ticket and the following ImageMagick command:
$ convert -resize x16 -gravity center -crop 16x16+0+0 \
Logo_Chouette-256x256.png -flatten -colors 256 favicon.ico
(Copied from:
https://stackoverflow.com/questions/3185677/converting-gifs-pngs-and-jpgs-to-ico-files-using-imagemagick)
Refs #6627
| -rw-r--r-- | app/assets/images/favicon.ico | bin | 0 -> 1406 bytes | |||
| -rw-r--r-- | app/views/layouts/application.html.slim | 2 | ||||
| -rw-r--r-- | public/favicon.ico | bin | 0 -> 1406 bytes |
3 files changed, 2 insertions, 0 deletions
diff --git a/app/assets/images/favicon.ico b/app/assets/images/favicon.ico Binary files differnew file mode 100644 index 000000000..ac6bc298d --- /dev/null +++ b/app/assets/images/favicon.ico diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index abf39c089..596627996 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -8,6 +8,8 @@ html lang=I18n.locale title = t('brandname') + = favicon_link_tag + = stylesheet_link_tag 'base' = stylesheet_link_tag 'application' diff --git a/public/favicon.ico b/public/favicon.ico Binary files differnew file mode 100644 index 000000000..ac6bc298d --- /dev/null +++ b/public/favicon.ico |
