-
Notifications
You must be signed in to change notification settings - Fork 2
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
display import modal #3
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fc5fcb0
display import modal
ETLaurent 5f35223
text left
ETLaurent 6d1acc6
display modal in page manager and handle focus
ETLaurent f999f20
rename to AposImportModal
ETLaurent e46df1b
use v-html to use link in translations
ETLaurent b1618cc
abc
ETLaurent 7b08725
change modal title and confirmation button
ETLaurent 56f5944
finakl
ETLaurent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
improve: '@apostrophecms/page', | ||
|
||
utilityOperations (self) { | ||
if (self.options.import === false) { | ||
return {}; | ||
} | ||
|
||
return { | ||
add: { | ||
import: { | ||
label: 'aposImportExport:import', | ||
modalOptions: { | ||
modal: 'AposImportModal' | ||
}, | ||
messages: { | ||
progress: 'Importing {{ type }}...' | ||
}, | ||
requestOptions: { | ||
extension: 'zip' | ||
} | ||
} | ||
} | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<template> | ||
<AposModal | ||
class="apos-import" | ||
:modal="modal" | ||
@esc="cancel" | ||
@no-modal="$emit('safe-close')" | ||
@inactive="modal.active = false" | ||
@show-modal="modal.showModal = true" | ||
@ready="ready" | ||
> | ||
<template #main> | ||
<AposModalBody> | ||
<template #bodyMain> | ||
<h2 class="apos-import__heading"> | ||
{{ $t('aposImportExport:importDocuments') }} | ||
</h2> | ||
<!-- eslint-disable vue/no-v-html --> | ||
<p | ||
class="apos-import__description" | ||
v-html="$t('aposImportExport:importModalDescription')" | ||
/> | ||
<!-- eslint-enable vue/no-v-html --> | ||
<AposFile | ||
class="apos-import__file" | ||
allowed-extensions=".zip" | ||
@upload-file="uploadImportFile" | ||
@update="updateImportFile" | ||
/> | ||
<div class="apos-import__btns"> | ||
<AposButton | ||
ref="cancelButton" | ||
class="apos-import__btn" | ||
label="apostrophe:cancel" | ||
@click="cancel" | ||
/> | ||
<AposButton | ||
class="apos-import__btn" | ||
icon="apos-import-export-upload-icon" | ||
label="aposImportExport:import" | ||
type="primary" | ||
:disabled="!selectedFile" | ||
@click="runImport" | ||
/> | ||
</div> | ||
</template> | ||
</AposModalBody> | ||
</template> | ||
</AposModal> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
emits: [ 'safe-close' ], | ||
data () { | ||
return { | ||
modal: { | ||
active: false, | ||
type: 'overlay', | ||
showModal: false, | ||
disableHeader: true | ||
}, | ||
selectedFile: null | ||
}; | ||
}, | ||
mounted() { | ||
this.modal.active = true; | ||
}, | ||
methods: { | ||
ready() { | ||
this.$refs.cancelButton.$el.querySelector('button').focus(); | ||
}, | ||
uploadImportFile (file) { | ||
this.selectedFile = file || null; | ||
}, | ||
updateImportFile () { | ||
this.selectedFile = null; | ||
}, | ||
cancel () { | ||
this.modal.active = false; | ||
this.modal.showModal = false; | ||
}, | ||
async runImport () { | ||
// TODO: implement | ||
|
||
this.modal.showModal = false; | ||
} | ||
} | ||
}; | ||
</script> | ||
|
||
<style scoped lang='scss'> | ||
.apos-import { | ||
z-index: $z-index-modal; | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
&__heading { | ||
@include type-title; | ||
line-height: var(--a-line-tall); | ||
margin: 0; | ||
} | ||
|
||
&__description { | ||
@include type-base; | ||
max-width: 370px; | ||
line-height: var(--a-line-tallest); | ||
} | ||
|
||
&__file { | ||
min-width: 370px; | ||
} | ||
|
||
&__btns { | ||
display: flex; | ||
justify-content: space-between; | ||
margin-top: 10px; | ||
width: 100%; | ||
} | ||
|
||
&__btn { | ||
& + & { | ||
margin-left: $spacing-double; | ||
} | ||
} | ||
} | ||
|
||
::v-deep { | ||
.apos-modal__inner { | ||
top: auto; | ||
right: auto; | ||
bottom: auto; | ||
left: auto; | ||
max-width: 700px; | ||
height: auto; | ||
text-align: left; | ||
} | ||
|
||
.apos-modal__body-main { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: baseline; | ||
} | ||
} | ||
|
||
</style> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the ticket, the option name is
shareDocsDisableImport
. Not sure it's a good one since he module is calledimport-export
but we might check.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's why Anthony has changed it to
export
.I did the same with
import
so we can disable the export and not the import, and vice versa.We could still change the name later I think.