Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions kolibri_explore_plugin/assets/src/components/DiscoveryNavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

<script>

import urls from 'kolibri.urls';
import { currentLanguage, languageIdToCode } from 'kolibri.utils.i18n';
import ViewDashboardOutlineIcon from 'vue-material-design-icons/ViewDashboardOutline.vue';
import MagnifyIcon from 'vue-material-design-icons/Magnify.vue';
Expand All @@ -91,6 +92,7 @@
mixins: [commonExploreStrings],
data() {
return {
buildInfo: null,
isOffline: false,
};
},
Expand All @@ -99,11 +101,23 @@
return assets.EndlessLogo;
},
feedbackUrl() {
const hiddenFormFields = new URLSearchParams({
language: currentLanguage,
kolibriVersion: window.kolibriCoreAppGlobal.version,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the explore version also be included here?

kolibriProject: plugin_data.kolibriProject || 'Unknown',
});

if (this.buildInfo) {
hiddenFormFields[
'endlessKeyRelease'
] = `${this.buildInfo.version_name} ${this.buildInfo.last_release}`;
}

switch (languageIdToCode(currentLanguage)) {
case 'es':
return plugin_data.feedbackUrlEs;
return plugin_data.feedbackUrlEs + '#' + hiddenFormFields.toString();
default:
return plugin_data.feedbackUrl;
return plugin_data.feedbackUrl + '#' + hiddenFormFields.toString();
}
},
showFeedbackButton() {
Expand All @@ -116,6 +130,9 @@
return !!plugin_data.androidApplicationId && !!plugin_data.windowsApplicationId;
},
},
mounted() {
this.getBuildInfo();
},
created() {
this.isOffline = !navigator.onLine;
window.addEventListener('offline', this.onOffline);
Expand Down Expand Up @@ -169,6 +186,17 @@
this.$store.commit('topicsRoot/SET_SHOW_SIDE_NAV', true);
}
},
getBuildInfo() {
const buildInfo = urls.static(`build-info.json`);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this come from?

fetch(buildInfo)
.then(response => response.json())
.then(data => {
this.buildInfo = data;
})
.catch(error => {
console.error(error);
});
},
},
$trs: {
feedbackLabel: 'Feedback',
Expand Down
1 change: 1 addition & 0 deletions kolibri_explore_plugin/kolibri_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def plugin_data(self):
"hideDiscoveryTab": conf.OPTIONS["Explore"]["HIDE_DISCOVERY_TAB"],
"feedbackUrl": conf.OPTIONS["Explore"]["FEEDBACK_URL"],
"feedbackUrlEs": conf.OPTIONS["Explore"]["FEEDBACK_URL_ES"],
"kolibriProject": conf.OPTIONS["Deployment"]["PROJECT"],
}
if "Pwa" in conf.OPTIONS:
pwa_options = {
Expand Down