Skip to content

Commit 7d9b668

Browse files
authored
Merge pull request #2834 from rtibbles/master_into_develop
Master into develop
2 parents 92b4aa9 + 950e24f commit 7d9b668

File tree

63 files changed

+865
-554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+865
-554
lines changed

contentcuration/contentcuration/frontend/channelEdit/components/ContentNodeListItem/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@
331331
transition: background-color ease 500ms;
332332
333333
.highlight & {
334-
background-color: #e3f0ed;
334+
background-color: var(--v-greenHighlightBackground-base);
335335
}
336336
337337
&__action,

contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@
433433
return '';
434434
}
435435
436-
const masteryModel = this.node.extra_fields.type;
436+
const masteryModel = this.node.extra_fields.mastery_model;
437437
if (!masteryModel) {
438438
return this.defaultText;
439439
} else if (masteryModel === MasteryModelsNames.M_OF_N) {

contentcuration/contentcuration/frontend/channelEdit/components/edit/DetailsTabView.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414

1515
<!-- Basic information section -->
1616
<VLayout row wrap class="section">
17-
<VFlex v-if="oneSelected" xs12>
17+
<VFlex xs12>
1818
<h1 class="subheading">
1919
{{ $tr('basicInfoHeader') }}
2020
</h1>
2121
<!-- Title -->
2222
<VTextField
23+
v-if="oneSelected"
2324
ref="title"
2425
v-model="title"
2526
maxlength="200"
@@ -33,6 +34,7 @@
3334
/>
3435
<!-- Description -->
3536
<VTextarea
37+
v-if="oneSelected"
3638
ref="description"
3739
v-model="description"
3840
:label="$tr('descriptionLabel')"
@@ -187,6 +189,7 @@
187189
:placeholder="getPlaceholder('author')"
188190
:value="author && author.toString()"
189191
@input.native="e => author = e.srcElement.value"
192+
@input="author = $event"
190193
@focus="trackClick('Author')"
191194
>
192195
<template v-slot:append-outer>
@@ -207,6 +210,7 @@
207210
box
208211
:value="provider && provider.toString()"
209212
@input.native="e => provider = e.srcElement.value"
213+
@input="provider = $event"
210214
@focus="trackClick('Provider')"
211215
>
212216
<template v-slot:append-outer>
@@ -227,6 +231,7 @@
227231
box
228232
:value="aggregator && aggregator.toString()"
229233
@input.native="e => aggregator = e.srcElement.value"
234+
@input="aggregator = $event"
230235
@focus="trackClick('Aggregator')"
231236
>
232237
<template v-slot:append-outer>
@@ -262,7 +267,7 @@
262267
box
263268
:value="copyright_holder && copyright_holder.toString()"
264269
@input.native="e => copyright_holder = e.srcElement.value"
265-
@input="e => copyright_holder = e"
270+
@input="copyright_holder = $event"
266271
@focus="trackClick('Copyright holder')"
267272
/>
268273
</VFlex>
@@ -425,7 +430,7 @@
425430
role: generateGetterSetter('role_visibility'),
426431
language: generateGetterSetter('language'),
427432
mastery_model() {
428-
return this.getExtraFieldsValueFromNodes('type');
433+
return this.getExtraFieldsValueFromNodes('mastery_model');
429434
},
430435
m() {
431436
return this.getExtraFieldsValueFromNodes('m');
@@ -436,7 +441,7 @@
436441
masteryModelItem: {
437442
get() {
438443
return {
439-
type: this.mastery_model,
444+
mastery_model: this.mastery_model,
440445
m: this.m,
441446
n: this.n,
442447
};

contentcuration/contentcuration/frontend/channelEdit/components/edit/__tests__/data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function generateNode(props = {}) {
2828
});
2929

3030
let extra_fields = {
31-
type: 'do_all',
31+
mastery_model: 'do_all',
3232
randomize: false,
3333
};
3434

contentcuration/contentcuration/frontend/channelEdit/components/edit/__tests__/detailsTabView.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe.skip('detailsTabView', () => {
8383
role: DEFAULT_EXERCISE.role_visibility,
8484
randomizeOrder: DEFAULT_EXERCISE.extra_fields.randomize,
8585
masteryModel: {
86-
type: DEFAULT_EXERCISE.extra_fields.type,
86+
mastery_model: DEFAULT_EXERCISE.extra_fields.mastery_model,
8787
},
8888
copyrightHolder: DEFAULT_EXERCISE.copyright_holder,
8989
});
@@ -146,7 +146,7 @@ describe.skip('detailsTabView', () => {
146146
});
147147
it('exercise fields should set selected node data extra_fields', () => {
148148
wrapper.find({ ref: 'mastery_model' }).vm.$emit('input', { type: 'm_of_n' });
149-
expect(wrapper.vm.masteryModel.type).toEqual('m_of_n');
149+
expect(wrapper.vm.masteryModel.mastery_model).toEqual('m_of_n');
150150
});
151151
});
152152
describe('on validation', () => {

contentcuration/contentcuration/frontend/channelEdit/views/files/ContentRenderer.vue

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
@load="loading = false"
4343
></iframe>
4444
<embed v-else-if="isPDF" :src="src" :type="file.mimetype" @load="loading = false">
45+
<div v-else-if="isEpub" class="epub">
46+
<EpubRenderer :src="src" @load="loading = false" />
47+
</div>
48+
4549
<VCard v-else class="message-card" flat>
4650
<VLayout align-center justify-center fill-height data-test="not-supported">
4751
<VTooltip bottom>
@@ -63,12 +67,14 @@
6367
import uniqBy from 'lodash/uniqBy';
6468
import sortBy from 'lodash/sortBy';
6569
import { mapGetters } from 'vuex';
70+
import EpubRenderer from './EpubRenderer';
6671
import FileStatus from 'shared/views/files/FileStatus';
6772
6873
export default {
6974
name: 'ContentRenderer',
7075
components: {
7176
FileStatus,
77+
EpubRenderer,
7278
},
7379
props: {
7480
fileId: {
@@ -117,6 +123,9 @@
117123
isPDF() {
118124
return this.file.file_format === 'pdf';
119125
},
126+
isEpub() {
127+
return this.file.file_format === 'epub';
128+
},
120129
htmlPath() {
121130
return `/zipcontent/${this.file.checksum}.${this.file.file_format}`;
122131
},
@@ -145,14 +154,16 @@
145154
video,
146155
audio,
147156
embed,
148-
iframe {
157+
iframe,
158+
.epub {
149159
width: 100%;
150160
outline: none;
151161
}
152162
.v-card,
153163
.v-card > .layout,
154164
embed,
155-
iframe {
165+
iframe,
166+
.epub {
156167
min-height: 200px;
157168
max-height: @max-height;
158169
}
@@ -162,7 +173,8 @@
162173
.message-card,
163174
video,
164175
embed,
165-
iframe {
176+
iframe,
177+
.epub {
166178
border-color: var(--v-greyBorder-base) !important;
167179
border-style: solid;
168180
border-width: 1px;
@@ -173,7 +185,8 @@
173185
.v-card,
174186
audio,
175187
embed,
176-
iframe {
188+
iframe,
189+
.epub {
177190
min-height: @max-height;
178191
}
179192
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<template>
2+
3+
<VLayout align-center fill-height row style="background-color: white;">
4+
<VFlex shrink class="px-2">
5+
<IconButton
6+
icon="chevronLeft"
7+
text=""
8+
size="small"
9+
rtlFlip
10+
@click="rendition.prev()"
11+
/>
12+
</VFlex>
13+
<div ref="epub" :style="{ height: '100%', width }"></div>
14+
<VFlex shrink class="px-2">
15+
<IconButton
16+
icon="chevronRight"
17+
text=""
18+
size="small"
19+
rtlFlip
20+
@click="rendition.next()"
21+
/>
22+
</VFlex>
23+
</VLayout>
24+
25+
</template>
26+
27+
<script>
28+
29+
import ePub from 'epubjs';
30+
import IconButton from 'shared/views/IconButton';
31+
32+
export default {
33+
name: 'EpubRenderer',
34+
components: {
35+
IconButton,
36+
},
37+
props: {
38+
src: {
39+
type: String,
40+
required: true,
41+
},
42+
},
43+
data() {
44+
return {
45+
book: null,
46+
rendition: null,
47+
};
48+
},
49+
computed: {
50+
width() {
51+
return 'calc(100% - 96px)';
52+
},
53+
},
54+
mounted() {
55+
this.$nextTick(() => {
56+
this.book = ePub(this.src);
57+
this.rendition = this.book.renderTo(this.$refs.epub, {
58+
manager: 'continuous',
59+
flow: 'paginated',
60+
width: this.width,
61+
height: '100%',
62+
});
63+
const displayed = this.rendition.display();
64+
displayed.then(() => {
65+
this.$emit('load');
66+
});
67+
}, 1000); // There seems to be some lag for loading, so add delay to be safe
68+
},
69+
};
70+
71+
</script>

contentcuration/contentcuration/frontend/channelEdit/views/files/FilePreview.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@
9696
isAudio() {
9797
return this.file.file_format === 'mp3';
9898
},
99-
isEPub() {
100-
// TODO: Remove once epub previewer is available
101-
return this.file.file_format === 'epub';
102-
},
10399
isZip() {
104100
return this.file.file_format === 'zip';
105101
},
@@ -110,7 +106,6 @@
110106
this.file.url &&
111107
this.isPreviewable &&
112108
!this.isAudio &&
113-
!this.isEPub &&
114109
!this.file.uploading
115110
);
116111
},

contentcuration/contentcuration/frontend/channelEdit/vuex/contentNode/actions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ export function createContentNode(context, { parent, kind, ...payload }) {
169169
tags: {},
170170
extra_fields: {},
171171
[NEW_OBJECT]: true,
172+
total_count: 0,
173+
resource_count: 0,
174+
complete: false,
172175
changed: true,
173176
language: session.preferences ? session.preferences.language : session.currentLanguage,
174177
parent,
@@ -243,8 +246,8 @@ function generateContentNodeData({
243246
}
244247
if (extra_fields !== NOVALUE) {
245248
contentNodeData.extra_fields = contentNodeData.extra_fields || {};
246-
if (extra_fields.type) {
247-
contentNodeData.extra_fields.type = extra_fields.type;
249+
if (extra_fields.mastery_model) {
250+
contentNodeData.extra_fields.mastery_model = extra_fields.mastery_model;
248251
}
249252
if (extra_fields.m) {
250253
contentNodeData.extra_fields.m = extra_fields.m;

contentcuration/contentcuration/frontend/channelList/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ export const ListTypeToRouteMapping = {
3434
};
3535

3636
export const RouteToListTypeMapping = invert(ListTypeToRouteMapping);
37+
38+
export const CHANNEL_PAGE_SIZE = 25;

0 commit comments

Comments
 (0)