|
17 | 17 | /> |
18 | 18 | </span> |
19 | 19 |
|
20 | | - <h2>{{ $tr('organizationDetails') }}</h2> |
| 20 | + <h2>{{ organizationStrings.organizationDetails$() }}</h2> |
21 | 21 |
|
22 | 22 | <p |
23 | 23 | v-if="!isAdmin" |
24 | 24 | class="view-only-notice" |
25 | 25 | > |
26 | | - {{ $tr('viewOnlyNotice') }} |
| 26 | + {{ organizationStrings.adminAccessRequiredForEdits$() }} |
27 | 27 | </p> |
28 | 28 |
|
29 | 29 | <KTextbox |
30 | 30 | v-model="name" |
31 | 31 | data-test="name-input" |
32 | | - :label="$tr('nameLabel')" |
| 32 | + :label="organizationStrings.nameLabel$()" |
33 | 33 | :maxlength="200" |
34 | 34 | :disabled="!isAdmin" |
35 | 35 | :invalid="Boolean(nameError)" |
|
42 | 42 | v-model="description" |
43 | 43 | data-test="description-input" |
44 | 44 | textArea |
45 | | - :label="$tr('descriptionLabel')" |
| 45 | + :label="organizationStrings.descriptionLabel$()" |
46 | 46 | :disabled="!isAdmin" |
47 | 47 | style="margin-top: 16px" |
48 | 48 | /> |
49 | 49 |
|
50 | | - <KCheckbox |
51 | | - :checked="isPublic" |
52 | | - :label="$tr('publicLabel')" |
53 | | - :description="$tr('publicDescription')" |
54 | | - :disabled="!isAdmin" |
55 | | - style="margin-top: 16px" |
56 | | - @change="value => (isPublic = value)" |
57 | | - /> |
58 | | - |
59 | 50 | <KButton |
60 | 51 | v-if="isAdmin" |
61 | 52 | appearance="raised-button" |
62 | 53 | primary |
63 | 54 | class="save-button" |
64 | | - :text="isNew ? $tr('createOrganization') : $tr('saveChanges')" |
| 55 | + :text="isNew ? organizationStrings.createOrganization$() : organizationStrings.saveChanges$()" |
65 | 56 | :disabled="saving" |
66 | 57 | @click="submit" |
67 | 58 | /> |
|
74 | 65 | <script> |
75 | 66 |
|
76 | 67 | import { getApiErrorMessage } from '../../utils'; |
| 68 | + import { organizationStrings } from 'shared/strings/organizationStrings'; |
77 | 69 | import useSnackbar from 'shared/composables/useSnackbar'; |
78 | 70 |
|
79 | 71 | export default { |
80 | 72 | name: 'OrganizationDetailsTab', |
81 | 73 | setup() { |
82 | 74 | const { createSnackbar } = useSnackbar(); |
83 | | - return { createSnackbar }; |
| 75 | + return { createSnackbar, organizationStrings }; |
84 | 76 | }, |
85 | 77 | props: { |
86 | 78 | organization: { |
|
108 | 100 | return { |
109 | 101 | name: '', |
110 | 102 | description: '', |
111 | | - isPublic: false, |
112 | 103 | nameError: '', |
113 | 104 | saving: false, |
114 | 105 | }; |
|
120 | 111 | if (organization) { |
121 | 112 | this.name = organization.name || ''; |
122 | 113 | this.description = organization.description || ''; |
123 | | - this.isPublic = Boolean(organization.public); |
124 | 114 | } |
125 | 115 | }, |
126 | 116 | }, |
127 | 117 | }, |
128 | 118 | methods: { |
129 | 119 | submit() { |
130 | 120 | if (!this.name.trim()) { |
131 | | - this.nameError = this.$tr('nameRequired'); |
| 121 | + this.nameError = organizationStrings.nameRequired$(); |
132 | 122 | return; |
133 | 123 | } |
134 | 124 | this.saving = true; |
135 | 125 | this.save({ |
136 | 126 | name: this.name.trim(), |
137 | 127 | description: this.description.trim(), |
138 | | - public: this.isPublic, |
139 | 128 | }) |
140 | 129 | .then(organization => { |
141 | 130 | if (this.isNew) { |
142 | | - this.createSnackbar(this.$tr('organizationCreated')); |
| 131 | + this.createSnackbar(organizationStrings.organizationCreated$()); |
143 | 132 | this.$emit('created', organization.id); |
144 | 133 | } else { |
145 | | - this.createSnackbar(this.$tr('changesSaved')); |
| 134 | + this.createSnackbar(organizationStrings.changesSaved$()); |
146 | 135 | } |
147 | 136 | }) |
148 | 137 | .catch(error => { |
149 | | - this.createSnackbar(getApiErrorMessage(error, this.$tr('saveError'))); |
| 138 | + this.createSnackbar(getApiErrorMessage(error, organizationStrings.saveError$())); |
150 | 139 | }) |
151 | 140 | .finally(() => { |
152 | 141 | this.saving = false; |
153 | 142 | }); |
154 | 143 | }, |
155 | 144 | }, |
156 | | - $trs: { |
157 | | - organizationDetails: 'Organization details', |
158 | | - nameLabel: 'Organization name', |
159 | | - descriptionLabel: 'Organization description', |
160 | | - nameRequired: 'Organization name is required', |
161 | | - viewOnlyNotice: 'Only organization admins can edit these details.', |
162 | | - publicLabel: 'Public', |
163 | | - publicDescription: 'If this organization can be seen by users outside the organization', |
164 | | - saveChanges: 'Save changes', |
165 | | - createOrganization: 'Create organization', |
166 | | - changesSaved: 'Changes saved', |
167 | | - organizationCreated: 'Organization created', |
168 | | - saveError: 'Unable to save these changes', |
169 | | - }, |
170 | 145 | }; |
171 | 146 |
|
172 | 147 | </script> |
|
0 commit comments