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).
This commit is contained in:
Luka Murn 2016-11-28 10:52:17 +01:00
parent 31f6379866
commit 9f998d6fed

View file

@ -10,13 +10,19 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="navbar-brand" href="<%= root_path %>"> <a class="navbar-brand" href="<%= root_path %>">
<% if Rails.env.production? %> <%
<img src="/images/logo.png" id="logo"> show_version = !Rails.env.production?
<% else %> if ENV['NAVBAR_SHOW_VERSION'].present?
show_version = YAML.load(ENV['NAVBAR_SHOW_VERSION'])
end
%>
<% if show_version %>
<img src="/images/logo.png" class="with-version" id="logo"> <img src="/images/logo.png" class="with-version" id="logo">
<span class="version"> <span class="version">
<%= Constants::APP_VERSION %> <%= Constants::APP_VERSION %>
</span> </span>
<% else %>
<img src="/images/logo.png" id="logo">
<% end %> <% end %>
</a> </a>
</div> </div>