Add global alternative display mode (grid or list) as an user option

This commit is contained in:
Bubka 2020-05-02 17:55:41 +02:00
parent 1acedf5e28
commit 9963bdea41
7 changed files with 99 additions and 70 deletions

View File

@ -36,6 +36,7 @@
'showTokenAsDot' => false,
'closeTokenOnCopy' => false,
'useBasicQrcodeReader' => false,
'displayMode' => 'list',
],
/*

View File

@ -101,7 +101,13 @@ export default {
"use_basic_qrcode_reader": {
"label": "Use basic qrcode reader",
"help": "If you experiences issues when capturing qrCodes enables this option to switch to a more basic but more reliable qrcode reader"
}
},
"desktop_display_mode": {
"label": "Desktop display mode",
"help": "Choose whether you want accounts to be displayed as a list or as a grid on desktop"
},
"grid": "Grid",
"list": "List"
}
},
"twofaccounts": {
@ -383,7 +389,13 @@ export default {
"use_basic_qrcode_reader": {
"label": "Utiliser le lecteur de qrcode basique",
"help": "Si vous rencontrez des problèmes lors de la lecture des qrCodes activez cette option pour utiliser un lecteur de qrcode moins évolué mais plus largement compatible"
}
},
"desktop_display_mode": {
"label": "Mode d'affichage Desktop",
"help": "Change la représentation des comptes, soit sous forme de liste, soit sous forme de grille"
},
"grid": "Grille",
"list": "Liste"
}
},
"twofaccounts": {

View File

@ -34,8 +34,8 @@
loadingLabel: 'refreshing'
}" > -->
<draggable v-model="filteredAccounts" @start="drag = true" @end="saveOrder" ghost-class="ghost" handle=".tfa-dots" animation="200" class="accounts">
<transition-group class="columns is-multiline is-centered" type="transition" :name="!drag ? 'flip-list' : null">
<div class="tfa column is-narrow has-text-white" v-for="account in filteredAccounts" :key="account.id">
<transition-group class="columns is-multiline" :class="{ 'is-centered': $root.appSettings.displayMode === 'grid' }" type="transition" :name="!drag ? 'flip-list' : null">
<div :class="[$root.appSettings.displayMode === 'grid' ? 'tfa-grid' : 'tfa-list']" class="column is-narrow has-text-white" v-for="account in filteredAccounts" :key="account.id">
<div class="tfa-container">
<transition name="slideCheckbox">
<div class="tfa-checkbox" v-if="editMode">

View File

@ -5,7 +5,8 @@
<span class="tag is-info">v{{ $root.appVersion }}</span>
</div>
<form @submit.prevent="handleSubmit" @change="handleSubmit" @keydown="form.onKeydown($event)">
<form-select :options="options" :form="form" fieldName="lang" :label="$t('settings.forms.language.label')" :help="$t('settings.forms.language.help')" />
<form-select :options="langs" :form="form" fieldName="lang" :label="$t('settings.forms.language.label')" :help="$t('settings.forms.language.help')" />
<form-select :options="layouts" :form="form" fieldName="displayMode" :label="$t('settings.forms.display_mode.label')" :help="$t('settings.forms.display_mode.help')" />
<form-switch :form="form" fieldName="showTokenAsDot" :label="$t('settings.forms.show_token_as_dot.label')" :help="$t('settings.forms.show_token_as_dot.help')" />
<form-switch :form="form" fieldName="closeTokenOnCopy" :label="$t('settings.forms.close_token_on_copy.label')" :help="$t('settings.forms.close_token_on_copy.help')" />
<form-switch :form="form" fieldName="useBasicQrcodeReader" :label="$t('settings.forms.use_basic_qrcode_reader.label')" :help="$t('settings.forms.use_basic_qrcode_reader.help')" />
@ -27,10 +28,15 @@
showTokenAsDot: this.$root.appSettings.showTokenAsDot,
closeTokenOnCopy: this.$root.appSettings.closeTokenOnCopy,
useBasicQrcodeReader: this.$root.appSettings.useBasicQrcodeReader,
displayMode: this.$root.appSettings.displayMode,
}),
options: [
langs: [
{ text: this.$t('languages.en'), value: 'en' },
{ text: this.$t('languages.fr'), value: 'fr' },
],
layouts: [
{ text: this.$t('settings.forms.grid'), value: 'grid' },
{ text: this.$t('settings.forms.list'), value: 'list' },
]
}
},

View File

@ -39,6 +39,12 @@
'label' => 'Use basic qrcode reader',
'help' => 'If you experiences issues when capturing qrCodes enables this option to switch to a more basic but more reliable qrcode reader'
],
'display_mode' => [
'label' => 'Desktop display mode',
'help' => 'Choose whether you want accounts to be displayed as a list or as a grid on desktop'
],
'grid' => 'Grid',
'list' => 'List',
],

View File

@ -39,6 +39,12 @@
'label' => 'Utiliser le lecteur de qrcode basique',
'help' => 'Si vous rencontrez des problèmes lors de la lecture des qrCodes activez cette option pour utiliser un lecteur de qrcode moins évolué mais plus largement compatible'
],
'display_mode' => [
'label' => 'Mode d\'affichage Desktop',
'help' => 'Change la représentation des comptes, soit sous forme de liste, soit sous forme de grille'
],
'grid' => 'Grille',
'list' => 'Liste',
],

View File

@ -50,7 +50,7 @@ a:hover {
background-color: hsl(0, 0%, 21%) !important;
}
.tfa {
.tfa-grid {
border-radius: 6px;
text-align: center;
background-color: hsl(0, 0%, 10%); /*black-bis from Bulma*/
@ -58,8 +58,23 @@ a:hover {
margin: 0.5rem;
}
@media screen and (max-width: 768px) {
.tfa {
.tfa-list {
text-align: inherit;
border-bottom: 1px solid hsl(0, 0%, 21%);
background-color: hsl(0, 0%, 14%); /*black-ter from Bulma*/
margin: 0 1%;
padding: 0.5rem 0.5rem 0.5rem 0.5rem;
width: 31.3%;
}
@media screen and (max-width: 1217px) {
.tfa-list {
width: 48%;
}
}
@media screen and (max-width: 769px) {
.tfa-list {
border-radius: unset;
text-align: inherit;
border-bottom: 1px solid hsl(0, 0%, 21%);
@ -67,6 +82,7 @@ a:hover {
margin: 0;
padding: 0.5rem 0.5rem 0.5rem 0.5rem;
max-width: none;
width: auto;
}
}
@ -74,82 +90,63 @@ a:hover {
align-items: center;
display: flex;
justify-content: left;
}
.tfa-grid .tfa-container {
flex-direction: column;
padding: 0 1.5rem;
}
@media screen and (max-width: 768px) {
.tfa-container {
flex-direction: row;
.tfa-list .tfa-container {
flex-direction: row;
padding: 0;
}
.tfa-container > div:first-of-type {
padding: 0 0 0 0.5rem;
}
.tfa-container > div:last-of-type {
padding: 0 1rem 0 0;
}
}
.tfa-checkbox, .tfa-dots, .tfa-edit {
.tfa-list .tfa-container > div:first-of-type {
padding: 0 0 0 0.5rem;
}
.tfa-list .tfa-container > div:last-of-type {
padding: 0 1rem 0 0;
}
.tfa-grid .tfa-checkbox,
.tfa-grid .tfa-dots,
.tfa-grid .tfa-edit {
display: flex;
align-items: center;
padding: 0.5rem 0 0 0;
}
@media screen and (max-width: 768px) {
.tfa-checkbox, .tfa-dots, .tfa-edit {
display: flex;
align-items: center;
padding: 0
}
.tfa-dots {
margin-left: 1.5rem;
}
.tfa-list .tfa-checkbox,
.tfa-list .tfa-dots,
.tfa-list .tfa-edit {
display: flex;
align-items: center;
padding: 0
}
.tfa-content {
.tfa-list .tfa-dots {
margin-left: 1.5rem;
}
.tfa-grid .tfa-content {
flex-grow: 1;
// order: 1;
overflow: hidden;
}
.tfa-checkbox {
// order: 2;
.tfa-list .tfa-content {
width: 100%;
}
.tfa-dots {
cursor: grab;
}
@media screen and (max-width: 768px) {
.tfa-checkbox {
order: 1;
}
.tfa-content {
order: 2;
}
.tfa-edit {
order: 3;
}
.tfa-dots {
order: 4;
}
}
@media screen and (min-width: 769px) {
.is-checkradio[type="checkbox"] + label, .is-checkradio[type="radio"] + label {
.tfa-grid .is-checkradio[type="checkbox"] + label, .tfa-grid .is-checkradio[type="radio"] + label {
padding-left: 0 !important;
margin-top: 0 !important;
margin-bottom: 0 !important;
}
}
.tfa-text {
display: block;
@ -157,13 +154,13 @@ a:hover {
cursor: pointer;
}
.tfa img {
.tfa-container img {
height: 0.75em;
width: 0.75em;
margin-right: .1em;
}
.tfa span {
.tfa-container span {
display: block;
}
@ -411,39 +408,40 @@ footer .field.is-grouped {
animation: fadeOut 500ms
}
.slideCheckbox-enter-active {
.tfa-grid .slideCheckbox-enter-active {
animation: enterFromTop 500ms
}
.slideCheckbox-enter-active + .tfa-content {
.tfa-grid .slideCheckbox-enter-active + .tfa-content {
animation: addTopOffset 500ms
}
.slideCheckbox-leave-active {
.tfa-grid .slideCheckbox-leave-active {
animation: leaveToTop 500ms
}
.slideCheckbox-leave-active + .tfa-content {
.tfa-grid .slideCheckbox-leave-active + .tfa-content {
animation: removeTopOffset 500ms
}
@media screen and (max-width: 768px) {
.slideCheckbox-enter-active {
// @media screen and (max-width: 768px) {
.tfa-list .slideCheckbox-enter-active {
animation: enterFromLeft 500ms
}
.slideCheckbox-enter-active + .tfa-content {
.tfa-list .slideCheckbox-enter-active + .tfa-content {
animation: addLeftOffset 500ms
}
.slideCheckbox-leave-active {
.tfa-list .slideCheckbox-leave-active {
animation: leaveToLeft 500ms
}
.slideCheckbox-leave-active + .tfa-content {
.tfa-list .slideCheckbox-leave-active + .tfa-content {
animation: removeLeftOffset 500ms
}
}
// }
/*FadeInOut*/