-
Notifications
You must be signed in to change notification settings - Fork 28
feat: Add UI elements to modify navigation display #1295
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
Changes from 1 commit
7f8da4a
afcbe45
e05745a
6a693aa
04cd53e
41b5b24
4be1a7c
bd37daf
1ab79e7
b00f1c0
454844e
efab19c
f4f3277
4ab44af
e1e3737
30748c4
c925f42
4d5a063
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,22 +43,12 @@ | |
<NcContextResource :resources.sync="resources" :receivers.sync="receivers" /> | ||
</div> | ||
<div class="row space-T"> | ||
<div> | ||
{{ t('tables', 'Navigation bar display') }} | ||
</div> | ||
<NcCheckboxRadioSwitch :checked.sync="displayMode" value="NAV_ENTRY_MODE_HIDDEN" | ||
name="NAV_ENTRY_MODE_HIDDEN" type="radio"> | ||
Hide navigation entry for everybody | ||
</NcCheckboxRadioSwitch> | ||
<NcCheckboxRadioSwitch :checked.sync="displayMode" value="NAV_ENTRY_MODE_RECIPIENTS" | ||
name="NAV_ENTRY_MODE_RECIPIENTS" type="radio"> | ||
Show navigation entry for everybody, except me | ||
</NcCheckboxRadioSwitch> | ||
<NcCheckboxRadioSwitch :checked.sync="displayMode" value="NAV_ENTRY_MODE_ALL" name="NAV_ENTRY_MODE_ALL" | ||
type="radio"> | ||
Show navigation entry for everybody | ||
</NcCheckboxRadioSwitch> | ||
<br> | ||
<NcActionCheckbox :checked="showInNavigationDefault" @change="updateDisplayMode"> | ||
Show in app list | ||
</NcActionCheckbox> | ||
<p class="nav-display-subtext"> | ||
This can be overridden by a per-account preference | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be translatable |
||
</p> | ||
</div> | ||
<div class="row space-R row space-T"> | ||
<div class="fix-col-4 end"> | ||
|
@@ -72,7 +62,7 @@ | |
</template> | ||
|
||
<script> | ||
import { NcDialog, NcButton, NcIconSvgWrapper, NcCheckboxRadioSwitch } from '@nextcloud/vue' | ||
import { NcDialog, NcButton, NcIconSvgWrapper, NcActionCheckbox } from '@nextcloud/vue' | ||
import { showError } from '@nextcloud/dialogs' | ||
import '@nextcloud/dialogs/style.css' | ||
import NcContextResource from '../../shared/components/ncContextResource/NcContextResource.vue' | ||
|
@@ -90,7 +80,7 @@ export default { | |
NcButton, | ||
NcIconSvgWrapper, | ||
NcContextResource, | ||
NcCheckboxRadioSwitch, | ||
NcActionCheckbox, | ||
}, | ||
mixins: [svgHelper, permissionBitmask], | ||
props: { | ||
|
@@ -111,7 +101,7 @@ export default { | |
description: '', | ||
resources: [], | ||
receivers: [], | ||
displayMode: 'NAV_ENTRY_MODE_HIDDEN', | ||
showInNavigationDefault: false, | ||
} | ||
}, | ||
watch: { | ||
|
@@ -181,19 +171,23 @@ export default { | |
isUser: true, | ||
key: 'user-' + getCurrentUser().uid, | ||
}) | ||
const res = await this.$store.dispatch('insertNewContext', { data, previousReceivers: [], receivers: this.receivers, displayMode: NAV_ENTRY_MODE[this.displayMode] }) | ||
const displayMode = this.showInNavigation ? 'NAV_ENTRY_MODE_ALL' : 'NAV_ENTRY_MODE_HIDDEN' | ||
const res = await this.$store.dispatch('insertNewContext', { data, previousReceivers: [], receivers: this.receivers, displayMode: NAV_ENTRY_MODE[displayMode] }) | ||
if (res) { | ||
return res.id | ||
} else { | ||
showError(t('tables', 'Could not create new application')) | ||
} | ||
}, | ||
updateDisplayMode() { | ||
this.showInNavigation = !this.showInNavigation | ||
}, | ||
reset() { | ||
this.title = '' | ||
this.errorTitle = false | ||
this.setIcon(this.randomIcon()) | ||
this.customTitleChosen = false | ||
this.displayMode = 'NAV_ENTRY_MODE_HIDDEN' | ||
this.showInNavigationDefault = false | ||
}, | ||
}, | ||
} | ||
|
@@ -207,5 +201,13 @@ export default { | |
display: inline-flex; | ||
align-items: center; | ||
} | ||
|
||
.nav-display-subtext { | ||
color: var(--color-text-maxcontrast) | ||
} | ||
|
||
li { | ||
list-style: none; | ||
} | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,22 +39,14 @@ | |
<NcContextResource :resources.sync="resources" :receivers.sync="receivers" /> | ||
</div> | ||
<div class="row space-T"> | ||
<div> | ||
{{ t('tables', 'Navigation bar display') }} | ||
</div> | ||
<NcCheckboxRadioSwitch :checked.sync="displayMode" value="NAV_ENTRY_MODE_HIDDEN" | ||
name="NAV_ENTRY_MODE_HIDDEN" type="radio"> | ||
Hide navigation entry for everybody | ||
</NcCheckboxRadioSwitch> | ||
<NcCheckboxRadioSwitch :checked.sync="displayMode" value="NAV_ENTRY_MODE_RECIPIENTS" | ||
name="NAV_ENTRY_MODE_RECIPIENTS" type="radio"> | ||
Show navigation entry for everybody, except me | ||
</NcCheckboxRadioSwitch> | ||
<NcCheckboxRadioSwitch :checked.sync="displayMode" value="NAV_ENTRY_MODE_ALL" name="NAV_ENTRY_MODE_ALL" | ||
type="radio"> | ||
Show navigation entry for everybody | ||
</NcCheckboxRadioSwitch> | ||
<br> | ||
<NcActions> | ||
<NcActionCheckbox :checked="showInNavigationDefault" @change="updateDisplayMode"> | ||
Show in app list | ||
</NcActionCheckbox> | ||
</NcActions> | ||
<p class="nav-display-subtext"> | ||
This can be overridden by a per-account preference | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be translatable |
||
</p> | ||
</div> | ||
<div class="row space-T"> | ||
<div class="fix-col-4 space-T justify-between"> | ||
|
@@ -79,7 +71,7 @@ | |
</template> | ||
|
||
<script> | ||
import { NcDialog, NcButton, NcIconSvgWrapper, NcCheckboxRadioSwitch } from '@nextcloud/vue' | ||
import { NcDialog, NcButton, NcIconSvgWrapper, NcActionCheckbox } from '@nextcloud/vue' | ||
import { showError, showSuccess } from '@nextcloud/dialogs' | ||
import { getCurrentUser } from '@nextcloud/auth' | ||
import '@nextcloud/dialogs/style.css' | ||
|
@@ -100,7 +92,7 @@ export default { | |
NcIconPicker, | ||
NcIconSvgWrapper, | ||
NcContextResource, | ||
NcCheckboxRadioSwitch, | ||
NcActionCheckbox, | ||
}, | ||
mixins: [svgHelper, permissionBitmask, permissionsMixin], | ||
props: { | ||
|
@@ -129,7 +121,7 @@ export default { | |
PERMISSION_UPDATE, | ||
PERMISSION_DELETE, | ||
prepareDeleteContext: false, | ||
displayMode: 'NAV_ENTRY_MODE_HIDDEN', // TODO: get the actual saved display mode | ||
showInNavigationDefault: false, | ||
} | ||
}, | ||
computed: { | ||
|
@@ -154,6 +146,7 @@ export default { | |
this.description = context.description | ||
this.resources = context ? this.getContextResources(context) : [] | ||
this.receivers = context ? this.getContextReceivers(context) : [] | ||
this.showInNavigationDefault = this.getNavDisplay(context) | ||
} | ||
}, | ||
}, | ||
|
@@ -194,7 +187,8 @@ export default { | |
isUser: true, | ||
key: 'user-' + getCurrentUser().uid, | ||
}) | ||
const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, previousReceivers: Object.values(context.sharing), receivers: this.receivers }) | ||
const displayMode = this.showInNavigation ? 'NAV_ENTRY_MODE_ALL' : 'NAV_ENTRY_MODE_HIDDEN' | ||
const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, previousReceivers: Object.values(context.sharing), receivers: this.receivers, displayMode: NAV_ENTRY_MODE[displayMode] }) | ||
if (res) { | ||
showSuccess(t('tables', 'Updated application "{contextTitle}".', { contextTitle: this.title })) | ||
this.actionCancel() | ||
|
@@ -210,15 +204,15 @@ export default { | |
this.resources = context ? this.getContextResources(context) : [] | ||
this.receivers = context ? this.getContextReceivers(context) : [] | ||
this.prepareDeleteContext = false | ||
this.showInNavigationDefault = this.getNavDisplay(context) | ||
}, | ||
getDisplayMode(context) { | ||
getNavDisplay(context) { | ||
const shares = Object.keys(context.sharing || {}) | ||
if (shares.length) { | ||
print('vals', context.sharing[shares[0]]) | ||
const displayMode = context.sharing[shares[0]].display_mode_default | ||
return Object.keys(NAV_ENTRY_MODE).find(key => NAV_ENTRY_MODE[key] === displayMode) | ||
return displayMode !== 0 | ||
} | ||
return 'NAV_ENTRY_MODE_HIDDEN' | ||
return false | ||
}, | ||
getContextReceivers(context) { | ||
let sharing = Object.values(context.sharing) | ||
|
@@ -276,6 +270,9 @@ export default { | |
} | ||
|
||
}, | ||
updateDisplayMode() { | ||
this.showInNavigation = !this.showInNavigation | ||
}, | ||
actionTransfer() { | ||
emit('tables:context:edit', null) | ||
emit('tables:context:transfer', this.localContext) | ||
|
@@ -296,4 +293,12 @@ export default { | |
padding-inline: 0 !important; | ||
max-width: 100%; | ||
} | ||
|
||
.nav-display-subtext { | ||
color: var(--color-text-maxcontrast) | ||
} | ||
|
||
li { | ||
list-style: none; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ | |
{{ t('tables', 'Delete application') }} | ||
</NcActionButton> | ||
<NcActionCheckbox :checked="showInNavigation" @change="updateDisplayMode"> | ||
Show in Navigation | ||
Show in app list | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be translatable |
||
</NcActionCheckbox> | ||
</template> | ||
</NcAppNavigationItem> | ||
|
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.
Should be translatable