Commit 48f85d0a authored by GuiΩ's avatar GuiΩ
Browse files

feat(contextMenu): fusion FLFS and FLFSS context menus

parent 61b0be87
......@@ -204,16 +204,21 @@ Events:
onClick(event)
await nextTick()
}
onShowContextMenu({event: event, options: []})
}
function onShowContextMenu({event:event, options: options}: {event: MouseEvent, options: IContextMenuOption[]}) {
// emit('set-selection', {seances: [ props.seanceId ]})
if (options.length)
options.push({type: 'rule'})
const multipleSel = props.selection.seances.length > 1
const multipleClip = props.clipboard.seances.length > 1
emit('show-context-menu', {
event: event, options: [
{
options.push({
name: 'Copier ' + (multipleSel ? ' les seances' : 'la seance'),
callback: () => emit('copy', event)
},
{
})
options.push({
name: 'Couper ' + (multipleSel ? ' les seances' : 'la seance'),
disabled: !(selectionIsDeletable.value && isDeletable.value),
callback: () => {
......@@ -221,24 +226,24 @@ Events:
nextTick();
undoables.deleteSeances(props.selection.seances)
}
},
{
})
options.push({
name: 'Supprimer ' + (multipleSel ? 'les seances' : 'la seance'),
disabled: !(selectionIsDeletable.value && isDeletable.value),
callback: () => undoables.deleteSeances(props.selection.seances)
},
{
})
options.push({
name: 'Insérer ' + (multipleClip ? 'les seances' : 'la seance') + ' avant',
disabled: props.clipboard.seances.length < 1,
callback: () => pasteSeance(seance.value?.position!)
},
{
})
options.push({
name: 'Insérer ' + (multipleClip ? 'les seances' : 'la seance') + ' après',
disabled: props.clipboard.seances.length < 1,
callback: () => pasteSeance(seance.value?.position! + 1)
},
{name: 'Annuler'}]
})
})
options.push({name: 'Annuler'})
emit('show-context-menu', {event: event, options: options})
}
......@@ -287,12 +292,12 @@ Events:
:scoreEditing="state.scoresEditing"
@loaded="$emit('loaded', $event)"
@focus-next="focusNext(position)"
@contextmenu="onContextMenu"
@contextmenu.prevent="onContextMenu"
@message="$emit('message', $event)"
@question-edit="$emit('question-edit', $event)"
@question-drop="$emit('question-drop', $event)"
@show-question-tooltip="$emit('show-question-tooltip', $event)"
@show-context-menu="$emit('show-context-menu', $event)")/
@show-context-menu="onShowContextMenu")/
.Seance_footer
button(v-if="! state.scoresEditing" @click="showEvaluate") Saisir les notes
button.valider(v-if="state.scoresEditing" :ref="(el) => btnScoreSave=el" @click="save") Valider
......
......@@ -102,14 +102,13 @@ Events:
console.debug('FLFSS.onContextMenu', question.value.id)
emit('show-context-menu', {
event: event, options: [
{ name: 'Éditer',
disabled: ! permissions.includes('Validateur'),
{ name: 'Éditer la question',
hidden: ! permissions.includes('Validateur'),
callback: () => emit('question-edit', {questionId: question.value.id, action: 'edit'})},
{ name: 'Enlever',
{ name: 'Enlever la question',
disabled: questionPosee.value!.score !== null,
callback: () => undoables.deleteQuestionPosee(questionPosee.value!)},
{name: 'Propriétés', callback: (event: MouseEvent) => onClick(event)},
{name: 'Annuler'}
{name: 'Propriétés de la question', callback: (event: MouseEvent) => onClick(event)},
]})
}
......@@ -218,11 +217,10 @@ Events:
@dragover.prevent="onDragOver($event, questionPosee)"
@dragleave.prevent="onDragLeave()"
@dragenter.prevent
@contextmenu.prevent
)
.QuestionSlot_questionPosee(
v-if="questionPosee"
@contextmenu.prevent="onContextMenu")
@contextmenu.prevent.stop="onContextMenu")
Score(:score="questionPosee.score")
.saise(v-if="scoreEditing")
input(ref="input" v-model.number.trim="newScore" size="2" @change="onInput($event)" @input="onInput($event)")
......
......@@ -78,8 +78,6 @@ import type {QuestionID, ThemeID} from "@/types";
v-for="question_order in question.themes"
@click="setSelection(question_order.theme, state.questionId)")
| {{ themePath(question_order.theme) }}
span(:class="{atrier: question_order.position === null}")
| {{ question_order.position !== null ? ('(position: ' + question_order.position + ')') : '(non positionnée)' }}
</template>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment