-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Right now there is no way to see these projects once the DAO is revoked, for now we'll add this view just to have something, we will not link to it in the application.
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 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,11 @@ | ||
class All::DaoRevoked::ProjectsController < ApplicationController | ||
after_action :verify_authorized | ||
rescue_from ActiveRecord::RecordNotFound, with: :not_found_error | ||
|
||
def index | ||
authorize Project, :index? | ||
@pager, @projects = pagy(Project.dao_revoked.includes(:dao_revocation)) | ||
|
||
AcademiesApiPreFetcherService.new.call!(@projects) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<% content_for :primary_navigation do %> | ||
<%= render partial: "shared/navigation/all_projects_primary_navigation" %> | ||
<% end %> | ||
<% content_for :page_title do %> | ||
<%= page_title(t("project.all.dao_revoked.title")) %> | ||
<% end %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full"> | ||
<h1 class="govuk-heading-l"> | ||
<%= t("project.all.dao_revoked.title") %> | ||
</h1> | ||
|
||
<%= render partial: "/projects/shared/dao_revoked_table", locals: {projects: @projects, pager: @pager} %> | ||
</div> | ||
</div> |
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,33 @@ | ||
<% if projects.empty? %> | ||
<%= govuk_inset_text(text: t("project.table.dao_revoked.empty")) %> | ||
<% else %> | ||
<table class="govuk-table" name="projects_table" aria-label="Projects table"> | ||
<thead class="govuk-table__head"> | ||
<tr class="govuk-table__row"> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.school_name") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.school_urn") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.local_authority_name") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.team") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.conversion_date") %></th> | ||
<th class="govuk-table__header" scope="col"><%= t("project.table.headers.dao_date_of_decision") %></th> | ||
</tr> | ||
</thead> | ||
<tbody class="govuk-table__body"> | ||
<% projects.each do |project| %> | ||
<tr class="govuk-table__row"> | ||
<td class="govuk-table__header govuk-table__cell"> | ||
<%= link_to project.establishment.name, project_path(project), class: "govuk-link govuk-link--no-visited-state" %> | ||
</td> | ||
<td class="govuk-table__cell"><%= project.urn %></td> | ||
<td class="govuk-table__cell"><%= project.establishment.local_authority_name %></td> | ||
<td class="govuk-table__cell"><%= t("teams.#{project.team}") %></td> | ||
<td class="govuk-table__cell"><%= project.significant_date.to_formatted_s(:significant_date) %></td> | ||
<td class="govuk-table__cell"><%= project.dao_revocation.date_of_decision.to_fs(:govuk) %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% end %> | ||
<%= govuk_pagination(pagy: pager) %> |
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
19 changes: 19 additions & 0 deletions
19
spec/features/projects/dao_revoked/projects_can_be_viewed_spec.rb
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,19 @@ | ||
require "rails_helper" | ||
|
||
RSpec.feature "DAO projects can be viewed" do | ||
before do | ||
user = create(:user, :caseworker) | ||
sign_in_with_user(user) | ||
mock_all_academies_api_responses | ||
end | ||
|
||
scenario "on the all project dao revoked view" do | ||
dao_project = create(:conversion_project, state: :dao_revoked, directive_academy_order: true) | ||
dao_revocation = create(:dao_revocation, project: dao_project) | ||
|
||
visit all_dao_revoked_projects_path | ||
|
||
expect(page).to have_content "Conversions with a revoked DAO (Directive Academy Order)" | ||
expect(page).to have_content dao_revocation.date_of_decision.to_fs(:govuk) | ||
end | ||
end |