テーマ関連機能の強化

This commit is contained in:
syuilo 2018-10-03 03:07:46 +09:00
parent a2a25eb5f8
commit 16b6b1f2b3
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 10 additions and 0 deletions

View File

@ -314,6 +314,7 @@ common/views/components/theme.vue:
export: "エクスポート" export: "エクスポート"
import: "インポート" import: "インポート"
import-by-code: "またはコードをペースト" import-by-code: "またはコードをペースト"
theme-name-required: "テーマ名は必須です。"
common/views/components/cw-button.vue: common/views/components/cw-button.vue:
hide: "隠す" hide: "隠す"

View File

@ -25,6 +25,9 @@
<ui-input v-model="myThemeName"> <ui-input v-model="myThemeName">
<span>%i18n:@theme-name%</span> <span>%i18n:@theme-name%</span>
</ui-input> </ui-input>
<ui-textarea v-model="myThemeDesc">
<span>%i18n:@desc%</span>
</ui-textarea>
</div> </div>
<div> <div>
<div style="padding-bottom:8px;">%i18n:@primary-color%:</div> <div style="padding-bottom:8px;">%i18n:@primary-color%:</div>
@ -108,6 +111,7 @@ export default Vue.extend({
selectedInstalledThemeId: null, selectedInstalledThemeId: null,
myThemeBase: 'light', myThemeBase: 'light',
myThemeName: '', myThemeName: '',
myThemeDesc: '',
myThemePrimary: lightTheme.vars.primary, myThemePrimary: lightTheme.vars.primary,
myThemeSecondary: lightTheme.vars.secondary, myThemeSecondary: lightTheme.vars.secondary,
myThemeText: lightTheme.vars.text myThemeText: lightTheme.vars.text
@ -147,6 +151,7 @@ export default Vue.extend({
return { return {
name: this.myThemeName, name: this.myThemeName,
author: this.$store.state.i.username, author: this.$store.state.i.username,
desc: this.myThemeDesc,
base: this.myThemeBase, base: this.myThemeBase,
vars: { vars: {
primary: tinycolor(typeof this.myThemePrimary == 'string' ? this.myThemePrimary : this.myThemePrimary.rgba).toRgbString(), primary: tinycolor(typeof this.myThemePrimary == 'string' ? this.myThemePrimary : this.myThemePrimary.rgba).toRgbString(),
@ -252,6 +257,10 @@ export default Vue.extend({
gen() { gen() {
const theme = this.myTheme; const theme = this.myTheme;
if (theme.name == null || theme.name.trim() == '') {
alert('%i18n:@theme-name-required%');
return;
}
theme.id = uuid(); theme.id = uuid();
const themes = this.$store.state.device.themes.concat(theme); const themes = this.$store.state.device.themes.concat(theme);
this.$store.commit('device/set', { this.$store.commit('device/set', {