File tree Expand file tree Collapse file tree
kolibri_explore_plugin/assets/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { ContentNodeKinds } from 'kolibri.coreVue.vuex.constants';
66import router from 'kolibri.coreVue.router' ;
77import store from 'kolibri.coreVue.vuex.store' ;
88import { utils } from 'eos-components' ;
9- import { showTopicsContentInLightbox } from './modules/topicsTree/handlers' ;
9+ import { showTopicsContent } from './modules/topicsTree/handlers' ;
1010import { PageNames } from './constants' ;
1111import { getChannelIcon } from './customApps' ;
1212
@@ -39,7 +39,7 @@ class KolibriApi {
3939 }
4040
4141 navigateTo ( nodeId ) {
42- showTopicsContentInLightbox ( store , nodeId ) ;
42+ showTopicsContent ( store , nodeId ) ;
4343 }
4444
4545 closeCustomPresentation ( ) {
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export function showTopicsChannel(store, id) {
127127 } ) ;
128128}
129129
130- export function showTopicsContentInLightbox ( store , id ) {
130+ function showTopicsContentInLightbox ( store , id ) {
131131 const promises = [ ContentNodeResource . fetchModel ( { id } ) , store . dispatch ( 'setChannelInfo' ) ] ;
132132 const shouldResolve = samePageCheckGenerator ( store ) ;
133133 Promise . all ( promises ) . then (
@@ -161,6 +161,22 @@ export function showTopicsContentInLightbox(store, id) {
161161 ) ;
162162}
163163
164- export function hideTopicsContentFromLightbox ( store ) {
164+ function showTopicsContentInLearnTab ( learnUrl , id ) {
165+ // Pass current URL as prevName:
166+ const prevName = encodeURIComponent ( window . location . href ) ;
167+ const contentViewerUrl = `${ learnUrl ( ) } #/topics/c/${ id } ?prevName=${ prevName } ` ;
168+ window . location . replace ( contentViewerUrl ) ;
169+ }
170+
171+ export function showTopicsContent ( store , id ) {
172+ const learnUrl = urls [ 'kolibri:kolibri.plugins.learn:learn' ] ;
173+ if ( learnUrl ) {
174+ showTopicsContentInLearnTab ( learnUrl , id ) ;
175+ } else {
176+ showTopicsContentInLightbox ( store , id ) ;
177+ }
178+ }
179+
180+ export function hideTopicsContent ( store ) {
165181 store . commit ( 'topicsTree/RESET_CONTENT' ) ;
166182}
Original file line number Diff line number Diff line change 2020
2121 import { mapState } from ' vuex' ;
2222 import { responsiveMixin } from ' eos-components' ;
23- import {
24- hideTopicsContentFromLightbox ,
25- showTopicsContentInLightbox ,
26- } from ' ../modules/topicsTree/handlers' ;
23+ import { hideTopicsContent , showTopicsContent } from ' ../modules/topicsTree/handlers' ;
2724 import ContentItem from ' ./ContentItem' ;
2825
2926 export default {
8683 },
8784
8885 goToContent (id ) {
89- showTopicsContentInLightbox (this .$store , id);
86+ showTopicsContent (this .$store , id);
9087 },
9188 onClose () {
92- hideTopicsContentFromLightbox (this .$store );
89+ hideTopicsContent (this .$store );
9390 },
9491 },
9592 };
You can’t perform that action at this time.
0 commit comments