From 49a1daf9786276ffde74a470e0b4dc874926431e Mon Sep 17 00:00:00 2001 From: Jaymee Hyppolite <54775395+JaymeeH@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:21:58 -0500 Subject: [PATCH] Relocating the new project button (#1049) * Changing new project button text moving the new project button to the welcome pane * refactoring system specs --- app/assets/stylesheets/_settings.scss | 145 ++++++++++++++------------ app/views/welcome/index.html.erb | 121 ++++++++++----------- spec/system/project_roles_spec.rb | 10 +- spec/system/project_spec.rb | 16 +-- spec/system/welcome_spec.rb | 6 +- 5 files changed, 153 insertions(+), 145 deletions(-) diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 06c1b55bf..04e3c3121 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -1,5 +1,5 @@ - -.container{ //Main body of every page +.container { + //Main body of every page background-color: rgb(255, 255, 255); padding-top: 2em; min-height: 81vh; @@ -56,7 +56,7 @@ visibility: collapse; } - #show-more-sysadmin{ + #show-more-sysadmin { margin-top: 0.5em; } } @@ -66,8 +66,17 @@ display: inline-flex; } + .welcome-pane { + display: inline-flex; + } + + .project-button { + margin-top: 11px; + margin-left: 22em; + } + #emulation_bar { - margin-left: 5px + margin-left: 5px; } #dashboard-projects { @@ -83,42 +92,40 @@ } } - #dashboard-activity{ + #dashboard-activity { @include dashboard-component; min-height: 15em; } - #dashboard-pending{ + #dashboard-pending { @include dashboard-component; margin-top: 1em; min-width: 30em; } - } - -#show{ +#show { .pending-project { margin-left: 5em; padding-bottom: 2em; -} - .details{ + } + .details { margin-left: 2em; } - .btn.btn-return.btn-sm{ + .btn.btn-return.btn-sm { background-color: white; - border-color: #0D6EFD; + border-color: #0d6efd; border-width: 2px; } - .provenance-header{ + .provenance-header { font-weight: bold; } - .provenance{ + .provenance { display: inline-block; margin-right: 23em; margin-left: 23.5em; } - .approved-details{ + .approved-details { dt { float: left; min-width: calc(25% + 55px); @@ -126,12 +133,13 @@ padding: 0; margin: 0; margin-left: 1em; - clear: both + clear: both; } } - h2 {// Heading for the details div + h2 { + // Heading for the details div margin-left: 0.2em; - .btn.btn-primary.btn-sm{ + .btn.btn-primary.btn-sm { margin-left: 1.5em; } } @@ -139,7 +147,7 @@ width: 100%; overflow: hidden; padding: 0; - margin: 0 + margin: 0; } dl dl { padding-left: 2rem; @@ -151,30 +159,28 @@ padding: 0; margin: 0; margin-left: 1em; - clear: both + clear: both; } - dd{ - margin-bottom: .5rem; + dd { + margin-bottom: 0.5rem; margin-left: 0; - } p { margin-left: 1em; } } -#content{ - +#content { #file-list { - width:90%; + width: 90%; border: 1px solid gray; } #file-list > tbody > tr > th { background-color: #dddcdc; } - label{ - padding-bottom: .5em; + label { + padding-bottom: 0.5em; } dt { float: left; @@ -183,14 +189,14 @@ padding: 0; margin: 0; margin-left: 1em; - clear: both + clear: both; } - dd{ - margin-bottom: .5rem; + dd { + margin-bottom: 0.5rem; margin-left: 0; } - .btn.btn-primary.btn-sm{ + .btn.btn-primary.btn-sm { margin-left: 1em; } @@ -213,7 +219,7 @@ } } -#edit{ +#edit { .added_user_textbox { background-color: #f4f2f2; margin-bottom: 2px; @@ -232,11 +238,11 @@ margin-bottom: 10px; } - .custom_error{ + .custom_error { display: none; - .error_message{ - color: var(--Secondary-Red-Dark, #B00002); + .error_message { + color: var(--Secondary-Red-Dark, #b00002); margin-top: 2px; /* Body XS */ @@ -263,61 +269,63 @@ margin-left: 10px; } - h2 {// Headings for roles and description + h2 { + // Headings for roles and description text-decoration: underline; text-decoration-thickness: 3px; } - .roles-container{ + .roles-container { margin-left: 2em; } - .description-container{ + .description-container { margin-left: 2em; } - .data-users{ + .data-users { margin-left: 3em; } - .actions{ + .actions { margin-top: 1em; } } -#approve{ - .details{ +#approve { + .details { margin-left: 2em; } - .provenance{ + .provenance { display: inline-block; margin-right: 23em; margin-left: 23.5em; } - .field{ + .field { display: inline-flex; margin-bottom: 2em; } - .form-directory{ + .form-directory { min-width: 13em; } - .form-directory-confirm{ + .form-directory-confirm { margin-left: 1em; min-width: fit-content; } - .form-message{ + .form-message { min-width: 15em; min-height: 3em; margin-left: 5px; } - .form-date{ + .form-date { min-width: 14em; } - .form-dropdown{ + .form-dropdown { max-width: fit-content; margin-right: 1em; } - h2 {// Heading for the details div + h2 { + // Heading for the details div margin-left: 0.2em; text-decoration: underline; text-decoration-thickness: 3px; - .btn.btn-primary.btn-sm{ + .btn.btn-primary.btn-sm { margin-left: 1.5em; } } @@ -325,7 +333,7 @@ width: 100%; overflow: hidden; padding: 0; - margin: 0 + margin: 0; } dt { float: left; @@ -334,44 +342,43 @@ padding: 0; margin: 0; margin-left: 1em; - clear: both + clear: both; } - dd{ - margin-bottom: .5rem; - - + dd { + margin-bottom: 0.5rem; } p { margin-left: 1em; } - label{ + label { margin-right: 5em; max-width: 8em; font-weight: bold; } - input{ - .placeholder{ + input { + .placeholder { opacity: 1; } - -webkit-outer-spin-button, -webkit-inner-spin-button { + -webkit-outer-spin-button, + -webkit-inner-spin-button { display: none; margin: 0; } - [type=number]{ - -moz-appearance:textfield; + [type="number"] { + -moz-appearance: textfield; } width: 10em; max-height: 38px; margin-right: 5px; } - select{ + select { max-height: 38px; } - button{ + button { min-width: 160px; min-height: 38px; } - a{ + a { min-width: 160px; min-height: 38px; } @@ -383,7 +390,7 @@ } #create-script-text { - font-family: 'Courier New', Courier, monospace; + font-family: "Courier New", Courier, monospace; background-color: #f2f1f1; margin-left: 35px; margin-top: 15px; diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 211a362ea..f9e9cb0e3 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -1,89 +1,90 @@
- <% unless current_user %> + <% unless current_user %>

Welcome to TigerData

Please log in. - <% else %> -

Welcome, <%= current_user.given_name %>!

-
- <% if !current_user.eligible_sysadmin? or current_user.superuser? %> -
-

My Projects

- <%if current_user.eligible_sponsor?%> -

Sponsored by Me

-
    - <% @sponsored_projects.each do |project| %> -
  • <%= link_to(project.title, project) %>
  • - <%end%> -
- <% end %> - <% if current_user.eligible_manager? %> -

Managed by Me

-
    - <% @managed_projects.each do |project| %> -
  • <%= link_to(project.title, project) %>
  • + <% else %> +
    +

    Welcome, <%= current_user.given_name %>!

    +
    + <%if current_user.eligible_sponsor?%> + <%= link_to "Create new project", new_project_path(), class: "btn btn-dark btn-sm" %> <%end%> -
- <% end %> - <% if @data_user_projects.size > 0 %> -

Shared with Me

-
    - <% @data_user_projects.each do |project| %> -
  • <%= link_to(project.title, project) %>
  • - <%end%> -
- <% end %> -
-
- <%if current_user.eligible_sponsor?%> - <%= link_to "New Project", new_project_path(), class: "btn btn-dark btn-sm" %> - <%end%>
-
- <%= render partial: "recent_activity" %> - <% end %>
- <% if current_user.eligible_sysadmin?%> + <% if !current_user.eligible_sysadmin? or current_user.superuser? %> +
+

My Projects

+ <%if current_user.eligible_sponsor?%> +

Sponsored by Me

+
    + <% @sponsored_projects.each do |project| %> +
  • <%= link_to(project.title, project) %>
  • + <%end%> +
+ <% end %> + <% if current_user.eligible_manager? %> +

Managed by Me

+
    + <% @managed_projects.each do |project| %> +
  • <%= link_to(project.title, project) %>
  • + <%end%> +
+ <% end %> + <% if @data_user_projects.size > 0 %> +

Shared with Me

+
    + <% @data_user_projects.each do |project| %> +
  • <%= link_to(project.title, project) %>
  • + <%end%> +
+ <% end %> +
+ <%= render partial: "recent_activity" %> + <% end %> +
+
+ <% if current_user.eligible_sysadmin?%>
-

Project Administration

+

Project Administration

Pending Projects

<% if !@pending_projects.empty? %> -
    +
      <% @pending_projects.each do |project| %> -
    • +
    • <%= link_to(project.title, project) %> -
    • + <% end %> -
    +
<% else %> -

(none)

+

(none)

<% end %>

Recently Approved Projects

<% if !@approved_projects.empty? %> - +
<% @approved_projects.each_with_index do |project, index| %> - <% @row_css = index < 5 ? "visible-row top-section" : "invisible-row bottom-section" %> - + <% @row_css = index < 5 ? "visible-row top-section" : "invisible-row bottom-section" %> + - + <% end %> -
<%= link_to(project.title, project) %>
- + + <% else %> -

(none)

+

(none)

<% end %>
- <% unless current_user.superuser? %> - <%= render partial: "recent_activity" %> + <% unless current_user.superuser? %> + <%= render partial: "recent_activity" %> <% end %> - <%end%> + <%end%>
<% end %> -
+ \ No newline at end of file diff --git a/spec/system/project_roles_spec.rb b/spec/system/project_roles_spec.rb index f065dce4a..88136cffa 100644 --- a/spec/system/project_roles_spec.rb +++ b/spec/system/project_roles_spec.rb @@ -22,7 +22,7 @@ it "allows the user fill in only valid users for roles" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" # Data Sponsor is not editable. It can only be the user who is initiating this request. expect(page.find("#non-editable-data-sponsor").text).to eq sponsor_user.uid @@ -93,19 +93,19 @@ it "allows Data Sponsors to request a new project" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page).to have_content "New Project Request" end it "allows superusers to request a new project" do sign_in superuser visit "/" - click_on "New Project" + click_on "Create new project" expect(page).to have_content "New Project Request" end it "does not give the data manager the New Project button" do sign_in data_manager visit "/" - expect(page).not_to have_content "New Project" + expect(page).not_to have_content "Create new project" end it "only allows the Data Sponsor to load the New Projects page" do sign_in data_manager @@ -115,7 +115,7 @@ it "does not give the sytem admin New Project button" do sign_in system_admin visit "/" - expect(page).not_to have_content "New Project" + expect(page).not_to have_content "Create new project" end it "does not allow the system administrato to load New Projects page" do sign_in system_admin diff --git a/spec/system/project_spec.rb b/spec/system/project_spec.rb index 648f9064e..3bae707cd 100644 --- a/spec/system/project_spec.rb +++ b/spec/system/project_spec.rb @@ -175,7 +175,7 @@ it "allows the user to create a project" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page.find("#non-editable-data-sponsor").text).to eq sponsor_user.uid fill_in "data_manager", with: data_manager.uid fill_in "ro-user-uid-to-add", with: read_only.uid @@ -223,7 +223,7 @@ it "does not allow the user to create a project" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page.find("#non-editable-data-sponsor").text).to eq sponsor_user.uid fill_in "data_manager", with: data_manager.uid fill_in "ro-user-uid-to-add", with: read_only.uid @@ -247,7 +247,7 @@ it "does not allow the user to create a project" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page.find("#non-editable-data-sponsor").text).to eq sponsor_user.uid fill_in "data_manager", with: "xxx" @@ -275,7 +275,7 @@ it "does not allow the user to create a project" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page.find("#non-editable-data-sponsor").text).to eq sponsor_user.uid fill_in "data_manager", with: data_manager.uid fill_in "ro-user-uid-to-add", with: "xxx" @@ -297,7 +297,7 @@ it "redirects the user back to the dashboard" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page).to have_content("New Project Request") click_on "Cancel" @@ -314,7 +314,7 @@ it "allows the user to create a project" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" # Data Sponsor is automatically populated. fill_in "data_manager", with: data_manager.uid fill_in "ro-user-uid-to-add", with: read_only.uid @@ -340,7 +340,7 @@ it "allows the projects to be created" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page.find("#non-editable-data-sponsor").text).to eq sponsor_user.uid fill_in "data_manager", with: data_manager.uid fill_in "ro-user-uid-to-add", with: read_only.uid @@ -389,7 +389,7 @@ it "logs the error message, flashes a notification to the end-user, and renders the New Project View" do sign_in sponsor_user visit "/" - click_on "New Project" + click_on "Create new project" expect(page).to be_axe_clean .according_to(:wcag2a, :wcag2aa, :wcag21a, :wcag21aa, :section508) .skipping(:'color-contrast') diff --git a/spec/system/welcome_spec.rb b/spec/system/welcome_spec.rb index 7ba3a0a8b..6dd72b0e2 100644 --- a/spec/system/welcome_spec.rb +++ b/spec/system/welcome_spec.rb @@ -138,7 +138,7 @@ visit "/" expect(page).to have_content("Sponsored by Me") expect(page).to have_content("Recent Activity") - expect(page).to have_selector(:link_or_button, "New Project") + expect(page).to have_selector(:link_or_button, "Create new project") end end end @@ -151,7 +151,7 @@ visit "/" expect(page).to have_content("Welcome, #{current_user.given_name}!") expect(page).not_to have_content "Please log in" - expect(page).to have_content "New Project" + expect(page).to have_content "Create new project" end it "shows the system administrator dashboard" do @@ -206,7 +206,7 @@ visit "/" expect(page).to have_content("Welcome, #{current_user.given_name}!") expect(page).not_to have_content "Please log in" - expect(page).not_to have_content "New Project" + expect(page).not_to have_content "Create new project" end it "shows the system administrator dashboard" do