Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[review-adjustment]Adjust the documentation link according to review #611

Merged
merged 1 commit into from
Mar 26, 2024
Merged
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
4 changes: 1 addition & 3 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div id="openproject_prefs" class="section">
<TermsOfServiceUnsigned :is-all-terms-of-service-signed-for-user-open-project="isAllTermsOfServiceSignedForUserOpenProject" />
<SettingsTitle :show-integration-setup-link-information="showIntegrationSetupLinkInformation" is-setting="admin" />
<SettingsTitle is-setting="admin" />
<div class="openproject-server-host">
<FormHeading index="1"
:title="t('integration_openproject', 'OpenProject server')"
Expand Down Expand Up @@ -434,7 +434,6 @@ export default {
isFormStep: null,
isDarkTheme: null,
isAllTermsOfServiceSignedForUserOpenProject: true,
showIntegrationSetupLinkInformation: true,
userSettingDescription: USER_SETTINGS,
}
},
Expand Down Expand Up @@ -583,7 +582,6 @@ export default {
}
if (this.state.openproject_instance_url && this.state.openproject_client_id && this.state.openproject_client_secret && this.state.nc_oauth_client) {
this.showDefaultManagedProjectFolders = true
this.showIntegrationSetupLinkInformation = false
}
if (this.state.openproject_instance_url) {
this.formMode.server = F_MODES.VIEW
Expand Down
2 changes: 1 addition & 1 deletion src/components/PersonalSettings.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="openproject-prefs section">
<SettingsTitle :is-connected-with-openproject="!!connected" is-setting="personal" />
<SettingsTitle is-setting="personal" />
<div v-if="connected" class="openproject-prefs--connected">
<label>
<CheckIcon :size="20" />
Expand Down
17 changes: 5 additions & 12 deletions src/components/settings/SettingsTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ export default {
type: String,
required: true,
},
isConnectedWithOpenproject: {
type: Boolean,
required: false,
},
showIntegrationSetupLinkInformation: {
type: Boolean,
required: false,
},
},
computed: {
title() {
Expand All @@ -42,14 +34,14 @@ export default {
return t('integration_openproject', 'Visit our documentation for in-depth information on {htmlLink} integration.', { htmlLink }, null, { escape: false, sanitize: false })
},
getUserGuideDocumentationLinkText() {
const linkText = t('integration_openproject', 'Nextcloud integration user guide')
const linkText = t('integration_openproject', 'user guide')
const htmlLink = `<a class="link" href="https://www.openproject.org/docs/user-guide/file-management/nextcloud-integration/" target="_blank" title="${linkText}">${linkText}</a>`
return t('integration_openproject', 'Please go to our {htmlLink} to learn more about how to work with the OpenProject integration.', { htmlLink }, null, { escape: false, sanitize: false })
return t('integration_openproject', 'Learn how to get the most out of the OpenProject integration by visiting our {htmlLink}.', { htmlLink }, null, { escape: false, sanitize: false })
},
sanitizedHintText() {
if (this.isSetting === 'admin' && this.showIntegrationSetupLinkInformation) {
if (this.isSetting === 'admin') {
return dompurify.sanitize(this.getSetUpIntegrationDocumentationLinkText, { ADD_ATTR: ['target'] })
} else if (this.isSetting === 'personal' && this.isConnectedWithOpenproject) {
} else if (this.isSetting === 'personal') {
return dompurify.sanitize(this.getUserGuideDocumentationLinkText, { ADD_ATTR: ['target'] })
}
return ''
Expand Down Expand Up @@ -80,6 +72,7 @@ export default {

.settings .link {
color: #1a67a3 !important;
font-style: normal;
}

</style>
4 changes: 2 additions & 2 deletions tests/jest/components/AdminSettings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ describe('AdminSettings.vue', () => {
expect(setupIntegrationDocumentationLink.text()).toBe('Visit our documentation for in-depth information on {htmlLink} integration.')
})

it('should not be visible when integration is completed', () => {
it('should be visible when integration is completed', () => {
const wrapper = getMountedWrapper({ state: completeIntegrationState })
const setupIntegrationDocumentationLink = wrapper.find(selectors.setupIntegrationDocumentationLinkSelector)
expect(setupIntegrationDocumentationLink.text()).toBe('')
expect(setupIntegrationDocumentationLink.text()).toBe('Visit our documentation for in-depth information on {htmlLink} integration.')
})
})

Expand Down
6 changes: 3 additions & 3 deletions tests/jest/components/PersonalSettings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ describe('PersonalSettings.vue', () => {
it('oAuth disconnect button is not displayed', () => {
expect(wrapper.find(oAuthDisconnectButtonSelector).exists()).toBeFalsy()
})
it('should show not show user guide documentation link', () => {
it('should show show user guide documentation link', () => {
const wrapper = getMountedWrapper({ state: { admin_config_ok: true, cases } })
const userGuideIntegrationDocumentationLink = wrapper.find(userGuideIntegrationDocumentationLinkSelector)
expect(userGuideIntegrationDocumentationLink.text()).toBe('')
expect(userGuideIntegrationDocumentationLink.text()).toBe('Learn how to get the most out of the OpenProject integration by visiting our {htmlLink}.')
})
})
describe('when username and token are given', () => {
Expand All @@ -100,7 +100,7 @@ describe('PersonalSettings.vue', () => {
it('should show not show user guide documentation link', () => {
const wrapper = getMountedWrapper({ state: { user_name: 'test', token: '123', admin_config_ok: true } })
const userGuideIntegrationDocumentationLink = wrapper.find(userGuideIntegrationDocumentationLinkSelector)
expect(userGuideIntegrationDocumentationLink.text()).toBe('Please go to our {htmlLink} to learn more about how to work with the OpenProject integration.')
expect(userGuideIntegrationDocumentationLink.text()).toBe('Learn how to get the most out of the OpenProject integration by visiting our {htmlLink}.')
})
})

Expand Down
Loading