Skip to content

Commit 6d84a1f

Browse files
committed
wip
1 parent f44b788 commit 6d84a1f

6 files changed

Lines changed: 9 additions & 504 deletions

File tree

kolibri_explore_plugin/assets/src/modules/topicsTree/handlers.js

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import urls from 'kolibri.urls';
55
import { ContentNodeResource } from 'kolibri.resources';
66
import { PageNames } from '../../constants';
77
import { getAppNameByID, getChannelIcon } from '../../customApps';
8-
import { normalizeContentNode, contentState } from '../coreExplore/utils';
8+
import { normalizeContentNode } from '../coreExplore/utils';
99

1010
function _getAppMetadata(appName) {
1111
const url = urls['kolibri:kolibri_explore_plugin:app_metadata']({ app: appName });
@@ -127,38 +127,14 @@ export function showTopicsChannel(store, id) {
127127
});
128128
}
129129

130-
export function showTopicsContentInLightbox(store, id) {
131-
const promises = [ContentNodeResource.fetchModel({ id }), store.dispatch('setChannelInfo')];
132-
const shouldResolve = samePageCheckGenerator(store);
133-
Promise.all(promises).then(
134-
([content]) => {
135-
if (shouldResolve()) {
136-
const currentChannel = store.getters.getChannelObject(content.channel_id);
137-
if (!currentChannel) {
138-
router.replace({ name: PageNames.CONTENT_UNAVAILABLE });
139-
return;
140-
}
141-
store.commit('topicsTree/SET_STATE', {
142-
content: contentState(content),
143-
channel: currentChannel,
144-
});
145-
146-
const appName = getAppNameByID(content.channel_id);
147-
if (appName) {
148-
_getAppMetadata(appName)
149-
.then(({ data }) => {
150-
store.commit('topicsTree/SET_APP_METADATA', _parseAppMetadata(data, appName));
151-
})
152-
.catch(() => {
153-
console.log(`no metadata ${appName}`);
154-
});
155-
}
156-
}
157-
},
158-
error => {
159-
shouldResolve() ? store.dispatch('handleApiError', error) : null;
160-
}
161-
);
130+
export function showTopicsContentInLightbox(_store, id) {
131+
const learnUrl = urls['kolibri:kolibri.plugins.learn:learn'];
132+
if (learnUrl) {
133+
const prevName = encodeURIComponent(window.location.href);
134+
const contentViewerUrl = `${learnUrl()}#/topics/c/${id}?prevName=${prevName}`;
135+
window.location.replace(contentViewerUrl);
136+
return;
137+
}
162138
}
163139

164140
export function hideTopicsContentFromLightbox(store) {

kolibri_explore_plugin/assets/src/routes/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ export default [
9797
showTopicsChannel(store, toRoute.params.channel_id);
9898
},
9999
},
100-
{
101-
name: PageNames.CONTENT,
102-
path: '/content/:content_id',
103-
handler: toRoute => {
104-
store.commit('SET_CONTENT_ID', toRoute.params.content_id);
105-
store.commit('SET_PAGE_NAME', PageNames.CONTENT);
106-
},
107-
},
108100
{
109101
path: '*',
110102
redirect: '/',

kolibri_explore_plugin/assets/src/views/ContentItem.vue

Lines changed: 0 additions & 262 deletions
This file was deleted.

0 commit comments

Comments
 (0)