diff --git a/app/assets/stylesheets/_forms.scss b/app/assets/stylesheets/_forms.scss new file mode 100644 index 000000000..1d5723fcb --- /dev/null +++ b/app/assets/stylesheets/_forms.scss @@ -0,0 +1,68 @@ +@import "variables"; +@import "typography"; +@import "bootstrap"; + +#project-form { + .heading-decoration { + background-color: $princeton-orange; + width: 100px; + height: 8px; + margin-bottom: 12px; + } + + .row { + padding-bottom: 40px; + } + + h2 { + margin-top: 80px; + margin-bottom: 40px; + } + + label { + font-family: "Libre Franklin"; + font-size: 18px; + font-style: normal; + font-weight: 600; + line-height: 27px; + } + + input { + width: 285px; + } + + input, select, textarea { + border-radius: 8px; + border: 1px solid $gray-60; + } + + .mediaflux-tooltip { + font-family: "Libre Franklin"; + font-size: 14px; + font-style: normal; + color: $gray-60; + } + + .required-field { + font-family: "Libre Franklin"; + font-size: 14px; + font-style: normal; + line-height: 21px; + color: $gray-60; + } + + .actions { + text-align: right; + #submit-btn { + background-color: $black; + color: $white; + border: none; + } + + #cancel-btn { + background-color: $white; + border: $black solid 1px; + color: $black; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 0a94f1950..fe35e64cb 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -130,8 +130,6 @@ } h2 {// Heading for the details div margin-left: 0.2em; - text-decoration: underline; - text-decoration-thickness: 3px; .btn.btn-primary.btn-sm{ margin-left: 1.5em; } diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index c688ec1b9..f281362c5 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -20,6 +20,7 @@ @import "components/mediaflux_status"; @import "emulator"; @import "footer"; +@import "forms"; @import "header"; @import "settings"; @import "styles_preview"; diff --git a/app/views/projects/_edit_form.html.erb b/app/views/projects/_edit_form.html.erb index 88387d1e5..419e413cc 100644 --- a/app/views/projects/_edit_form.html.erb +++ b/app/views/projects/_edit_form.html.erb @@ -1,114 +1,191 @@ <%= render 'form_errors' %> <%= render 'data_list' %> +
+

Project Roles

+
+
+ +
Required
+
+
+ <% if current_user.superuser? %> + + <% else %> + + <%= @project.metadata_model.data_sponsor || current_user.uid %> + <% end %> +
+
-
-

Project Roles

+
+
+ +
Required
+
+
+ <% if !@project.persisted? || @project.metadata_model.data_sponsor == current_user.uid %> + + <% else %> + + <%= @project.metadata_model.data_manager %> + <% end %> +
+
-

Data Sponsor: + +

+
+ +
+
+
+
    + <% (@project.metadata_model.ro_users || []).compact.each do |user| %> + + <% end %> +
+
+ + + +
+
+
+
- <% if current_user.superuser? %> - - <% else %> - - <%= @project.metadata_model.data_sponsor || current_user.uid %>

- <% end %> +
+
+ +
+
+
+
    + <% (@project.metadata_model.rw_users || []).compact.each do |user|%> + + <%end%> +
+
+ + + +
+
+
+
+ +

Project Description

+ <% if current_user.superuser? %> +
+
+ +
+
+ +
+
+ <% end %> +
+
+ +
Required
+
+
+ +
+
+ + <% if @project.in_mediaflux? %> + +
+
+ + +
+
+ +
+
+ + <% if (current_user.superuser? || current_user.eligible_sysadmin?) %> +
+
+ -

Data Manager: +

+
+ +

This project has already been saved to Mediaflux and the project_directory cannot be changed

- <% if !@project.persisted? || @project.metadata_model.data_sponsor == current_user.uid %> - - <% else %> - - <%= @project.metadata_model.data_manager %> - <% end %> -

+
+
+ <% end %> -

Data User(s):

+ <% end %> -
-

Read Only:

-
    - <% (@project.metadata_model.ro_users || []).compact.each do |user| %> - - <% end %> -
-
- - - -
-
- -
-

Read/Write:

-
    - <% (@project.metadata_model.rw_users || []).compact.each do |user|%> - - <%end%> -
-
- - - -
-
+
+
+ +
Required
+
+
+ <%= @project.project_directory_parent_path %>/ +
+
+ + +
+
+ + +
Required
+
+ + +
+
-
-

Project Description

-
- <% if current_user.superuser? %> -
Project ID:
- -
- <% end %> - -
Departments:
- -
- - <% if @project.in_mediaflux? %> - -

Project Directory: <%= @project.project_directory_parent_path %>/ - <% if (current_user.superuser? || current_user.eligible_sysadmin?) %> - (MediaFlux id: <%= @project.mediaflux_id %>)
- <% end %> - This project has already been saved to Mediaflux and the project_directory cannot be changed

- <% else %> - -

Project Directory: <%= @project.project_directory_parent_path %>/

- <% end %> - -

Title:

-
Description:
- -
+ +
+
+ + + +
+
+ + + +
+ -
- - <% if params[:action] == 'edit' %> - <%= link_to "Cancel", @project, class: "btn btn-secondary" %> - <% else %> - <%= link_to "Cancel", root_path, class: "btn btn-secondary" %> - <% end %> -
+ + <% if params[:action] == 'edit' %> + <%= link_to "Cancel", @project, class: "btn btn-secondary", id: "cancel-btn" %> + <% else %> + <%= link_to "Cancel", root_path, class: "btn btn-secondary", id: "cancel-btn" %> + <% end %>
+ + + +
\ No newline at end of file diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb index b498c997b..b0d259f09 100644 --- a/app/views/projects/edit.html.erb +++ b/app/views/projects/edit.html.erb @@ -1,5 +1,8 @@ -

Editing Project

+
+

Editing Project

+
-<%= form_with url: project_path(@project), method: :put do |form| %> - <%= render "edit_form" %> -<% end %> + <%= form_with url: project_path(@project), method: :put do |form| %> + <%= render "edit_form" %> + <% end %> +
\ No newline at end of file diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 5f0526484..4327bdb74 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -1,5 +1,8 @@ -

New Project Request

+
+

New Project Request

+
-<%= form_with url: projects_path, method: :post do |form| %> - <%= render "edit_form" %> -<% end %> + <%= form_with url: projects_path, method: :post do |form| %> + <%= render "edit_form" %> + <% end %> +
\ No newline at end of file diff --git a/spec/system/project_roles_spec.rb b/spec/system/project_roles_spec.rb index ea43b0faa..157a8d261 100644 --- a/spec/system/project_roles_spec.rb +++ b/spec/system/project_roles_spec.rb @@ -70,7 +70,7 @@ fill_in "project_directory", with: "test_project" fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect(page.find_all("input:invalid").count).to eq(0) expect do click_button("Submit") diff --git a/spec/system/project_spec.rb b/spec/system/project_spec.rb index 156505a8d..e86b2dad8 100644 --- a/spec/system/project_spec.rb +++ b/spec/system/project_spec.rb @@ -190,7 +190,7 @@ select "RDSS", from: "departments" fill_in "project_directory", with: "test_project" fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect do expect(page.find_all("input:invalid").count).to eq(0) click_on "Submit" @@ -236,7 +236,7 @@ click_on "btn-add-rw-user" fill_in "project_directory", with: "test_project" fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect do click_on "Submit" end.not_to have_enqueued_job(ActionMailer::MailDeliveryJob).exactly(1).times @@ -261,7 +261,7 @@ click_on "btn-add-rw-user" fill_in "project_directory", with: "test_project" fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect(page.find("button[value=Submit]")).to be_disabled end end @@ -282,7 +282,7 @@ expect(page.find("#ro-user-uid-to-add").native.attribute("validationMessage")).to eq "Please select a valid value." fill_in "project_directory", with: "test_project" fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect do click_on "Submit" end.not_to have_enqueued_job(ActionMailer::MailDeliveryJob).exactly(1).times @@ -322,7 +322,7 @@ valid = page.find("input#project_directory:invalid") expect(valid).to be_truthy fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect(page).to have_content("New Project") end end @@ -349,7 +349,7 @@ select "RDSS", from: "departments" fill_in "project_directory", with: FFaker::Name.name.tr(" ", "_") fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") expect(page.find_all("input:invalid").count).to eq(0) click_on "Submit" # For some reason the above click on submit sometimes does not submit the form @@ -402,7 +402,7 @@ select "RDSS", from: "departments" fill_in "project_directory", with: FFaker::Name.name.tr(" ", "_") fill_in "title", with: "My test project" - expect(page).to have_content("Project Directory: /td-test-001/") + expect(page).to have_content("/td-test-001/") sleep 1 expect(page.find_all("input:invalid").count).to eq(0) click_on "Submit"