From 9f998d6fedd3a822d7895b19ab6bd790fa36ceb5 Mon Sep 17 00:00:00 2001 From: Luka Murn Date: Mon, 28 Nov 2016 10:52:17 +0100 Subject: [PATCH] Add an environmental variable to toggle version display in navbar The variable is called NAVBAR_SHOW_VERSION. If not specified, it defaults to the current behavior (version is hidden on production, but visible on development & test environments). --- app/views/shared/_navigation.html.erb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb index 01f534a9f..f316d1951 100644 --- a/app/views/shared/_navigation.html.erb +++ b/app/views/shared/_navigation.html.erb @@ -10,13 +10,19 @@ - <% if Rails.env.production? %> - - <% else %> + <% + show_version = !Rails.env.production? + if ENV['NAVBAR_SHOW_VERSION'].present? + show_version = YAML.load(ENV['NAVBAR_SHOW_VERSION']) + end + %> + <% if show_version %> <%= Constants::APP_VERSION %> + <% else %> + <% end %>