-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Creating emulation bar for tester-trainers Creating emulation bar for non-production environments, and adding several roles as options to be emulated * rubocop 🚨 * creating the tester-trainer emulation bar moving the emulation menu to the emulation bar spec test for new emulation banner updated user factory to add trainers * rubocop 🚨 * working on posting to emulate on the change of the emulation dropdown * rubocop 🚨 * eslint * passing an authenticity token along with the form * rubocop * updating welcome controller spec * eslint * restricting the emulation banner to the home page
- Loading branch information
Showing
14 changed files
with
117 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#emulator { | ||
text-align: center; | ||
background-color: rgb(231, 117, 0); | ||
padding: 20px 0px 10px 0px; | ||
border-bottom: #000000 solid 2px; | ||
color: rgb(0, 0, 0); | ||
box-shadow: inset 0px 9px 10px 2px rgba(0,0,0,0.5); | ||
|
||
h1 { | ||
font-size: 24px; | ||
font-weight: bold; | ||
} | ||
p { | ||
font-size: 18px; | ||
} | ||
a { | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
@media all and (max-width: 860px) { | ||
#emulator { | ||
padding: 10px 3px 5px 3px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require "yaml" | ||
|
||
module EmulatorHelper | ||
def emulator_content | ||
@yaml_data = YAML.load_file("config/emulator.yml") | ||
return false if @yaml_data[Rails.env].nil? || @yaml_data[Rails.env] == "production" | ||
return false unless current_page?("/") | ||
@emulator_title = @yaml_data[Rails.env]["title"] | ||
@emulator_body = @yaml_data[Rails.env]["body"] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<% if emulator_content && !current_user.nil? && current_user.trainer%> | ||
<div id="emulator"> | ||
<h1><%= sanitize @emulator_title %></h1> | ||
<p><%= sanitize @emulator_body, attributes: %w(href target)%></p> | ||
<form action="emulate" method="post" id="emulation-form"> | ||
<label for="emulation_menu" class="form-label">Current Role:</label> | ||
<select id="emulation_menu" name="emulation_menu" class="form-dropdown" required> | ||
<option disabled="disabled" <%= "selected" if current_user.trainer?%>>Trainer</option> | ||
<option value="Eligible Data Sponsor" <%= "selected" if current_user.eligible_sponsor%>>Eligible Data Sponsor</option> | ||
<option value="Eligible Data Manager" <%= "selected" if current_user.eligible_manager%>>Eligible Data Manager</option> | ||
<option value="Eligible Data User" <%= "selected" if @eligible_sysadmin%>>Eligible Data User</option> | ||
<option value="System Administrator" <%= "selected" if current_user.sysadmin%>>System Administrator</option> | ||
<option value="Return to Self">Return to Self</option> | ||
</select> | ||
<%= token_tag nil %> | ||
</form> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
development: | ||
title: As an approved tester-trainer | ||
body: You may select another role to emulate | ||
qa: | ||
title: As an approved tester-trainer | ||
body: You may select another role to emulate | ||
staging: | ||
title: As an approved tester-trainer | ||
body: You may select another role to emulate | ||
test: | ||
title: As an approved tester-trainer | ||
body: This is a <b>test</b> <a href="mailto:[email protected]">message.</a> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
describe "Website banner", type: :system, js: true do | ||
let(:current_user) { FactoryBot.create(:trainer, uid: "pul123") } | ||
it "has the banner on the homepage" do | ||
sign_in current_user | ||
visit "/" | ||
expect(page).to have_css "#emulator" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters