OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Mark development environment (#14677)
Ivan Kuchine66cdc36a1fa
diff --git a/app/assets/images/development/apple-touch-icon-120x120.png b/app/assets/images/development/apple-touch-icon-120x120.pngnew file mode 100644index 00000000000..7c122c92dc8Binary files /dev/null and b/app/assets/images/development/apple-touch-icon-120x120.png differdiff --git a/app/assets/images/development/favicon.ico b/app/assets/images/development/favicon.iconew file mode 100644index 00000000000..75e6cc26063Binary files /dev/null and b/app/assets/images/development/favicon.ico differdiff --git a/app/views/common/_favicons.html.erb b/app/views/common/_favicons.html.erbindex 4151c463804..606ada14ec6 100644--- a/app/views/common/_favicons.html.erb+++ b/app/views/common/_favicons.html.erb@@ -4,7 +4,8 @@<% unless apply_custom_touch_icon? %><%# In the future we can add more sizes should we see 404 errors in the logs. %>- <%= favicon_link_tag "apple-touch-icon-120x120.png", rel: 'apple-touch-icon',+ <%= favicon_link_tag OpenProject::CustomStyles::Design.apple_touch_icon_asset_path,+ rel: 'apple-touch-icon',type: 'image/png',- sizes: "120x120" %>+ sizes: '120x120' %><% end %>diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erbindex 1c61dabaca8..b434cb173ad 100644--- a/app/views/layouts/base.html.erb+++ b/app/views/layouts/base.html.erb@@ -68,7 +68,7 @@ See COPYRIGHT and LICENSE files for more details.<% initial_classes = initial_menu_classes(side_displayed, show_decoration) %><div id="wrapper" style="<%= initial_menu_styles(side_displayed) %>" class="<%= initial_classes %>"><% if show_decoration %>- <header class="op-app-header">+ <header class="op-app-header<%= ' op-app-header_development' if OpenProject::Configuration.development_highlight_enabled? %>"><div class="op-app-header--start"><h1 class="hidden-for-sighted"><%= t(:label_top_menu) %>diff --git a/app/views/layouts/only_logo.html.erb b/app/views/layouts/only_logo.html.erbindex 744c67aae66..75f34354ac4 100644--- a/app/views/layouts/only_logo.html.erb+++ b/app/views/layouts/only_logo.html.erb@@ -36,7 +36,7 @@ See COPYRIGHT and LICENSE files for more details.</head><body><div id="wrapper">- <header class="op-app-header">+ <header class="op-app-header<%= ' op-app-header_development' if OpenProject::Configuration.development_highlight_enabled? %>"><div class="op-app-header--center op-logo"><%= link_to(I18n.t('label_home'), home_url, class: 'op-logo--link') %></div>diff --git a/config/constants/settings/definition.rb b/config/constants/settings/definition.rbindex 7950669f818..0c278d7fdd3 100644--- a/config/constants/settings/definition.rb+++ b/config/constants/settings/definition.rb@@ -313,6 +313,11 @@ module Settingsdemo_view_of_type_team_planner_seeded: {default: false},+ development_highlight_enabled: {+ description: 'Enable highlighting of development environment',+ default: -> { Rails.env.development? },+ format: :boolean+ },diff_max_lines_displayed: {default: 1500},diff --git a/docs/development/README.md b/docs/development/README.mdindex 0d5d1372dd5..01f6ce5a5e4 100644--- a/docs/development/README.md+++ b/docs/development/README.md@@ -28,7 +28,7 @@ We eat our own ice cream so we use OpenProject for roadmap planning and team col- [Submit a feature idea](submit-feature-idea)-+## Development Environment@@ -36,6 +36,14 @@ Take a look at the bottom under Additional resources to see how to setup your de+## Highlighting Development Environment++To make it easier to distinguish a development instance, it is using a tinted website icon and modified app header.++This behaviour can be disabled by setting an environment variable `OPENPROJECT_DEVELOPMENT_HIGHLIGHT_ENABLE=false` (see also [documentation on configuration](../installation-and-operations/configuration/)).+++## Branching model and development flowPlease see this separate guide for the [git branching model and core development](git-workflow/).diff --git a/frontend/src/global_styles/common/header/app-header.sass b/frontend/src/global_styles/common/header/app-header.sassindex 6aaa612c9df..363b2278372 100644--- a/frontend/src/global_styles/common/header/app-header.sass+++ b/frontend/src/global_styles/common/header/app-header.sass@@ -82,3 +82,6 @@.top-menu-searchpadding-right: 1rem++ &.op-app-header_development+ background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='20'><text x='0' y='1em' fill='rgba(0, 0, 0, 0.5)'>development</text></svg>")diff --git a/lib/open_project/custom_styles/design.rb b/lib/open_project/custom_styles/design.rbindex dc1bcc22044..38f4f8b3438 100644--- a/lib/open_project/custom_styles/design.rb+++ b/lib/open_project/custom_styles/design.rb@@ -46,9 +46,23 @@ module OpenProject::CustomStylesend##- # Path the favicon+ # Path to favicondef favicon_asset_path- 'favicon.ico'.freeze+ if OpenProject::Configuration.development_highlight_enabled?+ 'development/favicon.ico'.freeze+ else+ 'favicon.ico'.freeze+ end+ end++ ##+ # Path to apple touch icon+ def apple_touch_icon_asset_path+ if OpenProject::Configuration.development_highlight_enabled?+ 'development/apple-touch-icon-120x120.png'.freeze+ else+ 'apple-touch-icon-120x120.png'.freeze+ endend##diff --git a/spec/views/layouts/base.html.erb_spec.rb b/spec/views/layouts/base.html.erb_spec.rbindex a4f8bddb5f3..1ea78c6de8e 100644--- a/spec/views/layouts/base.html.erb_spec.rb+++ b/spec/views/layouts/base.html.erb_spec.rb@@ -103,37 +103,69 @@ RSpec.describe 'layouts/base' dodescribe 'icons' dolet(:current_user) { anonymous }- before do- render- end+ context 'not in development environment' do+ before do+ render+ end- it 'renders main favicon' do- expect(rendered).to have_css(- "link[type='image/x-icon'][href*='#{OpenProject::CustomStyles::Design.favicon_asset_path}']",- visible: false- )- end+ it 'renders main favicon' do+ expect(rendered).to have_css(+ "link[type='image/x-icon'][href*='/assets/favicon.ico']",+ visible: false+ )+ end++ it 'renders apple icons' do+ expect(rendered).to have_css(+ "link[type='image/png'][href*='/assets/apple-touch-icon-120x120.png']",+ visible: false+ )+ end++ # We perform a get request against the icons to ensure they are there (and+ # avoid 404 errors in production). Should you continue to see 404s in production,+ # ensure your asset cache is not stale.- it 'renders apple icons' do- expect(rendered).to have_css(- "link[type='image/png'][href*='/assets/apple-touch-icon-120x120.png']",- visible: false- )+ # We do this here as opposed to a request spec to 1. keep icon specs contained+ # in one place, and 2. the view itself makes this request, so this is an appropriate+ # location for it.+ it 'icons actually exist' do+ visit 'assets/favicon.ico'+ expect(page.status_code).to eq(200)++ visit 'assets/apple-touch-icon-120x120.png'+ expect(page.status_code).to eq(200)+ endend- # We perform a get request against the icons to ensure they are there (and- # avoid 404 errors in production). Should you continue to see 404s in production,- # ensure your asset cache is not stale.+ context 'in development environment' do+ before do+ allow(OpenProject::Configuration).to receive(:development_highlight_enabled?).and_return(true)- # We do this here as opposed to a request spec to 1. keep icon specs contained- # in one place, and 2. the view itself makes this request, so this is an appropriate- # location for it.- it 'icons actually exist' do- visit 'assets/favicon.ico'- expect(page.status_code).to eq(200)+ render+ end- visit 'assets/apple-touch-icon-120x120.png'- expect(page.status_code).to eq(200)+ it 'renders main favicon' do+ expect(rendered).to have_css(+ "link[type='image/x-icon'][href*='/assets/development/favicon.ico']",+ visible: false+ )+ end++ it 'renders apple icons' do+ expect(rendered).to have_css(+ "link[type='image/png'][href*='/assets/development/apple-touch-icon-120x120.png']",+ visible: false+ )+ end++ it 'icons actually exist' do+ visit 'assets/development/favicon.ico'+ expect(page.status_code).to eq(200)++ visit 'assets/development/apple-touch-icon-120x120.png'+ expect(page.status_code).to eq(200)+ endendend