From 1b3bd1a2d8beb355c90d5112967afb9234887bf9 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 5 Oct 2023 13:32:11 +0100 Subject: [PATCH 1/9] feat: add more environment indicators to title and navbar --- app/frontend/stylesheets/all/header.scss | 6 +++ app/views/layouts/application.html.erb | 18 ++++++++- .../layouts/application.html.erb_spec.rb | 39 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 spec/views/layouts/application.html.erb_spec.rb diff --git a/app/frontend/stylesheets/all/header.scss b/app/frontend/stylesheets/all/header.scss index ea2ecab826..3dfa9e655a 100644 --- a/app/frontend/stylesheets/all/header.scss +++ b/app/frontend/stylesheets/all/header.scss @@ -23,6 +23,12 @@ body.production { } } +body.development { + .main-nav { + @extend .bg-secondary; + } +} + #app_name { padding: 0; font-size: 8px; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 815117d9bb..ff544c8df9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -17,7 +17,23 @@ - Sequencescape : <%= controller.controller_name.capitalize %> - <%= @page_name || controller.action_name %> + <% # Define a hash of environments + environments = { + cucumber: "๐Ÿฅ’", + development: "๐Ÿšง", + production: "๐ŸŒŽ", + profile: "โฑ๏ธ", + staging: "๐Ÿš€", + staging_2: "๐Ÿš€2๏ธโƒฃ", + test: "๐Ÿงช", + training: "๐ŸŽ“", + } + + # Get an emoji for the current environment + current_environment = Rails.env.to_sym + emoji = environments[current_environment] || "โ“" + %> + <%= "#{emoji}:" unless Rails.env.production? %> Sequencescape : <%= controller.controller_name.capitalize %> - <%= @page_name || controller.action_name %> <%= vite_client_tag %> diff --git a/spec/views/layouts/application.html.erb_spec.rb b/spec/views/layouts/application.html.erb_spec.rb new file mode 100644 index 0000000000..05d89408ce --- /dev/null +++ b/spec/views/layouts/application.html.erb_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'layouts/application', type: :view do + environments = { + cucumber: "๐Ÿฅ’", + development: "๐Ÿšง", + # production is tested separately + profile: "โฑ๏ธ", + staging: "๐Ÿš€", + staging_2: "๐Ÿš€2๏ธโƒฃ", + test: "๐Ÿงช", + training: "๐ŸŽ“", + } + + environments.each do |env, emoji| + it "displays the correct title with #{emoji} for #{env} environment" do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new(env.to_s)) + assign(:page_name, 'the homepage') + render + expect(rendered).to have_title("#{emoji}: Sequencescape : Test - the homepage") + end + end + + it 'displays the correct title without emoji in production environment' do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production')) + assign(:page_name, 'the homepage') + render + expect(rendered).to have_title("Sequencescape : Test - the homepage") + end + + it 'displays the correct title with question mark emoji for undefined environment' do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('undefined_environment')) + assign(:page_name, 'the homepage') + render + expect(rendered).to have_title("โ“: Sequencescape : Test - the homepage") + end +end From e1cdb427d8cd3fdd0611c88f85be0c42c7f92d6a Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 5 Oct 2023 16:27:27 +0100 Subject: [PATCH 2/9] style: lint --- app/views/layouts/application.html.erb | 18 +++++++++--------- .../views/layouts/application.html.erb_spec.rb | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ff544c8df9..026238ac4b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -19,19 +19,19 @@ <% # Define a hash of environments environments = { - cucumber: "๐Ÿฅ’", - development: "๐Ÿšง", - production: "๐ŸŒŽ", - profile: "โฑ๏ธ", - staging: "๐Ÿš€", - staging_2: "๐Ÿš€2๏ธโƒฃ", - test: "๐Ÿงช", - training: "๐ŸŽ“", + cucumber: '๐Ÿฅ’', + development: '๐Ÿšง', + production: '๐ŸŒŽ', + profile: 'โฑ๏ธ', + staging: '๐Ÿš€', + staging_2: '๐Ÿš€2๏ธโƒฃ', # rubocop:disable Naming/VariableNumber + test: '๐Ÿงช', + training: '๐ŸŽ“', } # Get an emoji for the current environment current_environment = Rails.env.to_sym - emoji = environments[current_environment] || "โ“" + emoji = environments[current_environment] || 'โ“' %> <%= "#{emoji}:" unless Rails.env.production? %> Sequencescape : <%= controller.controller_name.capitalize %> - <%= @page_name || controller.action_name %> diff --git a/spec/views/layouts/application.html.erb_spec.rb b/spec/views/layouts/application.html.erb_spec.rb index 05d89408ce..ffdde08fc8 100644 --- a/spec/views/layouts/application.html.erb_spec.rb +++ b/spec/views/layouts/application.html.erb_spec.rb @@ -4,14 +4,14 @@ RSpec.describe 'layouts/application', type: :view do environments = { - cucumber: "๐Ÿฅ’", - development: "๐Ÿšง", + cucumber: '๐Ÿฅ’', + development: '๐Ÿšง', # production is tested separately - profile: "โฑ๏ธ", - staging: "๐Ÿš€", - staging_2: "๐Ÿš€2๏ธโƒฃ", - test: "๐Ÿงช", - training: "๐ŸŽ“", + profile: 'โฑ๏ธ', + staging: '๐Ÿš€', + staging_2: '๐Ÿš€2๏ธโƒฃ', # rubocop:disable Naming/VariableNumber + test: '๐Ÿงช', + training: '๐ŸŽ“' } environments.each do |env, emoji| @@ -27,13 +27,13 @@ allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production')) assign(:page_name, 'the homepage') render - expect(rendered).to have_title("Sequencescape : Test - the homepage") + expect(rendered).to have_title('Sequencescape : Test - the homepage') end it 'displays the correct title with question mark emoji for undefined environment' do allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('undefined_environment')) assign(:page_name, 'the homepage') render - expect(rendered).to have_title("โ“: Sequencescape : Test - the homepage") + expect(rendered).to have_title('โ“: Sequencescape : Test - the homepage') end end From 97bab5250596429b45a376b4dcadff352bfea593 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 16 Oct 2023 10:04:57 +0100 Subject: [PATCH 3/9] fix: removing unused staging_2 environment --- app/views/layouts/application.html.erb | 1 - spec/views/layouts/application.html.erb_spec.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 026238ac4b..c86c7c3f16 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -24,7 +24,6 @@ production: '๐ŸŒŽ', profile: 'โฑ๏ธ', staging: '๐Ÿš€', - staging_2: '๐Ÿš€2๏ธโƒฃ', # rubocop:disable Naming/VariableNumber test: '๐Ÿงช', training: '๐ŸŽ“', } diff --git a/spec/views/layouts/application.html.erb_spec.rb b/spec/views/layouts/application.html.erb_spec.rb index ffdde08fc8..bf02cf6b01 100644 --- a/spec/views/layouts/application.html.erb_spec.rb +++ b/spec/views/layouts/application.html.erb_spec.rb @@ -9,7 +9,6 @@ # production is tested separately profile: 'โฑ๏ธ', staging: '๐Ÿš€', - staging_2: '๐Ÿš€2๏ธโƒฃ', # rubocop:disable Naming/VariableNumber test: '๐Ÿงช', training: '๐ŸŽ“' } From be5c7130c7ec2e2296348ad67d8f57c04d565049 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Oct 2023 15:40:16 +0100 Subject: [PATCH 4/9] fix: remove emoji indicators --- app/views/layouts/application.html.erb | 17 +-------- .../layouts/application.html.erb_spec.rb | 38 ------------------- 2 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 spec/views/layouts/application.html.erb_spec.rb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c86c7c3f16..815117d9bb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -17,22 +17,7 @@ - <% # Define a hash of environments - environments = { - cucumber: '๐Ÿฅ’', - development: '๐Ÿšง', - production: '๐ŸŒŽ', - profile: 'โฑ๏ธ', - staging: '๐Ÿš€', - test: '๐Ÿงช', - training: '๐ŸŽ“', - } - - # Get an emoji for the current environment - current_environment = Rails.env.to_sym - emoji = environments[current_environment] || 'โ“' - %> - <%= "#{emoji}:" unless Rails.env.production? %> Sequencescape : <%= controller.controller_name.capitalize %> - <%= @page_name || controller.action_name %> + Sequencescape : <%= controller.controller_name.capitalize %> - <%= @page_name || controller.action_name %> <%= vite_client_tag %> diff --git a/spec/views/layouts/application.html.erb_spec.rb b/spec/views/layouts/application.html.erb_spec.rb deleted file mode 100644 index bf02cf6b01..0000000000 --- a/spec/views/layouts/application.html.erb_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'layouts/application', type: :view do - environments = { - cucumber: '๐Ÿฅ’', - development: '๐Ÿšง', - # production is tested separately - profile: 'โฑ๏ธ', - staging: '๐Ÿš€', - test: '๐Ÿงช', - training: '๐ŸŽ“' - } - - environments.each do |env, emoji| - it "displays the correct title with #{emoji} for #{env} environment" do - allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new(env.to_s)) - assign(:page_name, 'the homepage') - render - expect(rendered).to have_title("#{emoji}: Sequencescape : Test - the homepage") - end - end - - it 'displays the correct title without emoji in production environment' do - allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production')) - assign(:page_name, 'the homepage') - render - expect(rendered).to have_title('Sequencescape : Test - the homepage') - end - - it 'displays the correct title with question mark emoji for undefined environment' do - allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('undefined_environment')) - assign(:page_name, 'the homepage') - render - expect(rendered).to have_title('โ“: Sequencescape : Test - the homepage') - end -end From 652f3f057941b25b6bccfa3ef483fdbd6a8634f4 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 25 Oct 2023 15:54:57 +0100 Subject: [PATCH 5/9] feat: change favicon based on environment --- app/helpers/application_helper.rb | 28 ++++++++++++ app/views/layouts/application.html.erb | 6 +-- app/views/layouts/sessions.html.erb | 6 +-- public/apple-icon-development.png | Bin 0 -> 6925 bytes public/apple-icon-staging.png | Bin 0 -> 7329 bytes public/apple-icon-training.png | Bin 0 -> 7424 bytes public/favicon-development.ico | Bin 0 -> 4286 bytes public/favicon-staging.ico | Bin 0 -> 4286 bytes public/favicon-training.ico | Bin 0 -> 4286 bytes spec/helpers/application_helper_spec.rb | 58 ++++++++++++++++++++++++ 10 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 public/apple-icon-development.png create mode 100644 public/apple-icon-staging.png create mode 100644 public/apple-icon-training.png create mode 100644 public/favicon-development.ico create mode 100644 public/favicon-staging.ico create mode 100644 public/favicon-training.ico diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f37839f87b..504328a3ce 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -34,6 +34,34 @@ def required_marker icon('fas', 'asterisk', class: 'text-warning', title: 'required') end + # Returns the appropriate icon suffix for the current environment + # Returns empty string for production + # Returns "-#{environment}" for training, staging + # Returns "-development" for any other environment + # @return [String] The suffix to append to the icon name + def icon_suffix + case Rails.env + when 'production' + '' + when 'training', 'staging' + "-#{Rails.env}" + else + '-development' + end + end + + # Return the appropriate favicon for the current environment + # @return [String] The path to the favicon + def favicon + "favicon#{icon_suffix}.ico" + end + + # Return the appropriate apple icon for the current environment + # @return [String] The path to the apple icon + def apple_icon + "apple-icon#{icon_suffix}.png" + end + def render_flashes flash.each do |key, message| concat(alert(key, id: "message_#{key}") { Array(message).each { |m| concat tag.div(m) } }) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 815117d9bb..b3317eb724 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -33,9 +33,9 @@ <% end %> <% end %> <%= csrf_meta_tags %> - - - + + + diff --git a/app/views/layouts/sessions.html.erb b/app/views/layouts/sessions.html.erb index c521505ab5..4315ee7aba 100644 --- a/app/views/layouts/sessions.html.erb +++ b/app/views/layouts/sessions.html.erb @@ -7,9 +7,9 @@ <%= vite_stylesheet_tag "application.scss", media: "all" %> Sequencescape : <%= I18n.t('global_links.login') %> - - - + + + <% if Rails.application.config.disable_animations %> <%= vite_stylesheet_tag 'disable_animations' %> diff --git a/public/apple-icon-development.png b/public/apple-icon-development.png new file mode 100644 index 0000000000000000000000000000000000000000..a815f80d0bae77e93ff691193a6c99efa7ceb30f GIT binary patch literal 6925 zcmeHKc{o(<`ya{jDkV)qmWk}ftPF!NMwS|DiBgQ&OqjupjHSquWGPEXvLtUJOCq62 z$XXQfT9TJUC6r28e`l!Px_;m5`d#mJ{l5P-=Q?N3d7jVnx$paP-_LW-6J>2_Dl8-^ z1OkDC&CT$(z`q&y6yyi42j1N>1^(&-_B*g`iGC0-A10OVL4mOSy(kb0hfW27IQ^d1 zHk;}pf=lCI-O!oN5%0-VMOAulc6JL%II0 zDxLhSr**smZb8LeDrZuLw|JK$7tUcb`M0FezPge-RBrfXzxh}pD<2iIoRh)q%CnR= z6Vwwv6m!9%d<^@b>YA?lCf};|rRvB#u$p_&1znN8I;79xJb7spvaR{f6z6TB#e&53#D*s@gk9#=Mzmg2uYOR_ zz3BJq)2!e)o?I8?eI*g4RE9&tjt11FJ9|bGvIg;N$wOj#Fav$GxX)At83*Tbh5tO zK}`aj;AKp4qniczQ0xLM_mcwLNjhXXgWW=U94tWKNnsNq98V7h3(L`$Tjj+9_uOWf z9Ap*3cGs74AXr0;nLZQChnjHc$B}Zog&=x9WGdDczvmkT@T4#2#%6nAVK6^G zKMg;W2GfTIL+I$}z~D$25(xzmP?kS~P2@lsEO{=)8V8=jBKgq0*mNcX!sR5oGJV%Z`i~=6`+->sv!$?@ zzCI+1$#DvUE&nrxsX4*=2Lm@G8r{=tH7G#5UyPASKX6{YJ|3$WG6_cUpm+kLEWkg+ zFL*Yc`j1$@_{Qy74d-V^0CPY1e?fnbeH9F#2m~yiN%G|yHOK4Aas9=TnIt+HyLyWx zktwc39Tb#I(L_MeaD+Bg2Sb8G$vWC7gboHn)&$CftNI$1IfKO}GDs9I70{wV2Y7VI zC=!x_BtuD>7!nli3a3DIC`2k00Y_k5F$ir827&&G!pesZR3*{lXRo+aWPl1uMW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Ot_vgJX7vDPy-2H-w4T|* zs~?rum6V_QY-o;KdH<~FQwVNnlA(m;`>?s1Yr?w_5(<)P^&$zy3U9s!yc4p2R=6{t zR3lY}zhX2II>bx?XN*V8su^`72wMkk1DCc^#iT3)DbYeOE;Q0~uJGs~*kW7{s_D*P zFrSs$%M)n{QK?%R&dNfc_+zGZZ{XgAb~?n>JvA{;OUB%yo5&Z4=~>FzzdM}DpIr_! z5Uv7gl-w;TeQ2OKlZz9PD4UVK9%7@3n;WK;1^c8K99iaFxifF|G$Sl&xjbP3BQ1rH zKXZTy2C2k?*B#*~XNKON1t)8z?zmLnYNF=m&~v{(;;loKi^7Gm*{D`QocJ;cd?hlW zze209Gh&XSSLl6VZ@hvp!yi{M& zJaO0ATFh;+Rzm{ce#U@qaG9F6C)MFo?!s${cXN~+#yL*j?%XG~E+E_=8+Sgz<-A{N z^>EmWnEr^%HaZr(5+jxsA!MAby36C~d1ayNq3Z=AI$Z>#Y}5J-C*pW^8fHf?MhHqr z-Z>$pxbBDxEk@-et?5m^KW2Nhxxw6X{aYMLb(wqi`n+F{Zi^7^F~tiRoqF?3ph_aO znc4FW;`*0@5_-P-!$F%B^+RfwCytAnURdti5uzaP;XK$7H&6R2+wtsj=mp=E RJHR(B$lSydUxafB{U5RwEcgHb literal 0 HcmV?d00001 diff --git a/public/apple-icon-staging.png b/public/apple-icon-staging.png new file mode 100644 index 0000000000000000000000000000000000000000..b84d59aef799375132749b08a9115091bbe48ddb GIT binary patch literal 7329 zcmeHKc{r5o`ya9;6`>?D#x7$PGt5kehOuT}vd5T36J{_YTZNFFM3(GZSrSeMm6Uxc zMH`~5EvMszLP+?%)ai7t-}kzH*SW6W_rEi9&HFy@{e0ffbKjr)zMpHJSPL_Qo&4hb zAP{J$ks;9vxEpT%_;`S;?S~r%z^yIV#-43O3IO}~F==!!DwrMQLj_X<=`;{1aM;_z za#tIeZ*58B@VUAE`@Vk+%QdznX^Ra1`r!EFwxHKaC2R9%OS?d+vPwrQ9X-`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z#ukaR#7^Z!jGdJ9CG|d)?q~CJ6=O2?)c*i{ G*}nk?t9Hl$ literal 0 HcmV?d00001 diff --git a/public/favicon-training.ico b/public/favicon-training.ico new file mode 100644 index 0000000000000000000000000000000000000000..dd60851a845a753e0115af0c209f76c224932154 GIT binary patch literal 4286 zcmeI0Yfw~W7{^ba`vS}E!rozTP$)XnFwWR$G)**)Ib+mJ7zDb+#vp@OlZD(Rqqqc` zWU#=pCT5uBNEi-kk}@e^qO5?B+@!dpJ3xqR{d?X6G-+J40r!i$^E=Nu@8$o0&-*;* z?96i96ZCa==h%@u?8I?mj^n%tYU2C|*3N&ZPw?avQwC{MWHM<9R%tx^hvT8|J?3L)v46B5<<^r3vAhM31h45lJy?EJ^v>OU+=xv_ zLlOL~0b5UOhpDCr?YBD6Ve7<4molI&@qyxiC*%k8P*^Bh=zV3@Lt|bBU-KHoo=!x4 z&sB^~jG?aUGTtz60n6c3z0AE1ZIU+<%Tu8$eu~#qm`R&-Syb%TBlwsBKX+Zk^;@kl zo{56);0nHN|DSeLtz@}irr-1pGKMIiI|G_VC`>2Rrh&>oD7G~;saSB>CTLwi8M!=uSLL-O*qqj z7DImwqxix>JeU0<|GUO&I;eOvs%})n+SiC}q^r*JhO)pDGLvp@=-yTou0q;R8E7Bw zz{TEL#8;Ibf%;A$~;o=-x=sc3{$gd^hg zHYA+eg@T4+v=07CH9d*j<2L?T8oN7&3%}Lio2KtzsV~7-)>1y#(p>U?81|^)XMPC@ zl_@A|K7nfkjp(*@qi3WSHz{7De3dnoBdIbKYt8K75p9dBF8kcS!cC{~5>h*)?mI(s*T# zCsZ^?zDEa1j(SmGYvI@PfO^bZmZgDPCe3pI%v<^~?Ma%-Auw;rZpzh%Xqn~+;*X4hxl!WbC@(bT`hI7hqv$Aftbqoi<-bX!uKwz|%$&%9kCByf6L zd=JhMuJ>Hu-@iE5BJy^H&?tpd82LXkMC2uebC>`UqY#1V!4QPe{u^kImIN{BGDL(B W0)q?024^V9-;f@Nng0PC75@hPdWjDJ literal 0 HcmV?d00001 diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 80407c906a..597535de15 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -5,6 +5,64 @@ require './app/helpers/application_helper' describe ApplicationHelper do + describe '#favicon' do + subject(:favicon) { helper.favicon } + + it 'returns the favicon path for the production environment' do + allow(Rails).to receive(:env).and_return('production'.inquiry) + expect(favicon).to eq('favicon.ico') + end + + it 'returns the favicon path for the training environment' do + allow(Rails).to receive(:env).and_return('training'.inquiry) + expect(favicon).to eq('favicon-training.ico') + end + + it 'returns the favicon path for the staging environment' do + allow(Rails).to receive(:env).and_return('staging'.inquiry) + expect(favicon).to eq('favicon-staging.ico') + end + + it 'returns the favicon path for the development environment' do + allow(Rails).to receive(:env).and_return('development'.inquiry) + expect(favicon).to eq('favicon-development.ico') + end + + it 'returns the favicon path for an unknown environment' do + allow(Rails).to receive(:env).and_return('unknown'.inquiry) + expect(favicon).to eq('favicon-development.ico') + end + end + + describe '#apple_icon' do + subject(:apple_icon) { helper.apple_icon } + + it 'returns the apple icon path for the production environment' do + allow(Rails).to receive(:env).and_return('production'.inquiry) + expect(apple_icon).to eq('apple-icon.png') + end + + it 'returns the apple icon path for the training environment' do + allow(Rails).to receive(:env).and_return('training'.inquiry) + expect(apple_icon).to eq('apple-icon-training.png') + end + + it 'returns the apple icon path for the staging environment' do + allow(Rails).to receive(:env).and_return('staging'.inquiry) + expect(apple_icon).to eq('apple-icon-staging.png') + end + + it 'returns the apple icon path for the development environment' do + allow(Rails).to receive(:env).and_return('development'.inquiry) + expect(apple_icon).to eq('apple-icon-development.png') + end + + it 'returns the apple icon path for an unknown environment' do + allow(Rails).to receive(:env).and_return('unknown'.inquiry) + expect(apple_icon).to eq('apple-icon-development.png') + end + end + describe '#render_parsed_json' do subject(:returned_html) { render_parsed_json(json) } From 6f1e363b0c8a419247f52d5ce06e6e061488e3a4 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 26 Oct 2023 11:19:09 +0100 Subject: [PATCH 6/9] refactor: declaritively implement nav-bar environment colour change --- app/frontend/stylesheets/all/colours.scss | 6 ++++++ app/frontend/stylesheets/all/components.scss | 14 ++++++++++++++ app/frontend/stylesheets/all/header.scss | 15 ++++++++++----- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/frontend/stylesheets/all/colours.scss b/app/frontend/stylesheets/all/colours.scss index b46ffd06ec..82022fede9 100644 --- a/app/frontend/stylesheets/all/colours.scss +++ b/app/frontend/stylesheets/all/colours.scss @@ -1,3 +1,9 @@ +/* Colours defined per environment */ +$production: $primary !default; +$training: $green !default; +$staging: $red !default; +$development: $gray-600 !default; + @mixin colour-badge($base_colour, $text_colour) { background-color: $base_colour; color: $text_colour; diff --git a/app/frontend/stylesheets/all/components.scss b/app/frontend/stylesheets/all/components.scss index 53fcc702b4..6016d19f15 100644 --- a/app/frontend/stylesheets/all/components.scss +++ b/app/frontend/stylesheets/all/components.scss @@ -2,6 +2,20 @@ * Please ensure you keep it commented */ +/* Background colours for different environments */ +.bg-production { + background-color: $production; +} +.bg-training { + background-color: $training; +} +.bg-staging { + background-color: $staging; +} +.bg-development { + background-color: $development; +} + /* A Summary table presents simple key-value pairs */ .table-summary th { text-align: right; diff --git a/app/frontend/stylesheets/all/header.scss b/app/frontend/stylesheets/all/header.scss index 3dfa9e655a..3b89052d26 100644 --- a/app/frontend/stylesheets/all/header.scss +++ b/app/frontend/stylesheets/all/header.scss @@ -4,7 +4,7 @@ .main-nav { @extend .navbar; @extend .navbar-dark; - @extend .bg-danger; + @extend .bg-development; // development and unknown environments @extend .navbar-expand-lg; #logo_container { @@ -17,15 +17,20 @@ } } +// Set the background color of the navbar based on the environment body.production { .main-nav { - @extend .bg-primary; + @extend .bg-production; } } - -body.development { +body.training { + .main-nav { + @extend .bg-training; + } +} +body.staging { .main-nav { - @extend .bg-secondary; + @extend .bg-staging; } } From ef4f1f123c712790559469c72d61aa9cdebe090f Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 26 Oct 2023 11:21:57 +0100 Subject: [PATCH 7/9] style: lint --- app/frontend/stylesheets/all/colours.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/frontend/stylesheets/all/colours.scss b/app/frontend/stylesheets/all/colours.scss index 82022fede9..3eaabf04d0 100644 --- a/app/frontend/stylesheets/all/colours.scss +++ b/app/frontend/stylesheets/all/colours.scss @@ -1,8 +1,8 @@ /* Colours defined per environment */ -$production: $primary !default; -$training: $green !default; -$staging: $red !default; -$development: $gray-600 !default; +$production: $primary !default; +$training: $green !default; +$staging: $red !default; +$development: $gray-600 !default; @mixin colour-badge($base_colour, $text_colour) { background-color: $base_colour; From b52f58c292f5609fe314c11974100feb35bd6269 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 26 Oct 2023 11:35:42 +0100 Subject: [PATCH 8/9] style: lint inquiry --- spec/helpers/application_helper_spec.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 597535de15..93b2acb08f 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -9,27 +9,27 @@ subject(:favicon) { helper.favicon } it 'returns the favicon path for the production environment' do - allow(Rails).to receive(:env).and_return('production'.inquiry) + allow(Rails).to receive(:env).and_return('production') expect(favicon).to eq('favicon.ico') end it 'returns the favicon path for the training environment' do - allow(Rails).to receive(:env).and_return('training'.inquiry) + allow(Rails).to receive(:env).and_return('training') expect(favicon).to eq('favicon-training.ico') end it 'returns the favicon path for the staging environment' do - allow(Rails).to receive(:env).and_return('staging'.inquiry) + allow(Rails).to receive(:env).and_return('staging') expect(favicon).to eq('favicon-staging.ico') end it 'returns the favicon path for the development environment' do - allow(Rails).to receive(:env).and_return('development'.inquiry) + allow(Rails).to receive(:env).and_return('development') expect(favicon).to eq('favicon-development.ico') end it 'returns the favicon path for an unknown environment' do - allow(Rails).to receive(:env).and_return('unknown'.inquiry) + allow(Rails).to receive(:env).and_return('unknown') expect(favicon).to eq('favicon-development.ico') end end @@ -38,27 +38,27 @@ subject(:apple_icon) { helper.apple_icon } it 'returns the apple icon path for the production environment' do - allow(Rails).to receive(:env).and_return('production'.inquiry) + allow(Rails).to receive(:env).and_return('production') expect(apple_icon).to eq('apple-icon.png') end it 'returns the apple icon path for the training environment' do - allow(Rails).to receive(:env).and_return('training'.inquiry) + allow(Rails).to receive(:env).and_return('training') expect(apple_icon).to eq('apple-icon-training.png') end it 'returns the apple icon path for the staging environment' do - allow(Rails).to receive(:env).and_return('staging'.inquiry) + allow(Rails).to receive(:env).and_return('staging') expect(apple_icon).to eq('apple-icon-staging.png') end it 'returns the apple icon path for the development environment' do - allow(Rails).to receive(:env).and_return('development'.inquiry) + allow(Rails).to receive(:env).and_return('development') expect(apple_icon).to eq('apple-icon-development.png') end it 'returns the apple icon path for an unknown environment' do - allow(Rails).to receive(:env).and_return('unknown'.inquiry) + allow(Rails).to receive(:env).and_return('unknown') expect(apple_icon).to eq('apple-icon-development.png') end end From 48d15c6da28a6100ea0024d7fe4a195f63de84e0 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 26 Oct 2023 11:48:28 +0100 Subject: [PATCH 9/9] refactor: use internal environment variable --- app/helpers/application_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c1a3706060..5734a49b38 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -40,11 +40,12 @@ def required_marker # Returns "-development" for any other environment # @return [String] The suffix to append to the icon name def icon_suffix - case Rails.env + environment = Rails.env + case environment when 'production' '' when 'training', 'staging' - "-#{Rails.env}" + "-#{environment}" else '-development' end