Skip to content

Commit

Permalink
Status highlight displays based on project status (#719)
Browse files Browse the repository at this point in the history
* Status highlight displays based on project status
Refactoring the status highlight to display based on the projects current status, instead of whether or not it is in mediaflux.

* adding explicit test for the type of alert that should be displayed
  • Loading branch information
JaymeeH authored May 15, 2024
1 parent d2be621 commit 727a739
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def show
@provenance_events = project.provenance_events.where.not(event_type: ProvenanceEvent::STATUS_UPDATE_EVENT_TYPE)
@project_status = project.metadata[:status]

@pending_status = Project::PENDING_STATUS
@approved_status = Project::APPROVED_STATUS
@eligible_editor = eligible_editor?
@project_eligible_to_edit = true if @project_status == @approved_status && eligible_editor?
Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Project Details:
</div>
<% end %>

<% if !@project.in_mediaflux? %>
<% if @project.status == @pending_status %>
<div class="alert alert-warning" role="alert">
<dl>
<dt>Status</dt> <dd><%=@project_status%></dd>
Expand Down
3 changes: 3 additions & 0 deletions spec/system/project_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

expect(page).to have_content(project_in_mediaflux.title)
expect(page).not_to have_content(pending_text)
expect(page).to have_css ".alert-success"
expect(page).to have_selector(:link_or_button, "Edit") # button next to role and description heading
expect(page).to have_selector(:link_or_button, "Review Contents")
expect(page).to have_selector(:link_or_button, "Withdraw Project Request")
Expand Down Expand Up @@ -73,6 +74,7 @@
visit "/projects/#{project_not_in_mediaflux.id}"
expect(page).to have_content(project_not_in_mediaflux.title)
expect(page).to have_content(pending_text)
expect(page).to have_css ".alert-warning"
expect(page).not_to have_link("Edit")
expect(page).to have_selector(:link_or_button, "Review Contents")
click_on("Return to Dashboard")
Expand All @@ -87,6 +89,7 @@
visit "/projects/#{project_not_in_mediaflux.id}"
expect(page).to have_content(project_not_in_mediaflux.title)
expect(page).to have_content(pending_text)
expect(page).to have_css ".alert-warning"
expect(page).not_to have_link("Edit")
expect(page).to have_selector(:link_or_button, "Approve Project")
expect(page).to have_selector(:link_or_button, "Deny Project")
Expand Down

0 comments on commit 727a739

Please sign in to comment.