|
354 | 354 | {{ $tr('resources') }} |
355 | 355 | </div> |
356 | 356 | <DetailsRow |
357 | | - v-if="isImported && importedChannelLink" |
| 357 | + v-if="showImportedChannelLink" |
358 | 358 | :label="$tr('originalChannel')" |
359 | 359 | > |
360 | 360 | <ActionLink |
361 | 361 | :text="importedChannelName" |
362 | | - :href="importedChannelLink" |
363 | 362 | truncate |
364 | 363 | notranslate |
365 | | - target="_blank" |
| 364 | + @click="onClickImportedFrom()" |
366 | 365 | /> |
367 | 366 | </DetailsRow> |
368 | 367 | <DetailsRow :label="$tr('totalResources')"> |
|
395 | 394 | {{ $tr('source') }} |
396 | 395 | </div> |
397 | 396 | <DetailsRow |
398 | | - v-if="isImported && importedChannelLink" |
| 397 | + v-if="showImportedChannelLink" |
399 | 398 | :label="$tr('originalChannel')" |
400 | 399 | > |
401 | 400 | <ActionLink |
402 | 401 | :text="importedChannelName" |
403 | | - :href="importedChannelLink" |
404 | 402 | truncate |
405 | 403 | notranslate |
406 | | - target="_blank" |
| 404 | + @click="onClickImportedFrom()" |
407 | 405 | /> |
408 | 406 | </DetailsRow> |
409 | 407 | <DetailsRow |
|
661 | 659 | importedChannelName() { |
662 | 660 | return this.node.original_channel_name; |
663 | 661 | }, |
| 662 | + showImportedChannelLink() { |
| 663 | + return this.isImported && this.importedChannelLink; |
| 664 | + }, |
664 | 665 | sortedTags() { |
665 | 666 | return orderBy(this.node.tags, ['count'], ['desc']); |
666 | 667 | }, |
|
766 | 767 | this.tab = this.isExercise ? 'questions' : 'details'; |
767 | 768 | }, |
768 | 769 | methods: { |
769 | | - ...mapActions('contentNode', ['loadRelatedResources']), |
| 770 | + ...mapActions('contentNode', ['loadContentNodes', 'loadRelatedResources']), |
770 | 771 | ...mapActions('file', ['loadFiles']), |
771 | 772 | ...mapActions('assessmentItem', ['loadNodeAssessmentItems']), |
772 | 773 | getText(field) { |
|
849 | 850 | } |
850 | 851 | } |
851 | 852 | }, |
| 853 | + onClickImportedFrom() { |
| 854 | + if (this.showImportedChannelLink) { |
| 855 | + const originalNodeId = this.node.original_source_node_id; |
| 856 | + const originalChannelId = this.node.original_channel_id; |
| 857 | + this.loadContentNodes({ |
| 858 | + '[node_id+channel_id]__in': [[originalNodeId, originalChannelId]], |
| 859 | + }).then(nodes => { |
| 860 | + if (nodes.length > 0) { |
| 861 | + window.open(this.importedChannelLink, '_blank'); |
| 862 | + } else { |
| 863 | + this.$store.dispatch('showSnackbar', { |
| 864 | + text: this.$tr('sourceContentDoesntExist'), |
| 865 | + }); |
| 866 | + } |
| 867 | + }); |
| 868 | + } |
| 869 | + }, |
852 | 870 | }, |
853 | 871 | $trs: { |
854 | 872 | questions: 'Questions', |
|
892 | 910 | noQuestionsError: 'Exercise is empty', |
893 | 911 | incompleteQuestionError: |
894 | 912 | '{count, plural, one {# incomplete question} other {# incomplete questions}}', |
| 913 | + sourceContentDoesntExist: |
| 914 | + 'Source content no longer exists. Please contact your administrator.', |
895 | 915 | }, |
896 | 916 | }; |
897 | 917 |
|
|
0 commit comments