Skip to content

Commit

Permalink
Merge pull request #14870 from opf/bug/53040-tooltip-and-caption-do-n…
Browse files Browse the repository at this point in the history
…ot-match-+-approval-dialog-text-is-ambiguous

[#53040] fixed UI texts in storage view
  • Loading branch information
Kharonus committed Feb 27, 2024
2 parents 80a1133 + 31ccec6 commit 2998170
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
Expand Up @@ -27,11 +27,8 @@
icon: :sync,
scheme: :invisible,
type: :submit,
aria: {
label: I18n.t("storages.buttons.replace_provider_type_oauth",
provider_type: I18n.t("storages.provider_types.#{storage.short_provider_type}.name"))
},
data: { confirm: I18n.t("storages.confirm_replace_oauth_application") },
aria: { label: I18n.t('storages.buttons.replace_oauth_application') },
data: { confirm: I18n.t('storages.confirm_replace_oauth_application') },
test_selector: 'storage-replace-openproject-oauth-application-button'
)
)
Expand Down
Expand Up @@ -42,12 +42,15 @@ def initialize(oauth_client:, storage:, **options)
end

def edit_icon_button_options
label = I18n.t("storages.buttons.replace_oauth_client",
provider_type: I18n.t("storages.provider_types.#{storage.short_provider_type}.name"))

{
icon: oauth_client_configured? ? :sync : :pencil,
tag: :a,
href: url_helpers.new_admin_settings_storage_oauth_client_path(storage),
scheme: :invisible,
aria: { label: I18n.t("storages.label_edit_storage_oauth_client") },
aria: { label: },
data: edit_icon_button_data_options,
test_selector: 'storage-edit-oauth-client-button'
}
Expand All @@ -57,7 +60,10 @@ def edit_icon_button_options

def edit_icon_button_data_options
{}.tap do |data_h|
data_h[:confirm] = I18n.t("storages.confirm_replace_oauth_client") if oauth_client_configured?
if oauth_client_configured?
provider_type = I18n.t("storages.provider_types.#{storage.short_provider_type}.name")
data_h[:confirm] = I18n.t('storages.confirm_replace_oauth_client', provider_type:)
end
data_h[:turbo_stream] = true
end
end
Expand Down
8 changes: 4 additions & 4 deletions modules/storages/config/locales/en.yml
Expand Up @@ -54,7 +54,8 @@ en:
complete_without_setup: Complete without it
done_complete_setup: Done, complete setup
done_continue: Done, continue
replace_provider_type_oauth: Replace %{provider_type} OAuth
replace_oauth_application: Replace OpenProject OAuth
replace_oauth_client: Replace %{provider_type} OAuth
save_and_continue: Save and continue
select_folder: Select folder
configuration_checks:
Expand All @@ -63,8 +64,8 @@ en:
one_drive: Allow OpenProject to access Azure data using OAuth to connect OneDrive/Sharepoint.
redirect_uri_incomplete:
one_drive: Complete the setup with the correct URI redirection.
confirm_replace_oauth_application: Are you sure? All users will have to authorize again against OpenProject.
confirm_replace_oauth_client: Are you sure? All users will have to authorize again against the storage.
confirm_replace_oauth_application: This action will reset the current OAuth credentials. After confirming you will have to reenter the credentials in the client at the storage provider and all remote users will have to authorize against OpenProject again. Are you sure you want to proceed?
confirm_replace_oauth_client: This action will reset the current OAuth credentials. After confirming you will have to enter new credentials from the storage provider and all users will have to authorize against %{provider_type} again. Are you sure you want to proceed?
delete_warning:
input_delete_confirmation: Enter the file storage name %{file_storage} to confirm deletion.
irreversible_notice: Deleting a file storage is an irreversible action.
Expand Down Expand Up @@ -145,7 +146,6 @@ en:
label_edit_storage: Edit storage
label_edit_storage_automatically_managed_folders: Edit storage automatically managed folders
label_edit_storage_host: Edit storage host
label_edit_storage_oauth_client: Edit storage OAuth client
label_existing_manual_folder: Existing folder with manually managed permissions
label_file_storage: File storage
label_host: Host URL
Expand Down
Expand Up @@ -36,10 +36,13 @@
storage = build_stubbed(:nextcloud_storage,
oauth_client: build_stubbed(:oauth_client))
component = described_class.new(storage:, oauth_client: storage.oauth_client)
expect(component.edit_icon_button_options).to include(
icon: :sync,
data: { confirm: "Are you sure? All users will have to authorize again against the storage.", turbo_stream: true }
)
expect(component.edit_icon_button_options)
.to include(icon: :sync,
data: { confirm:
"This action will reset the current OAuth credentials. After confirming you will " \
"have to enter new credentials from the storage provider and all users will have " \
"to authorize against Nextcloud again. Are you sure you want to proceed?",
turbo_stream: true })
end
end

Expand Down

0 comments on commit 2998170

Please sign in to comment.