Skip to content
Snippets Groups Projects
Commit 7a924cef authored by Ron Lucke's avatar Ron Lucke
Browse files

Courseware: StructuralElement Aktionsmenü neu strukturieren

Closes #4476

Merge request studip/studip!3262
parent e47bc193
No related branches found
No related tags found
No related merge requests found
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
:ordered-structural-elements="orderedStructuralElements" :ordered-structural-elements="orderedStructuralElements"
@select="selectStructuralElement" @select="selectStructuralElement"
></courseware-structural-element> ></courseware-structural-element>
<MountingPortal mountTo="#courseware-action-widget" name="sidebar-actions">
<courseware-action-widget v-if="!showSearchResults && canEditSelected" :structural-element="selected"></courseware-action-widget>
</MountingPortal>
<MountingPortal mountTo="#courseware-search-widget" name="sidebar-search"> <MountingPortal mountTo="#courseware-search-widget" name="sidebar-search">
<courseware-search-widget v-if="selected !== null"></courseware-search-widget> <courseware-search-widget v-if="selected !== null"></courseware-search-widget>
</MountingPortal> </MountingPortal>
...@@ -35,7 +32,6 @@ import CoursewareStructuralElement from './structural-element/CoursewareStructur ...@@ -35,7 +32,6 @@ import CoursewareStructuralElement from './structural-element/CoursewareStructur
import CoursewareSearchResults from './structural-element/CoursewareSearchResults.vue'; import CoursewareSearchResults from './structural-element/CoursewareSearchResults.vue';
import CoursewareCompanionBox from './layouts/CoursewareCompanionBox.vue'; import CoursewareCompanionBox from './layouts/CoursewareCompanionBox.vue';
import CoursewareCompanionOverlay from './layouts/CoursewareCompanionOverlay.vue'; import CoursewareCompanionOverlay from './layouts/CoursewareCompanionOverlay.vue';
import CoursewareActionWidget from './widgets/CoursewareActionWidget.vue';
import CoursewareSearchWidget from './widgets/CoursewareSearchWidget.vue'; import CoursewareSearchWidget from './widgets/CoursewareSearchWidget.vue';
import StudipProgressIndicator from '../StudipProgressIndicator.vue'; import StudipProgressIndicator from '../StudipProgressIndicator.vue';
...@@ -46,7 +42,6 @@ export default { ...@@ -46,7 +42,6 @@ export default {
components: { components: {
CoursewareStructuralElement, CoursewareStructuralElement,
CoursewareSearchResults, CoursewareSearchResults,
CoursewareActionWidget,
CoursewareCompanionBox, CoursewareCompanionBox,
StudipProgressIndicator, StudipProgressIndicator,
CoursewareSearchWidget, CoursewareSearchWidget,
...@@ -81,13 +76,6 @@ export default { ...@@ -81,13 +76,6 @@ export default {
return this.$gettext('Beim Laden der Seite ist ein Fehler aufgetreten.'); return this.$gettext('Beim Laden der Seite ist ein Fehler aufgetreten.');
} }
}, },
canEditSelected() {
if (this.selected) {
return this.selected.attributes['can-edit'];
}
return false;
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
:context="structuralElement.attributes.title" :context="structuralElement.attributes.title"
@editCurrentElement="menuAction('editCurrentElement')" @editCurrentElement="menuAction('editCurrentElement')"
@addElement="menuAction('addElement')" @addElement="menuAction('addElement')"
@exportElement="menuAction('exportElement')"
@deleteCurrentElement="menuAction('deleteCurrentElement')" @deleteCurrentElement="menuAction('deleteCurrentElement')"
@showInfo="menuAction('showInfo')" @showInfo="menuAction('showInfo')"
@setBookmark="menuAction('setBookmark')" @setBookmark="menuAction('setBookmark')"
...@@ -1128,54 +1129,34 @@ export default { ...@@ -1128,54 +1129,34 @@ export default {
}, },
menuItems() { menuItems() {
let menu = [ let menu = [];
{ id: 5, label: this.$gettext('Informationen anzeigen'), icon: 'info', emit: 'showInfo' },
{ id: 6, label: this.$gettext('Lesezeichen setzen'), icon: 'star', emit: 'setBookmark' },
];
if (this.isFeedbackActivated) {
if (this.canCreateFeedbackElement && !this.hasFeedbackElement) {
menu.push({
id: 7,
label: this.$gettext('Feedback aktivieren'),
icon: 'feedback',
emit: 'showFeedbackCreate',
});
}
if (this.hasFeedbackElement) {
menu.push({
id: 7,
label: this.$gettext('Feedback anzeigen'),
icon: 'feedback',
emit: 'showFeedback',
});
}
}
if (this.oerEnableSuggestions && this.inCourse && this.userId !== this.structuralElement.relationships.owner.data.id) {
menu.push(
{ id: 8, label: this.$gettext('Seite für OER Campus vorschlagen'), icon: 'oer-campus',
emit: 'showSuggest' }
);
}
if (!document.documentElement.classList.contains('responsive-display')) {
menu.push(
{ id: 9, label: this.$gettext('Als Vollbild anzeigen'), icon: 'screen-full',
emit: 'activateFullscreen'},
);
}
if (this.canEdit) { if (this.canEdit) {
menu.push({ id: 1, label: this.$gettext('Seite hinzufügen'), icon: 'add', emit: 'addElement' });
menu.push({ id: 2, label: this.$gettext('Seite exportieren'), icon: 'export', emit: 'exportElement' });
menu.push({ id: 3, type: 'separator'});
if (this.blockedByAnotherUser && this.userIsTeacher) {
menu.push({
id: 4,
label: this.textRemoveLock.title,
icon: 'lock-unlocked',
emit: 'removeLock',
});
}
if (!this.blockedByAnotherUser) { if (!this.blockedByAnotherUser) {
menu.push({ menu.push({
id: 1, id: 5,
label: this.$gettext('Seiteneinstellungen'), label: this.$gettext('Seiteneinstellungen'),
icon: 'settings', icon: 'settings',
emit: 'editCurrentElement', emit: 'editCurrentElement',
}); });
if (this.userIsTeacher) { if (this.userIsTeacher) {
menu.push({ id: 7, type: 'separator'});
menu.push({ menu.push({
id: 2, id: 8,
label: this.commentable label: this.commentable
? this.$gettext('Kommentare abschalten') ? this.$gettext('Kommentare abschalten')
: this.$gettext('Kommentare aktivieren'), : this.$gettext('Kommentare aktivieren'),
...@@ -1184,35 +1165,64 @@ export default { ...@@ -1184,35 +1165,64 @@ export default {
}); });
if (!this.hasFeedback && !this.displayFeedback) { if (!this.hasFeedback && !this.displayFeedback) {
menu.push({ menu.push({
id: 3, id: 9,
label: this.$gettext('Anmerkungen aktivieren'), label: this.$gettext('Anmerkungen aktivieren'),
icon: 'exclaim-circle', icon: 'exclaim-circle',
emit: 'showNote' emit: 'showNote'
}); });
} }
} }
menu.push({ id: 11, type: 'separator'});
} }
if (this.blockedByAnotherUser && this.userIsTeacher) {
if (this.deletable && this.canEdit && !this.isTask && !this.blocked) {
menu.push({ menu.push({
id: 1, id: 6,
label: this.textRemoveLock.title, label: this.$gettext('Seite löschen'),
icon: 'lock-unlocked', icon: 'trash',
emit: 'removeLock', emit: 'deleteCurrentElement',
}); });
} }
menu.push({ id: 4, label: this.$gettext('Seite hinzufügen'), icon: 'add', emit: 'addElement' });
} }
if (this.context.type === 'users') { if (this.isFeedbackActivated) {
menu.push({ id: 10, label: this.$gettext('Öffentlichen Link erzeugen'), icon: 'group', emit: 'linkElement' }); if (this.canCreateFeedbackElement && !this.hasFeedbackElement) {
menu.push({
id: 10,
label: this.$gettext('Feedback aktivieren'),
icon: 'feedback',
emit: 'showFeedbackCreate',
});
} }
if (this.deletable && this.canEdit && !this.isTask && !this.blocked) { if (this.hasFeedbackElement) {
menu.push({ menu.push({
id: 11, id: 10,
label: this.$gettext('Seite löschen'), label: this.$gettext('Feedback anzeigen'),
icon: 'trash', icon: 'feedback',
emit: 'deleteCurrentElement', emit: 'showFeedback',
}); });
} }
}
menu.push({ id: 12, label: this.$gettext('Lesezeichen setzen'), icon: 'star', emit: 'setBookmark' });
if (this.oerEnableSuggestions && this.inCourse && this.userId !== this.structuralElement.relationships.owner.data.id) {
menu.push(
{ id: 13, label: this.$gettext('Seite für OER Campus vorschlagen'), icon: 'oer-campus',
emit: 'showSuggest' }
);
}
if (this.context.type === 'users') {
menu.push({ id: 14, label: this.$gettext('Öffentlichen Link erzeugen'), icon: 'group', emit: 'linkElement' });
}
if (!document.documentElement.classList.contains('responsive-display')) {
menu.push({ id: 15, type: 'separator'});
menu.push(
{ id: 16, label: this.$gettext('Als Vollbild anzeigen'), icon: 'screen-full',
emit: 'activateFullscreen'},
);
}
menu.sort((a, b) => a.id - b.id); menu.sort((a, b) => a.id - b.id);
return menu; return menu;
...@@ -1429,6 +1439,7 @@ export default { ...@@ -1429,6 +1439,7 @@ export default {
showElementEditDialog: 'showElementEditDialog', showElementEditDialog: 'showElementEditDialog',
showElementAddDialog: 'showElementAddDialog', showElementAddDialog: 'showElementAddDialog',
showElementAddChooserDialog: 'showElementAddChooserDialog', showElementAddChooserDialog: 'showElementAddChooserDialog',
showElementExportChooserDialog: 'showElementExportChooserDialog',
showElementExportDialog: 'showElementExportDialog', showElementExportDialog: 'showElementExportDialog',
showElementPdfExportDialog: 'showElementPdfExportDialog', showElementPdfExportDialog: 'showElementPdfExportDialog',
showElementInfoDialog: 'showElementInfoDialog', showElementInfoDialog: 'showElementInfoDialog',
...@@ -1494,6 +1505,9 @@ export default { ...@@ -1494,6 +1505,9 @@ export default {
this.errorEmptyChapterName = false; this.errorEmptyChapterName = false;
this.showElementAddChooserDialog(true); this.showElementAddChooserDialog(true);
break; break;
case 'exportElement':
this.showElementExportChooserDialog(true);
break;
case 'deleteCurrentElement': case 'deleteCurrentElement':
await this.loadStructuralElement(this.currentId); await this.loadStructuralElement(this.currentId);
if (this.blockedByAnotherUser) { if (this.blockedByAnotherUser) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment