Skip to content

Commit e5eecb2

Browse files
authored
Merge pull request #4671 from marcellamaki/update-snackbar
Update snackbar
2 parents 0a60274 + 6b6c73b commit e5eecb2

10 files changed

Lines changed: 47 additions & 40 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditAudienceModal.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import { ResourcesNeededTypes } from 'shared/constants';
5555
import { constantsTranslationMixin } from 'shared/mixins';
5656
import { hasMultipleFieldValues } from 'shared/utils/helpers';
57+
import commonStrings from 'shared/translator';
5758
5859
export default {
5960
name: 'EditAudienceModal',
@@ -137,19 +138,15 @@
137138
});
138139
})
139140
);
140-
this.$store.dispatch(
141-
'showSnackbarSimple',
142-
this.$tr('editedAudience', { count: this.nodes.length })
143-
);
141+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
142+
this.$store.dispatch('showSnackbarSimple', commonStrings.$tr('changesSaved'));
144143
this.close();
145144
},
146145
},
147146
$trs: {
148147
editAudienceTitle: 'Edit Audience',
149148
saveAction: 'Save',
150149
cancelAction: 'Cancel',
151-
editedAudience:
152-
'Edited audience for {count, number, integer} {count, plural, one {resource} other {resources}}',
153150
resourcesSelected:
154151
'{count, number, integer} {count, plural, one {resource} other {resources}} selected',
155152
forBeginnersCheckbox: 'For beginners',

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditCategoriesModal.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
isDescendantsUpdatable
66
:title="$tr('editCategories')"
77
:nodeIds="nodeIds"
8-
:confirmationMessage="$tr('editedCategories', { count: nodeIds.length })"
8+
:confirmationMessage="changesSaved"
99
@close="() => $emit('close')"
1010
>
1111
<template #input="{ value, inputHandler }">
@@ -26,6 +26,7 @@
2626
2727
import EditBooleanMapModal from './EditBooleanMapModal.vue';
2828
import CategoryOptions from 'shared/views/contentNodeFields/CategoryOptions';
29+
import commonStrings from 'shared/translator';
2930
3031
export default {
3132
name: 'EditCategoriesModal',
@@ -39,14 +40,18 @@
3940
required: true,
4041
},
4142
},
43+
computed: {
44+
changesSaved() {
45+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
46+
return commonStrings.$tr('changesSaved');
47+
},
48+
},
4249
$trs: {
4350
editCategories: 'Edit Categories',
44-
editedCategories:
45-
'Edited categories for {count, number, integer} {count, plural, one {resource} other {resources}}',
4651
},
4752
};
4853
4954
</script>
5055

5156
<style scoped>
52-
</style>
57+
</style>

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditCompletionModal.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import { mapGetters, mapActions } from 'vuex';
2727
import { getFileDuration } from 'shared/utils/helpers';
2828
import CompletionOptions from 'shared/views/contentNodeFields/CompletionOptions';
29+
import commonStrings from 'shared/translator';
2930
3031
export default {
3132
name: 'EditCompletionModal',
@@ -120,8 +121,8 @@
120121
};
121122
122123
this.updateContentNode({ id: this.nodeId, ...payload });
123-
124-
this.$store.dispatch('showSnackbarSimple', this.$tr('editedCompletion', { count: 1 }));
124+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
125+
this.$store.dispatch('showSnackbarSimple', commonStrings.$tr('changesSaved'));
125126
this.close();
126127
},
127128
close() {
@@ -132,8 +133,6 @@
132133
editCompletion: 'Edit Completion',
133134
saveAction: 'Save',
134135
cancelAction: 'Cancel',
135-
editedCompletion:
136-
'Edited completion for {count, number, integer} {count, plural, one {resource} other {resources}}',
137136
},
138137
};
139138

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditLanguageModal.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import { mapGetters, mapActions } from 'vuex';
6161
import { LanguagesList } from 'shared/leUtils/Languages';
6262
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';
63+
import commonStrings from 'shared/translator';
6364
6465
export default {
6566
name: 'EditLanguageModal',
@@ -144,11 +145,8 @@
144145
});
145146
})
146147
);
147-
148-
this.$store.dispatch(
149-
'showSnackbarSimple',
150-
this.$tr('editedLanguage', { count: this.nodes.length })
151-
);
148+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
149+
this.$store.dispatch('showSnackbarSimple', commonStrings.$tr('changesSaved'));
152150
this.close();
153151
},
154152
},
@@ -157,8 +155,6 @@
157155
languageItemText: '{language} ({code})',
158156
saveAction: 'Save',
159157
cancelAction: 'Cancel',
160-
editedLanguage:
161-
'Edited language for {count, number, integer} {count, plural, one {resource} other {resources}}',
162158
selectLanguage: 'Select / Type Language',
163159
resourcesSelected:
164160
'{count, number, integer} {count, plural, one {resource} other {resources}} selected',

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditLearningActivitiesModal.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:title="$tr('editLearningActivitiesTitle')"
77
:nodeIds="nodeIds"
88
:validators="learningActivityValidators"
9-
:confirmationMessage="$tr('editedLearningActivities', { count: nodeIds.length })"
9+
:confirmationMessage="changesSaved"
1010
@close="() => $emit('close')"
1111
>
1212
<template #input="{ value, inputHandler }">
@@ -28,6 +28,7 @@
2828
import EditBooleanMapModal from './EditBooleanMapModal';
2929
import { getLearningActivityValidators } from 'shared/utils/validation';
3030
import LearningActivityOptions from 'shared/views/contentNodeFields/LearningActivityOptions';
31+
import commonStrings from 'shared/translator';
3132
3233
export default {
3334
name: 'EditLearningActivitiesModal',
@@ -45,11 +46,13 @@
4546
learningActivityValidators() {
4647
return getLearningActivityValidators();
4748
},
49+
changesSaved() {
50+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
51+
return commonStrings.$tr('changesSaved');
52+
},
4853
},
4954
$trs: {
5055
editLearningActivitiesTitle: 'Edit Learning Activities',
51-
editedLearningActivities:
52-
'Edited learning activities for {count, number, integer} {count, plural, one {resource} other {resources}}',
5356
},
5457
};
5558

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditLevelsModal.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
isDescendantsUpdatable
66
:title="$tr('editLevelsTitle')"
77
:nodeIds="nodeIds"
8-
:confirmationMessage="$tr('editedLevels', { count: nodeIds.length })"
8+
:confirmationMessage="changesSaved"
99
@close="() => $emit('close')"
1010
>
1111
<template #input="{ value, inputHandler }">
@@ -26,6 +26,7 @@
2626
2727
import EditBooleanMapModal from './EditBooleanMapModal';
2828
import LevelsOptions from 'shared/views/contentNodeFields/LevelsOptions';
29+
import commonStrings from 'shared/translator';
2930
3031
export default {
3132
name: 'EditLevelsModal',
@@ -39,10 +40,14 @@
3940
required: true,
4041
},
4142
},
43+
computed: {
44+
changesSaved() {
45+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
46+
return commonStrings.$tr('changesSaved');
47+
},
48+
},
4249
$trs: {
4350
editLevelsTitle: 'What Levels',
44-
editedLevels:
45-
'Edited levels for {count, number, integer} {count, plural, one {resource} other {resources}}',
4651
},
4752
};
4853

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditResourcesNeededModal.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
isDescendantsUpdatable
66
:title="$tr('editResourcesNeededTitle')"
77
:nodeIds="nodeIds"
8-
:confirmationMessage="$tr('editedResourcesNeeded', { count: nodeIds.length })"
8+
:confirmationMessage="changesSaved"
99
@close="() => $emit('close')"
1010
>
1111
<template #input="{ value, inputHandler }">
@@ -26,6 +26,7 @@
2626
2727
import EditBooleanMapModal from './EditBooleanMapModal';
2828
import ResourcesNeededOptions from 'shared/views/contentNodeFields/ResourcesNeededOptions';
29+
import commonStrings from 'shared/translator';
2930
3031
export default {
3132
name: 'EditResourcesNeededModal',
@@ -39,10 +40,14 @@
3940
required: true,
4041
},
4142
},
43+
computed: {
44+
changesSaved() {
45+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
46+
return commonStrings.$tr('changesSaved');
47+
},
48+
},
4249
$trs: {
4350
editResourcesNeededTitle: 'What will you need?',
44-
editedResourcesNeeded:
45-
"Edited 'what will you need' for {count, number, integer} {count, plural, one {resource} other {resources}}",
4651
},
4752
};
4853

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditSourceModal.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
import HelpTooltip from 'shared/views/HelpTooltip';
104104
import LicenseDropdown from 'shared/views/LicenseDropdown';
105105
import { getCopyrightHolderValidators, getInvalidText } from 'shared/utils/validation';
106+
import commonStrings from 'shared/translator';
106107
107108
function generateGetterSetter(key) {
108109
return {
@@ -256,11 +257,8 @@
256257
return this.updateContentNode(payload);
257258
})
258259
);
259-
260-
this.$store.dispatch(
261-
'showSnackbarSimple',
262-
this.$tr('editedAttribution', { count: nodesToEdit.length })
263-
);
260+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
261+
this.$store.dispatch('showSnackbarSimple', commonStrings.$tr('changesSaved'));
264262
this.close();
265263
},
266264
},
@@ -281,8 +279,6 @@
281279
mixed: 'Mixed',
282280
saveAction: 'Save',
283281
cancelAction: 'Cancel',
284-
editedAttribution:
285-
'Edited attribution for {count, number, integer} {count, plural, one {resource} other {resources}}',
286282
},
287283
};
288284

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditTitleDescriptionModal.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
4040
import { mapActions, mapGetters } from 'vuex';
4141
import { getTitleValidators, getInvalidText } from 'shared/utils/validation';
42+
import commonStrings from 'shared/translator';
4243
4344
export default {
4445
name: 'EditTitleDescriptionModal',
@@ -85,8 +86,8 @@
8586
title: title.trim(),
8687
description: description.trim(),
8788
});
88-
89-
this.$store.dispatch('showSnackbarSimple', this.$tr('editedTitleDescription'));
89+
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
90+
this.$store.dispatch('showSnackbarSimple', commonStrings.$tr('changesSaved'));
9091
this.close();
9192
},
9293
},
@@ -96,7 +97,6 @@
9697
descriptionLabel: 'Description',
9798
saveAction: 'Save',
9899
cancelAction: 'Cancel',
99-
editedTitleDescription: 'Edited title and description',
100100
},
101101
};
102102

contentcuration/contentcuration/frontend/shared/translator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const MESSAGES = {
2525
longActivityLteOneTwenty: 'Value must be equal or less than 120',
2626
activityDurationTooLongWarning:
2727
'This value is very high. Please make sure this is how long learners should work on the resource for, in order to complete it.',
28+
changesSaved: 'Changes saved',
2829
};
2930

3031
export default createTranslator('sharedVue', MESSAGES);

0 commit comments

Comments
 (0)