Skip to content

Commit

Permalink
Add mydownloads side nav in learn plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVelezLl committed Feb 23, 2023
1 parent f93d479 commit e291161
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
40 changes: 40 additions & 0 deletions kolibri/plugins/learn/assets/src/views/MyDownloadsSideNavEntry.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>

<CoreMenuOption
:label="coreString('myDownloadsLabel')"
:link="url"
icon="download"
/>

</template>


<script>
import { UserKinds, NavComponentSections } from 'kolibri.coreVue.vuex.constants';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import CoreMenuOption from 'kolibri.coreVue.components.CoreMenuOption';
import navComponents from 'kolibri.utils.navComponents';
import urls from 'kolibri.urls';
const component = {
name: 'MyDownloadsSideNavEntry',
components: {
CoreMenuOption,
},
mixins: [commonCoreStrings],
computed: {
url() {
return urls['kolibri:kolibri.plugins.learn:my_downloads']();
},
},
role: UserKinds.LEARNER,
priority: 10,
section: NavComponentSections.ACCOUNT,
};
navComponents.register(component);
export default component;
</script>
6 changes: 6 additions & 0 deletions kolibri/plugins/learn/buildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ module.exports = [
entry: './assets/src/views/LearnSideNavEntry.vue',
},
},
{
bundle_id: 'my_downloads_side_nav',
webpack_config: {
entry: './assets/src/views/MyDownloadsSideNavEntry.vue',
},
},
];
5 changes: 5 additions & 0 deletions kolibri/plugins/learn/kolibri_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,8 @@ def node_url(self, node):
+ kind_slug
+ node.id
)


@register_hook
class MyDownloadsNavAction(NavigationHook):
bundle_id = "my_downloads_side_nav"
5 changes: 4 additions & 1 deletion kolibri/plugins/learn/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

from .views import LearnView

urlpatterns = [url(r"^$", LearnView.as_view(), name="learn")]
urlpatterns = [
url(r"^$", LearnView.as_view(), name="learn"),
url(r"^my-downloads$", LearnView.as_view(), name="my_downloads"),
]

0 comments on commit e291161

Please sign in to comment.