-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.1] Refactor vue browser items #35887
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
Merged
bembelimen
merged 36 commits into
joomla:4.1-dev
from
Digital-Peak:j4/refactor/vue/browser
Nov 13, 2021
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
b2f1ba4
docker-compose for development
JenSeReal d795d25
added pdf component and query for pdfs
JenSeReal 5b78108
added action items and created toggle
JenSeReal a714889
added action items and created toggle
JenSeReal 2a57795
fixed refs of vue components
JenSeReal 8834d8d
fixed refs of vue components
JenSeReal 382127a
working preview action item button
JenSeReal 6c6c053
working download button and destuctured export
JenSeReal 52afb9c
add delete & share component
tw-ekonic 0ba7f47
add edit component
tw-ekonic c113ecd
refactoring & typos
JenSeReal 4b86ba2
test items-container
tw-ekonic c300f9d
testing action items container
JenSeReal 41065b3
fix edit items
tw-ekonic 1a87a96
working can edit
JenSeReal 2fe083d
final refactoring for pull request
JenSeReal 529c467
final refactoring for pull request
JenSeReal 2d43627
final refactoring for pull request
JenSeReal c18761f
Merge remote-tracking branch 'upstream/4.1-dev' into 4.1-dev-media-ma…
JenSeReal 4524703
merged latest 4.1 dev
JenSeReal 4ed2d73
fixed eslint recommendations
JenSeReal fab917d
fixed bug with preview
JenSeReal 489d268
reverted package-lock.json
JenSeReal bc42712
Merge remote-tracking branch 'vue/4.1-dev-media-manager-action-items'…
laoneo f04e95c
Merge remote-tracking branch 'upstream/4.1-dev' into j4/refactor/vue/…
laoneo e64bfb0
fix conflicts
laoneo f6d1178
Adapt code from #35451
laoneo 6cda75f
Update administrator/components/com_media/resources/scripts/component…
laoneo 963c2b4
Update administrator/components/com_media/resources/scripts/component…
laoneo 3379fcc
Update administrator/components/com_media/resources/scripts/component…
laoneo eafb1ec
cs
laoneo 3dfdcce
Merge branch 'j4/refactor/vue/browser' of github.com:Digital-Peak/joo…
laoneo e972603
more cs
laoneo 9d2d7c5
Restore doublce click handler
laoneo 200ead0
Merge branch '4.1-dev' into j4/refactor/vue/browser
laoneo b74d00b
Merge branch '4.1-dev' into j4/refactor/vue/browser
laoneo 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
203 changes: 203 additions & 0 deletions
203
...nents/com_media/resources/scripts/components/browser/actionItems/actionItemsContainer.vue
This file contains hidden or 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,203 @@ | ||
| <template> | ||
| <span | ||
| class="media-browser-select" | ||
| :aria-label="translate('COM_MEDIA_TOGGLE_SELECT_ITEM')" | ||
| :title="translate('COM_MEDIA_TOGGLE_SELECT_ITEM')" | ||
| /> | ||
| <div | ||
| class="media-browser-actions" | ||
| :class="{ active: showActions }" | ||
| > | ||
| <media-browser-action-item-toggle | ||
| ref="actionToggle" | ||
| :on-focused="focused" | ||
| :main-action="openActions" | ||
| @keyup.up="openLastActions()" | ||
| @keyup.down="openActions()" | ||
| /> | ||
| <div | ||
| v-if="showActions" | ||
| class="media-browser-actions-list" | ||
| > | ||
| <ul> | ||
| <li> | ||
| <media-browser-action-item-preview | ||
| v-if="previewable" | ||
| ref="actionPreview" | ||
| :on-focused="focused" | ||
| :main-action="openPreview" | ||
| :closing-action="hideActions" | ||
| @keyup.up="$refs.actionDelete.$el.focus()" | ||
| @keyup.down="$refs.actionDownload.$el.focus()" | ||
| /> | ||
| </li> | ||
| <li> | ||
| <media-browser-action-item-download | ||
| v-if="downloadable" | ||
| ref="actionDownload" | ||
| :on-focused="focused" | ||
| :main-action="download" | ||
| :closing-action="hideActions" | ||
| @keyup.up="$refs.actionPreview.$el.focus()" | ||
| @keyup.down="$refs.actionRename.$el.focus()" | ||
| /> | ||
| </li> | ||
| <li> | ||
| <media-browser-action-item-rename | ||
| ref="actionRename" | ||
| :on-focused="focused" | ||
| :main-action="openRenameModal" | ||
| :closing-action="hideActions" | ||
| @keyup.up=" | ||
| downloadable | ||
| ? $refs.actionDownload.$el.focus() | ||
| : $refs.actionDelete.$el.focus() | ||
| " | ||
| @keyup.down=" | ||
| canEdit | ||
| ? $refs.actionEdit.$el.focus() | ||
| : shareable | ||
| ? $refs.actionShare.$el.focus() | ||
| : $refs.actionDelete.$el.focus() | ||
| " | ||
| /> | ||
| </li> | ||
| <li> | ||
| <media-browser-action-item-edit | ||
| v-if="canEdit" | ||
| ref="actionEdit" | ||
| :on-focused="focused" | ||
| :main-action="editItem" | ||
| :closing-action="hideActions" | ||
| @keyup.up="$refs.actionRename.$el.focus()" | ||
| @keyup.down="$refs.actionShare.$el.focus()" | ||
| /> | ||
| </li> | ||
| <li> | ||
| <media-browser-action-item-share | ||
| v-if="shareable" | ||
| ref="actionShare" | ||
| :on-focused="focused" | ||
| :main-action="openShareUrlModal" | ||
| :closing-action="hideActions" | ||
| @keyup.up=" | ||
| canEdit | ||
| ? $refs.actionEdit.$el.focus() | ||
| : $refs.actionRename.$el.focus() | ||
| " | ||
| @keyup.down="$refs.actionDelete.$el.focus()" | ||
| /> | ||
| </li> | ||
| <li> | ||
| <media-browser-action-item-delete | ||
| ref="actionDelete" | ||
| :on-focused="focused" | ||
| :main-action="openConfirmDeleteModal" | ||
| :hide-actions="hideActions" | ||
| @keyup.up=" | ||
| shareable | ||
| ? $refs.actionShare.$el.focus() | ||
| : $refs.actionRename.$el.focus() | ||
| " | ||
| @keyup.down=" | ||
| previewable | ||
| ? $refs.actionPreview.$el.focus() | ||
| : $refs.actionRename.$el.focus() | ||
| " | ||
| /> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
| import * as types from '../../../store/mutation-types.es6'; | ||
|
|
||
| export default { | ||
| name: 'MediaBrowserActionItemsContainer', | ||
| props: { | ||
| item: { type: Object, default: () => {} }, | ||
| onFocused: { type: Function, default: () => {} }, | ||
| edit: { type: Function, default: () => {} }, | ||
| editable: { type: Function, default: () => false }, | ||
| previewable: { type: Boolean, default: false }, | ||
| downloadable: { type: Boolean, default: false }, | ||
| shareable: { type: Boolean, default: false }, | ||
| }, | ||
| data() { | ||
| return { | ||
| showActions: false, | ||
| }; | ||
| }, | ||
| computed: { | ||
| /* Check if the item is an document to edit */ | ||
| canEdit() { | ||
| return this.editable(); | ||
| }, | ||
| }, | ||
| watch: { | ||
| // eslint-disable-next-line | ||
| "$store.state.showRenameModal"(show) { | ||
| if ( | ||
| !show | ||
| && this.$refs.actionToggle | ||
| && this.$store.state.selectedItems.find( | ||
| (item) => item.name === this.item.name, | ||
| ) !== undefined | ||
| ) { | ||
| this.$refs.actionToggle.$el.focus(); | ||
| } | ||
| }, | ||
| }, | ||
| methods: { | ||
| /* Hide actions dropdown */ | ||
| hideActions() { | ||
| this.showActions = false; | ||
| }, | ||
| /* Preview an item */ | ||
| openPreview() { | ||
| this.$store.commit(types.SHOW_PREVIEW_MODAL); | ||
| this.$store.dispatch('getFullContents', this.item); | ||
| }, | ||
| /* Download an item */ | ||
| download() { | ||
| this.$store.dispatch('download', this.item); | ||
| }, | ||
| /* Opening confirm delete modal */ | ||
| openConfirmDeleteModal() { | ||
| this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS); | ||
| this.$store.commit(types.SELECT_BROWSER_ITEM, this.item); | ||
| this.$store.commit(types.SHOW_CONFIRM_DELETE_MODAL); | ||
| }, | ||
| /* Rename an item */ | ||
| openRenameModal() { | ||
| this.hideActions(); | ||
| this.$store.commit(types.SELECT_BROWSER_ITEM, this.item); | ||
| this.$store.commit(types.SHOW_RENAME_MODAL); | ||
| }, | ||
| /* Open modal for share url */ | ||
| openShareUrlModal() { | ||
| this.$store.commit(types.SELECT_BROWSER_ITEM, this.item); | ||
| this.$store.commit(types.SHOW_SHARE_MODAL); | ||
| }, | ||
| /* Open actions dropdown */ | ||
| openActions() { | ||
| this.showActions = true; | ||
| if (this.previewable) { | ||
| this.$nextTick(() => this.$refs.actionPreview.$el.focus()); | ||
| } else { | ||
| this.$nextTick(() => this.$refs.actionRename.$el.focus()); | ||
| } | ||
| }, | ||
| /* Open actions dropdown and focus on last element */ | ||
| openLastActions() { | ||
| this.showActions = true; | ||
| this.$nextTick(() => this.$refs.actionDelete.$el.focus()); | ||
| }, | ||
| editItem() { | ||
| this.edit(); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> | ||
41 changes: 41 additions & 0 deletions
41
...istrator/components/com_media/resources/scripts/components/browser/actionItems/delete.vue
This file contains hidden or 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,41 @@ | ||
| <template> | ||
| <button | ||
| type="button" | ||
| class="action-delete" | ||
| :aria-label="translate('COM_MEDIA_ACTION_DELETE')" | ||
| :title="translate('COM_MEDIA_ACTION_DELETE')" | ||
| @keyup.enter="openConfirmDeleteModal()" | ||
| @keyup.space="openConfirmDeleteModal()" | ||
| @focus="focused(true)" | ||
| @blur="focused(false)" | ||
| @keyup.esc="hideActions()" | ||
| > | ||
| <span | ||
| class="image-browser-action icon-trash" | ||
| aria-hidden="true" | ||
| @click.stop="openConfirmDeleteModal()" | ||
| /> | ||
| </button> | ||
| </template> | ||
|
|
||
| <script> | ||
| export default { | ||
| name: 'MediaBrowserActionItemDelete', | ||
| props: { | ||
| onFocused: { type: Function, default: () => {} }, | ||
| mainAction: { type: Function, default: () => {} }, | ||
| closingAction: { type: Function, default: () => {} }, | ||
| }, | ||
| methods: { | ||
| openConfirmDeleteModal() { | ||
| this.mainAction(); | ||
| }, | ||
| hideActions() { | ||
| this.hideActions(); | ||
| }, | ||
| focused(bool) { | ||
| this.onFocused(bool); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
41 changes: 41 additions & 0 deletions
41
...trator/components/com_media/resources/scripts/components/browser/actionItems/download.vue
This file contains hidden or 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,41 @@ | ||
| <template> | ||
| <button | ||
| type="button" | ||
| class="action-download" | ||
| :aria-label="translate('COM_MEDIA_ACTION_DOWNLOAD')" | ||
| :title="translate('COM_MEDIA_ACTION_DOWNLOAD')" | ||
| @keyup.enter="download()" | ||
| @keyup.space="download()" | ||
| @focus="focused(true)" | ||
| @blur="focused(false)" | ||
| @keyup.esc="hideActions()" | ||
| > | ||
| <span | ||
| class="image-browser-action icon-download" | ||
| aria-hidden="true" | ||
| @click.stop="download()" | ||
| /> | ||
| </button> | ||
| </template> | ||
|
|
||
| <script> | ||
| export default { | ||
| name: 'MediaBrowserActionItemDownload', | ||
| props: { | ||
| onFocused: { type: Function, default: () => {} }, | ||
| mainAction: { type: Function, default: () => {} }, | ||
| closingAction: { type: Function, default: () => {} }, | ||
| }, | ||
| methods: { | ||
| download() { | ||
| this.mainAction(); | ||
| }, | ||
| hideActions() { | ||
| this.closingAction(); | ||
| }, | ||
| focused(bool) { | ||
| this.onFocused(bool); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
44 changes: 44 additions & 0 deletions
44
administrator/components/com_media/resources/scripts/components/browser/actionItems/edit.vue
This file contains hidden or 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,44 @@ | ||
| <template> | ||
| <button | ||
| type="button" | ||
| class="action-edit" | ||
| :aria-label="translate('COM_MEDIA_ACTION_EDIT')" | ||
| :title="translate('COM_MEDIA_ACTION_EDIT')" | ||
| @keyup.enter="editItem()" | ||
| @keyup.space="editItem()" | ||
| @focus="focused(true)" | ||
| @blur="focused(false)" | ||
| @keyup.esc="hideActions()" | ||
| > | ||
| <span | ||
| class="image-browser-action icon-pencil-alt" | ||
| aria-hidden="true" | ||
| @click.stop="editItem()" | ||
| /> | ||
| </button> | ||
| </template> | ||
|
|
||
| <script> | ||
| export default { | ||
| name: 'MediaBrowserActionItemEdit', | ||
| props: { | ||
| onFocused: { type: Function, default: () => {} }, | ||
| mainAction: { type: Function, default: () => {} }, | ||
| closingAction: { type: Function, default: () => {} }, | ||
| }, | ||
| methods: { | ||
| openRenameModal() { | ||
| this.mainAction(); | ||
| }, | ||
| hideActions() { | ||
| this.closingAction(); | ||
| }, | ||
| focused(bool) { | ||
| this.onFocused(bool); | ||
| }, | ||
| editItem() { | ||
| this.mainAction(); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
12 changes: 12 additions & 0 deletions
12
...rator/components/com_media/resources/scripts/components/browser/actionItems/export.es6.js
This file contains hidden or 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,12 @@ | ||
| import Rename from './rename.vue'; | ||
| import Toggle from './toggle.vue'; | ||
| import Preview from './preview.vue'; | ||
| import Download from './download.vue'; | ||
| import Share from './share.vue'; | ||
| import Delete from './delete.vue'; | ||
| import Edit from './edit.vue'; | ||
| import Container from './actionItemsContainer.vue'; | ||
|
|
||
| export { | ||
| Rename, Toggle, Preview, Download, Share, Delete, Edit, Container, | ||
| }; |
41 changes: 41 additions & 0 deletions
41
...strator/components/com_media/resources/scripts/components/browser/actionItems/preview.vue
This file contains hidden or 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,41 @@ | ||
| <template> | ||
| <button | ||
| type="button" | ||
| class="action-preview" | ||
| :aria-label="translate('COM_MEDIA_ACTION_PREVIEW')" | ||
| :title="translate('COM_MEDIA_ACTION_PREVIEW')" | ||
| @keyup.enter="openPreview()" | ||
| @keyup.space="openPreview()" | ||
| @focus="focused(true)" | ||
| @blur="focused(false)" | ||
| @keyup.esc="hideActions()" | ||
| > | ||
| <span | ||
| class="image-browser-action icon-search-plus" | ||
| aria-hidden="true" | ||
| @click.stop="openPreview()" | ||
| /> | ||
| </button> | ||
| </template> | ||
|
|
||
| <script> | ||
| export default { | ||
| name: 'MediaBrowserActionItemPreview', | ||
| props: { | ||
| onFocused: { type: Function, default: () => {} }, | ||
| mainAction: { type: Function, default: () => {} }, | ||
| closingAction: { type: Function, default: () => {} }, | ||
| }, | ||
| methods: { | ||
| openPreview() { | ||
| this.mainAction(); | ||
| }, | ||
| hideActions() { | ||
| this.closingAction(); | ||
| }, | ||
| focused(bool) { | ||
| this.onFocused(bool); | ||
| }, | ||
| }, | ||
| }; | ||
| </script> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.