Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions app/controllers/mou_signatures_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
class MouSignaturesController < WebController
before_action :set_agreement_type, except: %i[index]
after_action :verify_authorized, only: %i[index]

def index
authorize MouSignature, :can_manage_mous?
@mou_signatures = MouSignature.all
render template: "mou_signatures/index", locals: { mou_signatures: @mou_signatures }
end
before_action :set_agreement_type

def show
@mou_signature = current_user.current_organisation_mou_signature
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/sitemap_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ def index
render locals: { active_groups:,
trial_groups:,
should_show_users_link: should_show_users?,
should_show_mous_link: should_show_mous_link?,
should_show_organisations_link: should_show_organisations_link?,
should_show_reports_link: should_show_reports_link? }
end

def should_show_users?
Pundit.policy(current_user, :user).can_manage_user?
end

def should_show_mous_link?
Pundit.policy(current_user, :mou_signature).can_manage_mous?
def should_show_organisations_link?
Pundit.policy(current_user, :organisation).can_view_organisations?
end

def should_show_reports_link?
Expand Down
4 changes: 2 additions & 2 deletions app/input_objects/organisations/filter_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def sort_options
def agreement_type_options
[
OpenStruct.new(label: I18n.t("organisations.index.filter.agreement_type.any")),
OpenStruct.new(label: I18n.t("mou_signatures.index.agreement_type.crown"), value: "crown"),
OpenStruct.new(label: I18n.t("mou_signatures.index.agreement_type.non_crown"), value: "non_crown"),
OpenStruct.new(label: I18n.t("mou_signatures.agreement_type.crown"), value: "crown"),
OpenStruct.new(label: I18n.t("mou_signatures.agreement_type.non_crown"), value: "non_crown"),
OpenStruct.new(label: I18n.t("organisations.index.filter.agreement_type.signed"), value: "signed"),
OpenStruct.new(label: I18n.t("organisations.index.filter.agreement_type.none"), value: "none"),
]
Expand Down
5 changes: 0 additions & 5 deletions app/policies/mou_signature_policy.rb

This file was deleted.

11 changes: 0 additions & 11 deletions app/services/navigation_items_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def navigation_items

navigation_items = [
your_groups_navigation_item,
mou_navigation_item,
users_navigation_item,
organisations_navigation_item,
reports_navigation_item,
Expand All @@ -42,12 +41,6 @@ def your_groups_navigation_item
NavigationItem.new(text: I18n.t("header.your_groups"), href: "/", active: false)
end

def mou_navigation_item
return nil unless should_show_mous_link?

NavigationItem.new(text: I18n.t("header.mous"), href: mou_signatures_path, active: false)
end

def users_navigation_item
return nil unless should_show_user_profile_link?

Expand Down Expand Up @@ -96,10 +89,6 @@ def should_show_user_profile_link?
Pundit.policy(user, :user).can_manage_user?
end

def should_show_mous_link?
Pundit.policy(user, :mou_signature).can_manage_mous?
end

def should_show_organisations_link?
Pundit.policy(user, :organisation).can_view_organisations?
end
Expand Down
42 changes: 0 additions & 42 deletions app/views/mou_signatures/index.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/organisations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
row.with_cell(text: @form_counts.fetch(organisation.id, 0).to_s, numeric: true)
agreement_types = @agreement_types.fetch(organisation.id, [])
if agreement_types.any?
row.with_cell(text: agreement_types.map { |agreement_type| t("mou_signatures.index.agreement_type.#{agreement_type}") }.join(", "))
row.with_cell(text: agreement_types.map { |agreement_type| t("mou_signatures.agreement_type.#{agreement_type}") }.join(", "))
else
row.with_cell(text: t("organisations.index.agreement_type_none"))
end
Expand Down
16 changes: 8 additions & 8 deletions app/views/organisations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@
<%= govuk_table do |table| %>
<%= table.with_head do |head|
head.with_row do |row|
row.with_cell(header: true, text: t("mou_signatures.index.table_headings.agreement_type"))
row.with_cell(header: true, text: t("mou_signatures.index.table_headings.name"))
row.with_cell(header: true, text: t("mou_signatures.index.table_headings.email"))
row.with_cell(header: true, text: t("mou_signatures.index.table_headings.agreed_at"))
row.with_cell(header: true, text: t("organisations.show.mou_signatures.table_headings.agreement_type"))
row.with_cell(header: true, text: t("organisations.show.mou_signatures.table_headings.name"))
row.with_cell(header: true, text: t("organisations.show.mou_signatures.table_headings.email"))
row.with_cell(header: true, text: t("organisations.show.mou_signatures.table_headings.agreed_at"))
end
end %>

<%= table.with_body do |body|
@organisation.mou_signatures.each do |mou_signature|
body.with_row do |row|
row.with_cell(text: t("mou_signatures.index.agreement_type.#{mou_signature.agreement_type}"))
row.with_cell(text: t("mou_signatures.agreement_type.#{mou_signature.agreement_type}"))
row.with_cell(text: mou_signature.user.name.presence || t("users.index.name_blank"))
row.with_cell do
govuk_link_to(mou_signature.user.email, edit_user_path(mou_signature.user))
Expand All @@ -88,11 +88,11 @@
<% else %>
<p class="govuk-body"><%= t("organisations.show.mou_signatures.none") %></p>

<%= t("mou_signatures.index.preamble_html") %>
<%= t("organisations.show.mou_signatures.preamble_html") %>

<%= t("mou_signatures.index.share_mou_link_html", mou_link: link_to(mou_signature_url, mou_signature_url)) %>
<%= t("organisations.show.mou_signatures.share_mou_link_html", mou_link: link_to(mou_signature_url, mou_signature_url)) %>

<%= t("mou_signatures.index.share_non_crown_agreement_link_html", agreement_link: link_to(non_crown_agreement_signature_url, non_crown_agreement_signature_url)) %>
<%= t("organisations.show.mou_signatures.share_non_crown_agreement_link_html", agreement_link: link_to(non_crown_agreement_signature_url, non_crown_agreement_signature_url)) %>
<% end %>

<h2 class="govuk-heading-m"><%= t("organisations.show.domains.heading") %></h2>
Expand Down
4 changes: 2 additions & 2 deletions app/views/sitemap/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</ul>
<% end %>

<% if should_show_mous_link %>
<h2 class="govuk-heading-m"><%= link_to t("page_titles.mou_signatures"), mou_signatures_path %></h2>
<% if should_show_organisations_link %>
<h2 class="govuk-heading-m"><%= link_to t("page_titles.organisations"), organisations_path %></h2>
<ul class="govuk-list govuk-list--spaced">
<li><%= link_to t("page_titles.mou_signature_new"), mou_signature_url %></li>
</ul>
Expand Down
27 changes: 11 additions & 16 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ en:
Guidance will be displayed at the top of the page, above your question.
</p>
header:
mous: MOUs
organisations: Organisations
product_name: Forms
reports: Reports
Expand Down Expand Up @@ -1427,6 +1426,9 @@ en:
heading_without_dates: Form metrics
percentage: "%{number}%"
mou_signatures:
agreement_type:
crown: Crown MOU
non_crown: Non-crown agreement
confirmation:
crown:
body_html: |
Expand All @@ -1436,20 +1438,6 @@ en:
body_html: |
<h2 class="govuk-heading-m">What happens next</h2>
<p>We’ll email you with any updates to the agreement that are made in the future.</p>
index:
agreement_type:
crown: Crown MOU
non_crown: Non-crown agreement
preamble_html: "<p>Someone from each organisation needs to agree to one of the GOV.UK Forms agreements before an organisation admin can be assigned or any groups upgraded to ‘active’.</p>\n"
share_mou_link_html: "<p>For Crown organisations, like government departments and executive agencies, share the Memorandum of Understanding:<br />%{mou_link}</p>\n"
share_non_crown_agreement_link_html: "<p>For non-crown organisations, like local authorities, share the GOV.UK Forms agreement:<br />%{agreement_link}</p>\n"
table_caption: Agreed MOUs and agreements
table_headings:
agreed_at: Agreed on
agreement_type: Agreement type
email: Email address
name: Name
organisation: Organisation
show:
crown:
banner:
Expand Down Expand Up @@ -1512,6 +1500,14 @@ en:
mou_signatures:
heading: MOUs and agreements
none: No one has agreed an MOU or agreement for this organisation.
preamble_html: "<p>Someone from each organisation needs to agree to one of the GOV.UK Forms agreements before an organisation admin can be assigned or any groups upgraded to ‘active’.</p>\n"
share_mou_link_html: "<p>For Crown organisations, like government departments and executive agencies, share the Memorandum of Understanding:<br />%{mou_link}</p>\n"
share_non_crown_agreement_link_html: "<p>For non-crown organisations, like local authorities, share the GOV.UK Forms agreement:<br />%{agreement_link}</p>\n"
table_headings:
agreed_at: Agreed on
agreement_type: Agreement type
email: Email address
name: Name
not_set: Not set
summary:
closed: Closed
Expand Down Expand Up @@ -1655,7 +1651,6 @@ en:
missing_draft_question: There’s a problem with this page
mou_signature_confirmation: You’ve agreed to the MOU
mou_signature_new: GOV.UK Forms Memorandum of Understanding
mou_signatures: MOUs and agreements
move_form: Move this form to a different group
name_settings: Ask for a person’s name
new_group: Give your group a name
Expand Down
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@
resource :contact_for_research, controller: :contact_for_research, only: %i[edit update]
end

resources :mou_signatures, only: %i[index], path: "mous"

resources :organisations, only: %i[index show]

resource :mou_signature, only: %i[new show create], path: "/memorandum-of-understanding", defaults: { agreement_type: :crown }, as: :mou_signature do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def with_navigation_links
def with_super_admin_navigation_links
render(ServiceNavigationComponent::View.new(navigation_items: [
{ text: "Your groups", href: "/" },
{ text: "MOUs", href: "/mous" },
{ text: "Users", href: "/users" },
{ text: "Organisations", href: "/organisations" },
{ text: "Reports", href: "/reports" },
{ text: "Support", href: "/support" },
{ text: "A User", href: nil, classes: ["app-service-navigation__item--featured"] },
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/models/groups.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FactoryBot.define do
factory :group do
sequence(:name) { |n| "Group #{n}" }
organisation { association :organisation, id: 1, slug: "test-org" }
organisation { association :organisation, slug: "test-org" }
creator { association :user, organisation: }
status { :trial }
external_id { SecureRandom.base58(8) }

trait :org_has_org_admin do
organisation { association :organisation, :with_org_admin, id: 1, slug: "test-org" }
organisation { association :organisation, :with_org_admin, slug: "test-org" }
end
end
end
2 changes: 1 addition & 1 deletion spec/factories/models/memberships.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FactoryBot.define do
factory :membership do
user
group
group { association :group, organisation: user&.organisation }
added_by { association :user }
role { :editor }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/models/organisation_domains.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :organisation_domain do
organisation { association :organisation, id: 1, slug: "test-org" }
organisation { association :organisation, slug: "test-org" }
domain { Faker::Internet.domain_name }
end
end
4 changes: 2 additions & 2 deletions spec/factories/models/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
org_has_signed_mou
end

organisation { association :organisation, id: 1, slug: "test-org" }
organisation { association :organisation, slug: "test-org" }

trait :org_has_signed_mou do
organisation { association :organisation, :with_signed_mou, id: 1, slug: "test-org" }
organisation { association :organisation, :with_signed_mou, slug: "test-org" }
end

after(:build) do |user|
Expand Down
2 changes: 1 addition & 1 deletion spec/features/form/super_admin_view_forms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

feature "View forms", type: :feature do
let(:org_forms) { [build(:form, id: 1, name: "Org form")] }
let(:other_org) { create :organisation, id: 2, slug: "Other org" }
let(:other_org) { create :organisation, slug: "Other org" }
let(:other_org_user) { create :user, organisation: other_org }
let(:other_org_forms) { [build(:form, id: 2, name: "Other org form")] }
let(:other_org_group) { create :group, organisation_id: other_org.id }
Expand Down
50 changes: 0 additions & 50 deletions spec/features/mou/upgrade_user_changes_mou_spec.rb

This file was deleted.

Loading