diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/AddRelatedResourcesModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/AddRelatedResourcesModal.vue index 1a7e4e09cf..08287a03cd 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/AddRelatedResourcesModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/AddRelatedResourcesModal.vue @@ -1,39 +1,23 @@ - + @@ -126,6 +111,7 @@ import NodeTreeNavigation from './NodeTreeNavigation'; import ResourceDrawer from './ResourceDrawer'; import ContentNodeIcon from 'shared/views/ContentNodeIcon'; + import FullscreenModal from 'shared/views/FullscreenModal'; export default { name: 'AddRelatedResourcesModal', @@ -133,6 +119,7 @@ ContentNodeIcon, NodeTreeNavigation, ResourceDrawer, + FullscreenModal, }, props: { targetNodeId: { diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue index b4095b4e47..6d4adb81d6 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue @@ -20,14 +20,12 @@ app > - close + arrow_back {{ modalTitle }} - - {{ $tr('saveButtonText') }} - - + + {{ $tr('copyButtonText', { count: nodes.length, size: formatFileSize(totalFileSize)}) }} @@ -182,6 +180,7 @@ import Uploader from 'shared/views/files/Uploader'; import LoadingText from 'shared/views/LoadingText'; import FormatPresets from 'shared/leUtils/FormatPresets'; + import OfflineText from 'shared/views/OfflineText'; export default { name: 'EditModal', @@ -195,6 +194,7 @@ FileUploadDefault, LoadingText, MessageDialog, + OfflineText, }, mixins: [fileSizeMixin], props: { @@ -283,7 +283,7 @@ vm.loadContentNodes({ id__in: ids }), vm.loadFiles({ contentnode__in: ids }), ...ids.map(nodeId => vm.loadRelatedResources(nodeId)), - ...ids.map(nodeId => vm.loadNodeAssessmentItems(nodeId)), + vm.loadAssessmentItems({ contentnode__in: ids }), ]) .then(() => { vm.loading = false; @@ -313,7 +313,7 @@ 'createContentNode', ]), ...mapActions('file', ['loadFiles', 'createFile']), - ...mapActions('assessmentItem', ['loadNodeAssessmentItems']), + ...mapActions('assessmentItem', ['loadAssessmentItems']), ...mapActions('clipboard', ['copyAll']), ...mapMutations('contentNode', { enableValidation: 'ENABLE_VALIDATION_ON_NODES' }), closeModal() { @@ -412,7 +412,6 @@ $trs: { editingDetailsHeader: 'Editing Content Details', viewingDetailsHeader: 'Viewing Content Details', - saveButtonText: 'Finish', copyButtonText: '{count, plural,\n =1 {Copy to clipboard}\n other {Copy # items to clipboard}} ({size})', invalidNodesFound: '{count, plural,\n =1 {# error found}\n other {# errors found}}', diff --git a/contentcuration/contentcuration/frontend/channelEdit/move/MoveModal.vue b/contentcuration/contentcuration/frontend/channelEdit/move/MoveModal.vue index 373e503fa9..4ac72fd005 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/move/MoveModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/move/MoveModal.vue @@ -1,179 +1,142 @@ + + + diff --git a/contentcuration/contentcuration/frontend/shared/views/OfflineText.vue b/contentcuration/contentcuration/frontend/shared/views/OfflineText.vue new file mode 100644 index 0000000000..aa5926afc0 --- /dev/null +++ b/contentcuration/contentcuration/frontend/shared/views/OfflineText.vue @@ -0,0 +1,88 @@ + + + + diff --git a/contentcuration/contentcuration/frontend/shared/views/__tests__/offlineText.spec.js b/contentcuration/contentcuration/frontend/shared/views/__tests__/offlineText.spec.js new file mode 100644 index 0000000000..7fa0046ae1 --- /dev/null +++ b/contentcuration/contentcuration/frontend/shared/views/__tests__/offlineText.spec.js @@ -0,0 +1,25 @@ +import { mount } from '@vue/test-utils'; +import OfflineText from '../OfflineText'; +import storeFactory from 'shared/vuex/baseStore'; + +const store = storeFactory(); +function makeWrapper() { + return mount(OfflineText, { + store, + }); +} + +describe('offlineText', () => { + let wrapper; + beforeEach(() => { + wrapper = makeWrapper(); + }); + it('should show if connection is offline', () => { + store.state.connection.online = false; + expect(wrapper.find('[data-test="text"]').exists()).toBe(true); + }); + it('should be hidden if connection is online', () => { + store.state.connection.online = true; + expect(wrapper.find('[data-test="text"]').exists()).toBe(false); + }); +}); diff --git a/contentcuration/contentcuration/frontend/shared/views/channel/ChannelDetailsModal.vue b/contentcuration/contentcuration/frontend/shared/views/channel/ChannelDetailsModal.vue index d4b68d4679..6f34c7f304 100644 --- a/contentcuration/contentcuration/frontend/shared/views/channel/ChannelDetailsModal.vue +++ b/contentcuration/contentcuration/frontend/shared/views/channel/ChannelDetailsModal.vue @@ -1,59 +1,42 @@ @@ -64,12 +47,14 @@ import Details from 'shared/views/details/Details'; import { fileSizeMixin, constantsTranslationMixin, routerMixin } from 'shared/mixins'; import LoadingText from 'shared/views/LoadingText'; + import FullscreenModal from 'shared/views/FullscreenModal'; export default { name: 'ChannelDetailsModal', components: { Details, LoadingText, + FullscreenModal, }, mixins: [fileSizeMixin, constantsTranslationMixin, routerMixin, channelExportMixin], props: { @@ -86,6 +71,16 @@ }, computed: { ...mapGetters('channel', ['getChannel']), + dialog: { + get() { + return this.channelId && this.routeParamID === this.channelId; + }, + set(value) { + if (!value) { + this.$router.push(this.backLink); + } + }, + }, channel() { return this.getChannel(this.channelId); }, @@ -109,11 +104,6 @@ return this.$route.params.channelId; }, }, - watch: { - routeParamID(val) { - this.hideHTMLScroll(!!val); - }, - }, beforeRouteEnter(to, from, next) { next(vm => { if (vm.channel) { @@ -124,7 +114,6 @@ }, mounted() { this.load(); - this.hideHTMLScroll(true); }, methods: { ...mapActions('channel', ['loadChannel', 'loadChannelDetails']), @@ -156,11 +145,6 @@ this.loadError = true; }); }, - hideHTMLScroll(hidden) { - document.querySelector('html').style = hidden - ? 'overflow-y: hidden !important;' - : 'overflow-y: auto !important'; - }, }, $trs: { downloadButton: 'Download channel summary', @@ -184,13 +168,6 @@ color: gray; } - .channel-wrapper { - overflow-y: auto; - .v-card__text { - padding-top: 72px; - } - } - .channel-details-wrapper { max-width: 900px; padding-bottom: 100px; diff --git a/contentcuration/contentcuration/frontend/shared/views/channel/ChannelModal.vue b/contentcuration/contentcuration/frontend/shared/views/channel/ChannelModal.vue index 0c00e83e9a..78104167e3 100644 --- a/contentcuration/contentcuration/frontend/shared/views/channel/ChannelModal.vue +++ b/contentcuration/contentcuration/frontend/shared/views/channel/ChannelModal.vue @@ -1,125 +1,90 @@ @@ -134,6 +99,7 @@ import MessageDialog from 'shared/views/MessageDialog'; import LanguageDropdown from 'shared/views/LanguageDropdown'; import ContentDefaults from 'shared/views/form/ContentDefaults'; + import FullscreenModal from 'shared/views/FullscreenModal'; export default { name: 'ChannelModal', @@ -143,6 +109,7 @@ ChannelThumbnail, ChannelSharing, MessageDialog, + FullscreenModal, }, props: { channelId: { @@ -170,9 +137,21 @@ routeParamID() { return this.$route.params.channelId; }, + dialog: { + get() { + return this.channelId && this.routeParamID === this.channelId; + }, + set(value) { + if (!value) { + this.cancelChanges(); + } + }, + }, currentTab: { get() { - return this.$route.query.sharing ? 'share' : 'edit'; + const sharing = this.$route.query.sharing; + // On load, sharing counts as string, so just process as if a string + return sharing && sharing.toString() === 'true' ? 'share' : 'edit'; }, set(value) { this.$router.replace({ @@ -233,18 +212,12 @@ }, }, }, - watch: { - routeParamID(val) { - this.hideHTMLScroll(!!val); - }, - }, beforeRouteEnter(to, from, next) { next(vm => { const channelId = to.params.channelId; vm.verifyChannel(channelId) .then(() => { vm.header = vm.channel.name; // Get channel name when user enters modal - vm.hideHTMLScroll(true); }) .catch(() => { // Couldn't verify the channel details, so go back! @@ -256,20 +229,11 @@ }); }, mounted() { - // For some reason the 'hideScroll' method of the VDialog is not - // being called the first time the dialog is opened, so do that explicitly - this.$refs.dialog.hideScroll(); - // Set expiry to 1ms this.header = this.channel.name; // Get channel name when user enters modal }, methods: { ...mapActions('channel', ['updateChannel', 'loadChannel', 'deleteChannel', 'commitChannel']), - hideHTMLScroll(hidden) { - document.querySelector('html').style = hidden - ? 'overflow-y: hidden !important;' - : 'overflow-y: auto !important'; - }, saveChannel() { if (this.$refs.detailsform.validate()) { this.changed = false;