diff --git a/model/usersettings.go b/model/usersettings.go index b4f1bab..fde0689 100644 --- a/model/usersettings.go +++ b/model/usersettings.go @@ -33,6 +33,12 @@ package happydns import () +const ( + ZONEVIEW_GRID = iota + ZONEVIEW_LIST + ZONEVIEW_RECORDS +) + // UserSettings represents the settings for an account. type UserSettings struct { // Language saves the locale defined by the user. @@ -43,6 +49,9 @@ type UserSettings struct { // FieldHint stores the way form hints are displayed. FieldHint int `json:"fieldhint"` + + // ZoneView keeps the view of the zone wanted by the user. + ZoneView int `json:"zoneview"` } func DefaultUserSettings() *UserSettings { @@ -50,5 +59,6 @@ func DefaultUserSettings() *UserSettings { Language: "en", Newsletter: false, FieldHint: 2, + ZoneView: ZONEVIEW_GRID, } } diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index dacdbca..bc531d2 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -106,20 +106,7 @@ "title": "View zone" }, "views": { - "grid": { - "title": "Grid view (easiest)", - "label": "Grid" - }, - "list": { - "title": "List view (fastest)", - "label": "List" - }, - "provider-parameters": "Hosting parameters", - "records": { - "title": "List records (advanced)", - "label": "Records" - }, - "as": "View as:" + "provider-parameters": "Hosting parameters" }, "alias-creation": "Add an alias pointing to {0}:", "alias-creation-sample": "This will create the alias:", @@ -276,7 +263,13 @@ "save": "Save settings", "title": "Settings", "success": "Continue to enjoy happyDNS.", - "success-change": "Your settings has been saved." + "success-change": "Your settings has been saved.", + "zoneview": { + "grid": "Grid view (easiest)", + "list": "List view (fastest)", + "records": "List with records (advanced)", + "title": "View zone as" + } }, "record": { "A": "IPv4 address", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index efba47f..c4a5ea7 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -272,7 +272,13 @@ "save": "Enregistrer les paramètres", "title": "Paramètres", "success": "Vous pouvez continuer d'apprécier happyDNS.", - "success-change": "Vos paramètres ont été sauvegardés." + "success-change": "Vos paramètres ont été sauvegardés.", + "zoneview": { + "grid": "Grille (la plus lisible)", + "list": "Liste (la plus rapide)", + "records": "Liste avec les enregistrements (avancés)", + "title": "Voir comme :" + } }, "record": { "A": "Adresse IPv4", @@ -302,4 +308,4 @@ "ttl": "Temps de cache restant", "showDNSSEC": "Afficher les enregistrements DNSSEC dans la réponse (s'il y en a)" } -} \ No newline at end of file +} diff --git a/ui/src/views/domain.vue b/ui/src/views/domain.vue index f0739f8..ffdea04 100644 --- a/ui/src/views/domain.vue +++ b/ui/src/views/domain.vue @@ -79,27 +79,7 @@ -
- - - - - - - - - - - - - -
+
{{ $t('domains.stop') }} @@ -208,7 +188,6 @@ export default { data: function () { return { - displayFormat: 'grid', importInProgress: false, propagationInProgress: false, selectedDiff: [], @@ -219,6 +198,17 @@ export default { }, computed: { + displayFormat () { + switch (this.user_getSettings.zoneview) { + case 1: + return 'list' + case 2: + return 'records' + default: + return 'grid' + } + }, + domain () { return this.domains_getDetailed[this.$route.params.domain] }, @@ -298,7 +288,8 @@ export default { }, ...mapGetters('domains', ['domains_getDetailed', 'sortedDomains']), - ...mapGetters('providers', ['providers_getAll']) + ...mapGetters('providers', ['providers_getAll']), + ...mapGetters('user', ['user_getSettings']) }, watch: { @@ -311,9 +302,6 @@ export default { }, created () { - if (localStorage && localStorage.getItem('displayFormat')) { - this.displayFormat = localStorage.getItem('displayFormat') - } this.$store.dispatch('domains/getAllMyDomains') this.$store.dispatch('providers/getAllMyProviders') this.updateDomainInfo() @@ -383,27 +371,6 @@ export default { }) }, - toogleGridView () { - this.displayFormat = 'grid' - if (localStorage) { - localStorage.setItem('displayFormat', 'grid') - } - }, - - toogleListView () { - this.displayFormat = 'list' - if (localStorage) { - localStorage.setItem('displayFormat', 'list') - } - }, - - toogleRecordsView () { - this.displayFormat = 'records' - if (localStorage) { - localStorage.setItem('displayFormat', 'records') - } - }, - showDiff () { this.zoneDiff = null this.$bvModal.show('modal-applyZone') diff --git a/ui/src/views/me.vue b/ui/src/views/me.vue index 1da64f6..6e8c4d0 100644 --- a/ui/src/views/me.vue +++ b/ui/src/views/me.vue @@ -55,6 +55,24 @@ :options="[{value: 0, text: $t('settings.fieldhint.hide')}, {value: 1, text: $t('settings.fieldhint.tooltip')}, {value: 2, text: $t('settings.fieldhint.focused')}, {value: 3, text: $t('settings.fieldhint.always')}]" /> + + + + + + + + + +
{{ $t('settings.save') }} @@ -177,6 +195,7 @@