From f734bfb0bf342be3ae23b6f208c6bb07aa33c0a3 Mon Sep 17 00:00:00 2001 From: Kota Shiratsuka Date: Sun, 25 Apr 2021 19:46:06 +0900 Subject: [PATCH] Added touch-icon.png --- app/helpers/application_helper.rb | 17 ++++++++++++++++- app/views/layouts/base.html.erb | 1 + lib/redmine/themes.rb | 16 ++++++++++++++++ public/touch-icon.png | Bin 0 -> 4647 bytes 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 public/touch-icon.png diff --git app/helpers/application_helper.rb app/helpers/application_helper.rb index 224f7039b..b8a773d70 100644 --- app/helpers/application_helper.rb +++ app/helpers/application_helper.rb @@ -1720,7 +1720,7 @@ module ApplicationHelper end def favicon - "".html_safe + "".html_safe end # Returns the path to the favicon @@ -1741,6 +1741,21 @@ module ApplicationHelper ''.html_safe end + def touchicon + "".html_safe + end + + def touchicon_path + touchicon = (current_theme && current_theme.touchicon?) ? current_theme.touchicon_path : '/touch-icon.png' + image_path(touchicon) + end + + def touchicon_url + path = touchicon_path + base = url_for(:controller => 'welcome', :action => 'index', :only_path => false) + base.sub(%r{/+$}, '') + '/' + path.sub(%r{^/+}, '') + end + # Returns true if arg is expected in the API response def include_in_api_response?(arg) unless @included_in_api_response diff --git app/views/layouts/base.html.erb app/views/layouts/base.html.erb index 43e7459e7..1cc71ddeb 100644 --- app/views/layouts/base.html.erb +++ app/views/layouts/base.html.erb @@ -9,6 +9,7 @@ <%= csrf_meta_tag %> <%= favicon %> +<%= touchicon %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.12.1', 'tribute-5.1.3', 'application', 'responsive', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> diff --git lib/redmine/themes.rb lib/redmine/themes.rb index 8b970ff22..06dbe9a3d 100644 --- lib/redmine/themes.rb +++ lib/redmine/themes.rb @@ -88,6 +88,18 @@ module Redmine favicon.present? end + def touchicons + @touchicon ||= assets("touchicon") + end + + def touchicon + touchicons.first + end + + def touchicon? + touchicon.present? + end + def stylesheet_path(source) "/themes/#{dir}/stylesheets/#{source}" end @@ -104,6 +116,10 @@ module Redmine "/themes/#{dir}/favicon/#{favicon}" end + def touchicon_path + "/themes/#{dir}/touchicon/#{touchicon}" + end + private def assets(dir, ext=nil) diff --git public/touch-icon.png public/touch-icon.png new file mode 100644 index 000000000..b3397d3a2 Binary files /dev/null and public/touch-icon.png differ -- 2.31.1