Skip to content

Commit

Permalink
Merge pull request #840 from alpheios-project/i836-update-menu
Browse files Browse the repository at this point in the history
Update main menu
  • Loading branch information
irina060981 authored Jun 27, 2022
2 parents 486ffee + b6fd010 commit 8eb49f1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 26 deletions.
9 changes: 7 additions & 2 deletions src/vue/alignments-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<td class="alpheios-alignment-editor-alignments-table_link" @click="uploadAlignmentFromDB(alData)">
{{ formatHasTokens(alData.hasTokens) }}
</td>
<td class="alpheios-alignment-editor-alignments-table_delete-icon">
<td class="alpheios-alignment-editor-alignments-table_delete-icon" v-if="!menuVersion">
<span :id="removeId(alData)" class="alpheios-alignment-editor-alignments-table_delete-icon_span" @click="deleteAlignmentFromDB(alData)">
<delete-icon />
</span>
</td>
</tr>
</table>

<p class="alpheios-alignment-editor-alignments-clear-all" v-if="alignments.length > 0">
<p class="alpheios-alignment-editor-alignments-clear-all" v-if="!menuVersion && alignments.length > 0">
<button class="alpheios-editor-button-tertiary alpheios-actions-menu-button" @click="clearAllAlignments">Clear Alignments</button>
</p>
</div>
Expand All @@ -35,6 +35,11 @@ export default {
deleteIcon: DeleteIcon
},
props: {
menuVersion: {
type: Boolean,
required: false,
default: false
}
},
data () {
return {
Expand Down
1 change: 1 addition & 0 deletions src/vue/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@add-target = "addTarget"
@clear-all = "startOver"
@new-initial-alignment = "startNewInitialAlignment"
@upload-data-from-db = "uploadDataFromDB"

@showOptions = "showOptions"
@showSourceTextEditor = "showSourceTextEditor"
Expand Down
54 changes: 31 additions & 23 deletions src/vue/main-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@
<x-close-icon />
</span>
<div class="alpheios-alignment-app-menu__buttons">
<div class="alpheios-alignment-app-menu__buttons-blocks">
<button class="alpheios-app-menu-link" id ="alpheios-main-menu-source-editor" :class="{ 'alpheios-app-menu-link-current': currentPage === 'text-editor-page' }"
@click="showSourceTextEditor" >
{{ l10n.getMsgS('MAIN_MENU_TEXT_ENTER_LINK') }}
</button>
<button class="alpheios-app-menu-link" id ="alpheios-main-menu-alignment-groups-editor" :class="{ 'alpheios-app-menu-link-current': currentPage === 'align-editor-page' }"
@click="showAlignmentGroupsEditor" :disabled="!alignEditAvailable">
{{ l10n.getMsgS('MAIN_MENU_TEXT_ALIGN_LINK') }}
</button>
<button class="alpheios-app-menu-link" id ="alpheios-main-menu-tokens-editor" :class="{ 'alpheios-app-menu-link-current': currentPage === 'tokens-editor-page' }"
@click="showTokensEditor" :disabled="!tokensEditAvailable">
{{ l10n.getMsgS('MAIN_MENU_TEXT_EDIT_LINK') }}
</button>
</div>
<div class="alpheios-alignment-app-menu__buttons-actions">

<button class="alpheios-app-menu-link" id ="alpheios-main-menu-clear-all"
@click="clearAll">
{{ l10n.getMsgS('INITIAL_NEW_ALIGNMENT') }}
</button>

<button class="alpheios-app-menu-link" id ="alpheios-main-menu-upload"
@click="uploadTexts" >
Expand All @@ -33,12 +24,15 @@
{{ l10n.getMsgS('MAIN_MENU_CHOOSE_FILE') }}
</label>
</span>
<span> OR upload autosaved</span>
</div>

<div class="alpheios-alignment-editor-initial-screen__alignments-container" v-show="showUploadBlock" v-if="indexedDBAvailable">
<alignments-list
:menuVersion = "true"
@upload-data-from-db="uploadDataFromDB"
/>
</div>

<button class="alpheios-app-menu-link" id ="alpheios-main-menu-clear-all"
@click="clearAll">
{{ l10n.getMsgS('INITIAL_NEW_ALIGNMENT') }}
</button>
</div>
</div>
</div> <!--alpheios-alignment-app-menu-->
Expand All @@ -55,13 +49,16 @@ import UploadIcon from '@/inline-icons/upload.svg'
import XCloseIcon from '@/inline-icons/x-close.svg'
import Tooltip from '@/vue/common/tooltip.vue'
import AlignmentsList from '@/vue/alignments-list.vue'
export default {
name: 'MainMenu',
components: {
downloadIcon: DownloadIcon,
uploadIcon: UploadIcon,
xCloseIcon: XCloseIcon,
tooltip: Tooltip
tooltip: Tooltip,
alignmentsList: AlignmentsList
},
props: {
menuShow: {
Expand Down Expand Up @@ -129,6 +126,9 @@ export default {
},
tokensEditAvailable () {
return this.alignEditAvailable && this.enableTokensEditorOptionItemValue
},
indexedDBAvailable () {
return this.$textC.indexedDBAvailable
}
},
methods: {
Expand Down Expand Up @@ -244,18 +244,24 @@ export default {
this.$emit('showTokensEditor')
this.currentPage = 'tokens-editor-page'
this.closeMenu()
},
uploadDataFromDB (alData) {
this.$emit('upload-data-from-db', alData)
this.showUploadBlock = false
this.closeMenu()
}
}
}
</script>
<style lang="scss">
.alpheios-alignment-app-menu {
height: 100%;
width: 250px;
width: 400px;
position: fixed;
z-index: 10000;
top: 0;
left: -250px;
left: -400px;
background-color: #e0e0e0;
overflow-x: hidden;
Expand Down Expand Up @@ -297,7 +303,7 @@ export default {
padding: 10px 0;
border-top: 2px solid #ddd;
border-bottom: 2px solid #ddd;
// border-bottom: 2px solid #ddd;
}
.alpheios-main-menu-upload-block-radio-block_item,
Expand All @@ -306,6 +312,8 @@ export default {
}
.alpheios-main-menu-upload-block_item {
text-align: center;
&.alpheios-token-edit-actions-button {
width: 30px;
height: 30px;
Expand Down
4 changes: 3 additions & 1 deletion src/vue/text-editor/text-editor-single-block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ export default {
*/
async restartTextEditor () {
this.text = ''
this.$refs[this.fileUploadRef].value = ''
if (this.$refs[this.fileUploadRef]) {
this.$refs[this.fileUploadRef].value = ''
}
this.uploadFile = ''
this.prepareDefaultTextEditorOptions()
Expand Down

0 comments on commit 8eb49f1

Please sign in to comment.