Skip to content

Commit

Permalink
Removed favorite button from file list and added it instead in action…
Browse files Browse the repository at this point in the history
… dropdown
  • Loading branch information
Julian1998 committed Apr 14, 2020
1 parent 628c8c8 commit fcb6799
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 31 deletions.
19 changes: 0 additions & 19 deletions apps/files/src/components/AllFilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<file-list :fileData="fileData" id="files-list" :loading="loadingFolder" :actions="actions" :compactMode="_sidebarOpen"
:isActionEnabled="isActionEnabled">
<template #headerColumns>
<div v-if="!publicPage()">
<span class="oc-visually-hidden" v-text="favoritesHeaderText" />
<oc-star id="files-table-header-star" aria-hidden="true" class="uk-display-block uk-disabled" />
</div>
<div class="uk-text-truncate uk-text-meta uk-width-expand" ref="headerNameColumn" >
<sortable-column-header
@click="toggleSort('name')"
Expand Down Expand Up @@ -44,9 +40,6 @@
</div>
</template>
<template #rowColumns="{ item, index }">
<div v-if="!publicPage()">
<oc-star class="uk-display-block" @click.native.stop="toggleFileFavorite(item)" :shining="item.starred" />
</div>
<div class="uk-text-truncate uk-width-expand" :ref="index === 0 ? 'firstRowNameColumn' : null">
<file-item
@click.native.stop="item.type === 'folder' ? navigateTo(item.path.substr(1)) : openFileActionBar(item)"
Expand Down Expand Up @@ -141,11 +134,6 @@ export default {
FileActions
],
props: ['fileData', 'starsEnabled', 'checkboxEnabled', 'dateEnabled', 'parentFolder'],
data () {
return {
favoritesHeaderText: this.$gettext('Favorites')
}
},
computed: {
...mapState(['route']),
...mapGetters('Files', [
Expand Down Expand Up @@ -237,7 +225,6 @@ export default {
methods: {
...mapActions('Files', [
'loadFolder',
'markFavorite',
'setHighlightedFile'
]),
Expand Down Expand Up @@ -289,12 +276,6 @@ export default {
})
})
},
toggleFileFavorite (item) {
this.markFavorite({
client: this.$client,
file: item
})
},
isActionEnabled (item, action) {
return action.isEnabled(item, this.parentFolder)
Expand Down
10 changes: 8 additions & 2 deletions apps/files/src/components/FileDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<span id="files-sidebar-item-name" class="uk-margin-small-right uk-text-bold" v-text="highlightedFile.name" />
</div>
<div v-if="$route.name !== 'files-shared-with-others'">
<oc-star v-if="!publicPage()" class="uk-inline" :shining="highlightedFile.starred"/>
<oc-star v-if="!publicPage()" @click.native.stop="toggleFileFavorite(highlightedFile)" class="uk-inline" :shining="highlightedFile.starred"/>
<template v-if="highlightedFile.size > -1">
{{ highlightedFile.size | fileSize }},
</template>
Expand Down Expand Up @@ -73,13 +73,19 @@ export default {
this.activeTab = this.defaultTab
},
methods: {
...mapActions('Files', ['deleteFiles']),
...mapActions('Files', ['deleteFiles', 'markFavorite']),
...mapActions(['showMessage']),
close () {
this.$emit('reset')
},
showSidebar (app) {
this.activeTab = app
},
toggleFileFavorite (file) {
this.markFavorite({
client: this.$client,
file: file
})
}
}
}
Expand Down
8 changes: 1 addition & 7 deletions apps/files/src/components/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,14 @@ export default {
}
},
methods: {
...mapActions('Files', ['loadFolder', 'markFavorite',
...mapActions('Files', ['loadFolder',
'setHighlightedFile', 'setPublicLinkPassword',
'resetFileSelection', 'addFileSelection', 'removeFileSelection', 'toggleFileSelection'
]),
labelSelectSingleItem (item) {
return this.$gettextInterpolate(this.labelSelectSingleItemText, { name: item.name, type: item.type }, true)
},
toggleFileFavorite (item) {
this.markFavorite({
client: this.$client,
file: item
})
},
$_ocFileName (item) {
if (this.$route.name === 'files-favorites') {
const pathSplit = item.path.substr(1).split('/')
Expand Down
27 changes: 24 additions & 3 deletions apps/files/src/fileactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ export default {
}
return item.canBeDeleted()
}
},
{
icon: 'star',
handler: this.toggleFileFavorite,
ariaLabel: this.$gettext('Mark/Unmark as favorite'),
isEnabled: function () {
return true
}
}
]
// FIXME: we are assuming this.fileSideBars and others are available on object
Expand All @@ -66,7 +74,8 @@ export default {
methods: {
...mapActions('Files', [
'renameFile', 'promptFileRename', 'closePromptFileRename',
'deleteFiles', 'promptFileDelete', 'closePromptFileDelete'
'deleteFiles', 'promptFileDelete', 'closePromptFileDelete',
'markFavorite'
]),
...mapActions(['showMessage']),

Expand Down Expand Up @@ -112,7 +121,19 @@ export default {
this.closePromptFileRename()
})
},

toggleFileFavorite (file) {
this.markFavorite({
client: this.$client,
file: file
}).catch(() => {
const translated = this.$gettext('Error while starring "%{file}"')
const title = this.$gettextInterpolate(translated, { file: file.name }, true)
this.showMessage({
title: title,
status: 'danger'
})
})
},
cancelDeleteFile () {
this.closePromptFileDelete()
},
Expand All @@ -125,7 +146,7 @@ export default {
})
},
reallyDeleteFiles () {
let files = this.deleteDialogSelectedFiles ? this.deleteDialogSelectedFiles : this.selectedFiles
let files = this.dfavoriteFileeleteDialogSelectedFiles ? this.deleteDialogSelectedFiles : this.selectedFiles
if (!Array.isArray(files)) {
files = [files]
}
Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/3336
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Change: Removed favorite button from file list and added it instead in action dropdown

We've removed the favorite star button in the file list and added instead a functionality
to the before non-working star button in the file's sidebar. We also added a new action in
the file action dropdown menu which allows you to toggle the favorite status of your file.

https://github.com/owncloud/phoenix/issues/1987
https://github.com/owncloud/phoenix/pull/3336

0 comments on commit fcb6799

Please sign in to comment.