Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many hybrid learning things #8548

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
beefdfe
Refactor bookmarks card view, update responsiveness and layout
marcellamaki Sep 22, 2021
a082ba1
Re-add 'remove from bookmarks' and finish mobile styling
marcellamaki Sep 23, 2021
05333ec
Use theme tokens instead of hex values
marcellamaki Sep 23, 2021
905c125
Add basic tests for Bookmark Page
marcellamaki Sep 23, 2021
4bf3d1f
Refactor bookmarks and library to use new HybridLearningCardGrid and …
marcellamaki Sep 30, 2021
eda3df3
Attempt to fix tests
marcellamaki Oct 5, 2021
67bd526
Switch from created to updated lifecycle method for displaying curren…
marcellamaki Oct 11, 2021
b42abca
Fix button styling and bookmark removal front end
marcellamaki Oct 15, 2021
87c9812
Resolve merge error - add HybridLearningCardGrid back to LibraryPage …
marcellamaki Oct 22, 2021
83359cf
Refactor bookmarks card view, update responsiveness and layout
marcellamaki Sep 22, 2021
586511b
Re-add 'remove from bookmarks' and finish mobile styling
marcellamaki Sep 23, 2021
66753bd
Refactor bookmarks and library to use new HybridLearningCardGrid and …
marcellamaki Sep 30, 2021
445c84e
Responsiveness adjustments to library page card layout - updating whi…
marcellamaki Sep 24, 2021
e5cedb5
(WIP) refactor library page layout
marcellamaki Oct 11, 2021
bf6f132
Resolving merge conflicts, continued
marcellamaki Oct 19, 2021
7eeec14
Conditional rendering of side panel filters based on available metadata
marcellamaki Oct 19, 2021
2857383
Card styling adjustments
marcellamaki Oct 19, 2021
0c548ab
Refine responsive sidebar functionality for smallest mobile devices (…
marcellamaki Oct 20, 2021
855c4b0
Finalize responsive filtering
marcellamaki Oct 20, 2021
05d6797
Fix cursor on search modal
marcellamaki Oct 21, 2021
82be484
(WIP) Chips matching search query and basic clearing functionality wo…
marcellamaki Oct 21, 2021
2e702ea
Swap out header labeled icon for LearningActivityLabel component
marcellamaki Oct 21, 2021
fda0c95
Update results header buttons. Code cleanup
marcellamaki Oct 21, 2021
747f943
CSS tweaks to modal and filter button
marcellamaki Oct 22, 2021
3df294f
Resolve merge conflicts in FullScreenSidePanel, and fix merge errors
marcellamaki Oct 22, 2021
06af437
Fix linting errors from rebase
marcellamaki Oct 22, 2021
2a28d84
Remove stray logs. Re-add accidental code deletions
marcellamaki Oct 22, 2021
f409f2b
Fix CategorySearchModal file structure and naming confusion
marcellamaki Oct 22, 2021
5ef9df7
Switch page breadcrumbs from a negative to a positive conditional sta…
marcellamaki Oct 22, 2021
89f37c4
Remove unused content card view file
marcellamaki Oct 25, 2021
cf7ffc9
Add list/filter toggle option to search results
marcellamaki Oct 25, 2021
6c381c3
Conditionalize duration display in LearningActivityLabel for flexibil…
marcellamaki Oct 25, 2021
a00ba52
Fix KSelect alignments to match Figma
marcellamaki Oct 25, 2021
e51372b
Add channel title and thumbnail data to normalizeContentNode.
rtibbles Oct 25, 2021
6d90ec9
Fix reference to TextTruncator which was unintentionally deleted
marcellamaki Oct 25, 2021
3da206d
Fix channel logo placement
marcellamaki Oct 26, 2021
f1b7a55
Add new lesson playlist card
marcellamaki Oct 26, 2021
35ef487
Fix clickable area to be entire card
marcellamaki Oct 26, 2021
130abc2
fix card width and header layout
marcellamaki Oct 27, 2021
dd3016b
Refactor in-channel-browsing
marcellamaki Oct 23, 2021
41a0af6
CSS fixes for mobile side panel overlay spacing and position
marcellamaki Oct 25, 2021
522bfc9
(WIP) Mobile header tabs and layout updates
marcellamaki Oct 25, 2021
7e85441
Add ability to select folder from dropdown, or navigate back using br…
marcellamaki Oct 25, 2021
baef012
Update mobile carousel limit
marcellamaki Oct 25, 2021
16665b6
Add content thumbnails with normalizeContentNode on Topics Page
marcellamaki Oct 26, 2021
5db19ef
Add folders header
marcellamaki Oct 26, 2021
57344c6
Fix conditional display of side panel on medium screens
marcellamaki Oct 27, 2021
90621b1
Fix bookmark page regression for mobile size
marcellamaki Oct 27, 2021
ccf9586
Fix conditional rendering of Library Page mobile cards
marcellamaki Oct 27, 2021
eb01249
Fix conditional rendering on Library and Topics pages
marcellamaki Oct 27, 2021
344d36e
Fix error in Folder topic rendering
marcellamaki Oct 27, 2021
3ece8d4
Fix issues with normalizeContentNode preventing loading more results
marcellamaki Oct 27, 2021
6edc5fd
Mock channel plugin data in tests
marcellamaki Oct 27, 2021
de8da4d
Add comments
marcellamaki Oct 27, 2021
7960cea
Revert accidentally commented out KeenUI toolbar code
marcellamaki Oct 28, 2021
aa01f9a
Add explanitory comments for atypical styles
marcellamaki Oct 29, 2021
4071bbe
Throttle scrolling on Topics page
marcellamaki Oct 29, 2021
4012536
Make searchTerms and chip filter code more consistent
marcellamaki Oct 29, 2021
902a65a
Remove 'level-0' conditions from CategorySearchModal
marcellamaki Oct 29, 2021
e4f08ca
Various code cleanup - deleting stale code, uncommenting necessary co…
marcellamaki Oct 29, 2021
c670e37
Begin bringing in side panel work - working on Library and content re…
marcellamaki Oct 29, 2021
4c1bf44
Remove extra request in Library page labels - not needed to filter
marcellamaki Oct 29, 2021
6001c09
Revert "Remove ContentCard components and sub components as it is no …
marcellamaki Oct 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
}),
};
});
console.log(options);
return options;
},
},
Expand Down
35 changes: 29 additions & 6 deletions kolibri/core/assets/src/views/FullScreenSidePanel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
:style="{
color: $themeTokens.text,
backgroundColor: $themeTokens.surface,
right: (alignment === 'right' ? 0 : ''),
left: (alignment === 'left' ? 0 : ''),
width: (sidePanelOverrideWidth ? sidePanelOverrideWidth : '')
}"
>
<KIconButton
icon="close"
class="close-button"
@click="closePanel"
/>
<div v-if="!closeButtonHidden">
<KIconButton
icon="close"
class="close-button"
@click="closePanel"
/>
</div>
<slot></slot>

<!--
Expand Down Expand Up @@ -71,6 +76,25 @@
//SidePanelResourcesList,
},
mixins: [responsiveWindowMixin],
props: {
closeButtonHidden: {
type: Boolean,
default: false,
},
alignment: {
type: String,
default: 'right',
validator(val) {
return ['right', 'left'].includes(val);
},
},
// to customize the width of the side panel in different scenarios
sidePanelOverrideWidth: {
type: String,
required: false,
default: null,
},
},
computed: {
isMobile() {
return this.windowBreakpoint == 0;
Expand Down Expand Up @@ -114,7 +138,6 @@
.side-panel {
position: fixed;
top: 0;
right: 0;
bottom: 0;
// Must be <= 12 z-index so that KDropdownMenu shows over
z-index: 12;
Expand Down
5 changes: 5 additions & 0 deletions kolibri/core/assets/src/views/TextTruncator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
.truncated {
overflow: hidden;
text-overflow: ellipsis;
// this ensure that when the text truncator is used
// in a router-link card, the text is not underlined
a {
text-decoration: none !important;
}
marcellamaki marked this conversation as resolved.
Show resolved Hide resolved
}

</style>
2 changes: 1 addition & 1 deletion kolibri/core/content/utils/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _get_available_channels(base_queryset):
id__in=base_queryset.values_list("channel_id", flat=True).distinct()
)
.order_by("order")
.values("id", "name")
.values("id", "name", "thumbnail")
)


Expand Down
9 changes: 9 additions & 0 deletions kolibri/plugins/learn/assets/src/modules/coreLearn/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@ import { ContentNodeKinds } from 'kolibri.coreVue.vuex.constants';
import { assessmentMetaDataState } from 'kolibri.coreVue.vuex.mappers';
import { getContentNodeThumbnail } from 'kolibri.utils.contentNode';
import tail from 'lodash/tail';
import plugin_data from 'plugin_data';

const channels = {};
for (let channel of plugin_data.channels) {
rtibbles marked this conversation as resolved.
Show resolved Hide resolved
channels[channel.id] = channel;
}

// adds progress, thumbnail, and breadcrumbs. normalizes pk/id and kind
export function normalizeContentNode(node) {
const channel = channels[node.channel_id];
return {
...node,
kind: node.parent ? node.kind : ContentNodeKinds.CHANNEL,
thumbnail: getContentNodeThumbnail(node) || undefined,
breadcrumbs: tail(node.ancestors),
progress: Math.min(node.progress_fraction || 0, 1.0),
copies_count: node.copies_count,
channel_title: channel ? channel.name : '',
channel_thumbnail: channel ? channel.thumbnail : null,
};
}

Expand Down
137 changes: 46 additions & 91 deletions kolibri/plugins/learn/assets/src/views/BookmarkPage.vue
Original file line number Diff line number Diff line change
@@ -1,56 +1,34 @@
<template>

<div>

<h3>{{ $tr('bookmarksHeader') }}</h3>

<h1>
{{ $tr('bookmarksHeader') }}
</h1>
<p v-if="!bookmarks.length && !loading">
{{ $tr('noBookmarks') }}
</p>

<template v-else>
<ContentCard
v-for="(content, index) in bookmarks"
:key="content.id"
class="card"
:isMobile="windowIsSmall"
:title="content.title"
:thumbnail="content.thumbnail"
:kind="content.kind"
:isLeaf="content.is_leaf"
:progress="content.progress || 0"
:numCoachContents="content.num_coach_contents"
:link="genContentLink(content.id, content.is_leaf)"
:contentId="content.content_id"
:subtitle="bookmarkCreated(content.bookmark.created)"
>
<template #actions>
<KIconButton
icon="info"
:tooltip="infoText"
:ariaLabel="infoText"
@click="showResourcePanel(content)"
/>
<KIconButton
icon="clear"
:tooltip="removeText"
:ariaLabel="removeText"
@click="removeBookmark(content, index)"
/>
</template>
</ContentCard>

<KButton
v-if="more && !loading"
:text="coreString('viewMoreAction')"
@click="loadMore"
/>
<KCircularLoader
v-else-if="loading"
:delay="false"
/>

</template>
<HybridLearningCardGrid
v-if="bookmarks.length"
:contents="bookmarks"
:currentPage="currentPage"
:genContentLink="genContentLink"
:cardViewStyle="windowIsSmall ? 'card' : 'list'"
numCols="1"
:footerIcons="footerIcons"
@removeFromBookmarks="removeFromBookmarks"
/>

<KButton
v-if="more && !loading"
data-test="load-more-button"
:text="coreString('viewMoreAction')"
@click="loadMore"
/>
<KCircularLoader
v-else-if="loading"
:delay="false"
/>
</div>

</template>
Expand All @@ -59,14 +37,15 @@
<script>

import { mapActions } from 'vuex';
import client from 'kolibri.client';
import urls from 'kolibri.urls';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import responsiveWindowMixin from 'kolibri.coreVue.mixins.responsiveWindowMixin';
import { ContentNodeResource } from 'kolibri.resources';
import { now } from 'kolibri.utils.serverClock';
import client from 'kolibri.client';
import urls from 'kolibri.urls';
import genContentLink from '../utils/genContentLink';
import ContentCard from './ContentCard';
import { PageNames } from '../constants';
import { normalizeContentNode } from '../modules/coreLearn/utils.js';
import HybridLearningCardGrid from './HybridLearningCardGrid';

export default {
name: 'BookmarkPage',
Expand All @@ -76,41 +55,31 @@
};
},
components: {
ContentCard,
HybridLearningCardGrid,
},
mixins: [commonCoreStrings, responsiveWindowMixin],
data() {
return {
loading: true,
bookmarks: [],
more: null,
resourcePanelNode: null,
now: now(),
};
},
computed: {
infoText() {
return this.coreString('viewInformation');
footerIcons() {
return { info: 'viewInformation', close: 'removeFromBookmarks' };
},
removeText() {
return this.coreString('removeFromBookmarks');
currentPage() {
return PageNames.BOOKMARKS;
},
},
created() {
ContentNodeResource.fetchBookmarks({ params: { limit: 25 } }).then(data => {
this.more = data.more;
this.bookmarks = data.results;
this.bookmarks = data.results ? data.results.map(normalizeContentNode) : [];
this.loading = false;
});
},
mounted() {
this.timer = setInterval(() => {
this.now = now();
}, 10000);
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
...mapActions(['createSnackbar']),
genContentLink,
Expand All @@ -119,26 +88,21 @@
this.loading = true;
ContentNodeResource.fetchBookmarks({ params: this.more }).then(data => {
this.more = data.more;
this.bookmarks.push(...data.results);
this.bookmarks.push(...data.results.map(normalizeContentNode));
this.loading = false;
});
}
},
removeBookmark(bookmark, index) {
client({
method: 'delete',
url: urls['kolibri:core:bookmarks_delete_by_node_id'](bookmark.id),
}).then(() => {
this.bookmarks.pop(index);
this.createSnackbar(this.$tr('removedNotification'));
});
},
showResourcePanel(bookmark) {
this.resourcePanelNode = bookmark;
},
bookmarkCreated(date) {
const time = this.$formatRelative(date, { now: this.now });
return this.coreString('bookmarkedTimeAgoLabel', { time });
removeFromBookmarks(bookmark) {
if (bookmark) {
client({
method: 'delete',
url: urls['kolibri:core:bookmarks_detail'](bookmark.id),
}).then(() => {
this.bookmarks = this.bookmarks.filter(bm => bm.bookmark.id !== bookmark.id);
this.createSnackbar(this.$tr('removedNotification'));
});
}
},
},
$trs: {
Expand All @@ -159,12 +123,3 @@
};

</script>


<style lang="scss" scoped>

.card {
margin: 5px;
}

</style>