docbrown/app/helpers/admin/organizations_helper.rb
Ridhwana 272aea6127
Allow admins to delete an organization (#19699)
* feat: update the layout for organizations

* feat: update the layout for an organization

* feat: organization logos are square

* feat: change the text on the org visit button

* feat: initialize the dropdown menu

* feat: trigger the  modal

* feat: update the text in the model

* feat: tweak wording

* WIP/feat: hook up a route with an action that calls an organization delete worker.

* feat: redirect after showing the notice

* feat: update the authorization required to be super admin

* feat: add the notice to localization

* spec: integration test

* spec: fix

* spec: delete worker

* chore: update the link

* feat: add safe navigation

* feat: make sure that we show an error if the organization has credits

* fix: error message for modal unspent credits

* feat add the spec for the helper

* fix: remove rspec preface

* fix: small fixes to tests and I18n

* fix: updated the number of orgs

* feat: update the message

* feat: update the message

* chore: remove inclusion of helper

* feat: change the name of the parameter

* chore: newline
2023-07-17 12:09:24 +02:00

16 lines
455 B
Ruby

module Admin
module OrganizationsHelper
def deletion_modal_error_message(organization)
error_message = nil
unless current_user.super_admin?
error_message = I18n.t("views.admin.organizations.delete.role_notice")
end
if organization.credits.length.positive?
error_message = "#{error_message} #{I18n.t('views.admin.organizations.delete.credits_notice')}"
end
error_message&.strip
end
end
end