mirror of https://github.com/Requarks/wiki.git
committed by
Nicolas Giard
10 changed files with 213 additions and 124 deletions
Unified View
Diff Options
-
130client/js/app.js
-
6client/js/components/color-picker.vue
-
6client/js/components/toggle.vue
-
1client/js/helpers/index.js
-
65client/js/helpers/lodash.js
-
48client/js/pages/admin-theme.component.js
-
28server/locales/en/admin.json
-
3server/locales/en/common.json
-
2server/views/pages/admin/_layout.pug
-
48server/views/pages/admin/theme.pug
@ -0,0 +1,65 @@ |
|||||
|
'use strict' |
||||
|
|
||||
|
// ====================================
|
||||
|
// Load minimal lodash
|
||||
|
// ====================================
|
||||
|
|
||||
|
import cloneDeep from 'lodash/cloneDeep' |
||||
|
import concat from 'lodash/concat' |
||||
|
import debounce from 'lodash/debounce' |
||||
|
import deburr from 'lodash/deburr' |
||||
|
import delay from 'lodash/delay' |
||||
|
import filter from 'lodash/filter' |
||||
|
import find from 'lodash/find' |
||||
|
import findKey from 'lodash/findKey' |
||||
|
import forEach from 'lodash/forEach' |
||||
|
import includes from 'lodash/includes' |
||||
|
import isBoolean from 'lodash/isBoolean' |
||||
|
import isEmpty from 'lodash/isEmpty' |
||||
|
import isNil from 'lodash/isNil' |
||||
|
import join from 'lodash/join' |
||||
|
import kebabCase from 'lodash/kebabCase' |
||||
|
import last from 'lodash/last' |
||||
|
import map from 'lodash/map' |
||||
|
import nth from 'lodash/nth' |
||||
|
import pullAt from 'lodash/pullAt' |
||||
|
import reject from 'lodash/reject' |
||||
|
import slice from 'lodash/slice' |
||||
|
import split from 'lodash/split' |
||||
|
import startCase from 'lodash/startCase' |
||||
|
import toString from 'lodash/toString' |
||||
|
import toUpper from 'lodash/toUpper' |
||||
|
import trim from 'lodash/trim' |
||||
|
|
||||
|
// ====================================
|
||||
|
// Build lodash object
|
||||
|
// ====================================
|
||||
|
|
||||
|
export default { |
||||
|
deburr, |
||||
|
concat, |
||||
|
cloneDeep, |
||||
|
debounce, |
||||
|
delay, |
||||
|
filter, |
||||
|
find, |
||||
|
findKey, |
||||
|
forEach, |
||||
|
includes, |
||||
|
isBoolean, |
||||
|
isEmpty, |
||||
|
isNil, |
||||
|
join, |
||||
|
kebabCase, |
||||
|
last, |
||||
|
map, |
||||
|
nth, |
||||
|
pullAt, |
||||
|
reject, |
||||
|
slice, |
||||
|
split, |
||||
|
startCase, |
||||
|
toString, |
||||
|
toUpper, |
||||
|
trim |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
'use strict' |
||||
|
|
||||
|
export default { |
||||
|
name: 'admin-theme', |
||||
|
props: ['themedata'], |
||||
|
data() { |
||||
|
return { |
||||
|
primary: 'indigo', |
||||
|
alt: 'blue-grey', |
||||
|
footer: 'blue-grey', |
||||
|
codedark: 'true', |
||||
|
codecolorize: 'true' |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
saveTheme() { |
||||
|
let self = this |
||||
|
this.$http.post(window.location.href, self.$data).then(resp => { |
||||
|
self.$store.dispatch('alert', { |
||||
|
style: 'green', |
||||
|
icon: 'check', |
||||
|
msg: 'Theme settings have been applied successfully.' |
||||
|
}) |
||||
|
}).catch(err => { |
||||
|
self.$store.dispatch('alert', { |
||||
|
style: 'red', |
||||
|
icon: 'square-cross', |
||||
|
msg: 'Error: ' + err.body.msg |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
resetTheme() { |
||||
|
this.primary = 'indigo' |
||||
|
this.alt = 'blue-grey' |
||||
|
this.footer = 'blue-grey' |
||||
|
this.codedark = 'true' |
||||
|
this.codecolorize = 'true' |
||||
|
} |
||||
|
}, |
||||
|
mounted() { |
||||
|
let theme = JSON.parse(this.themedata) |
||||
|
this.primary = theme.primary |
||||
|
this.alt = theme.alt |
||||
|
this.footer = theme.footer |
||||
|
this.codedark = theme.code.dark.toString() |
||||
|
this.codecolorize = theme.code.colorize.toString() |
||||
|
} |
||||
|
} |
xxxxxxxxxx