Skip to content

Commit

Permalink
🎨 #182
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Jan 13, 2019
1 parent a20c54d commit d9d168f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
24 changes: 23 additions & 1 deletion console/pages/admin/articles/post/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@
{{ $t('useThumb', $store.state.locale) }}
</label>

<label class="checkbox btn--space">
<input
type="checkbox"
:checked="syncToCommunity"
@change="setLocalstorage('syncToCommunity')"
@click="syncToCommunity = !syncToCommunity"/><span
class="checkbox__icon"></span>
{{ $t('syncToCommunity', $store.state.locale) }}
</label>

<label class="checkbox btn--space">
<input
type="checkbox"
Expand Down Expand Up @@ -165,6 +175,7 @@
commentable: true,
useThumbs: false,
topped: false,
syncToCommunity: false,
thumbs: ['', '', '', '', '', ''],
edited: false
}
Expand Down Expand Up @@ -319,6 +330,9 @@
case 'useThumbs':
localStorage.setItem('article-useThumbs', this.useThumbs)
break
case 'syncToCommunity':
localStorage.setItem('article-syncToCommunity', this.syncToCommunity)
break
case 'topped':
localStorage.setItem('article-topped', this.topped)
break
Expand Down Expand Up @@ -357,6 +371,7 @@
commentable: this.commentable,
topped: this.topped,
abstract: this.abstract,
syncToCommunity: this.syncToCommunity,
time: this.time === '' ? '' : this.time.replace(' ', 'T') + '+08:00'
})
if (responseData.code === 0) {
Expand All @@ -369,6 +384,7 @@
localStorage.removeItem('article-abstract')
localStorage.removeItem('article-commentable')
localStorage.removeItem('article-useThumbs')
localStorage.removeItem('article-syncToCommunity')
localStorage.removeItem('article-topped')
}
this.$set(this, 'error', false)
Expand Down Expand Up @@ -439,7 +455,12 @@
if (localStorage.getItem('article-useThumbs')) {
this.$set(this, 'useThumbs', localStorage.getItem('article-useThumbs') === 'true')
} else {
this.$set(this, 'userThumbs', false)
this.$set(this, 'useThumbs', false)
}
if (localStorage.getItem('article-syncToCommunity')) {
this.$set(this, 'syncToCommunity', localStorage.getItem('article-syncToCommunity') === 'true')
} else {
this.$set(this, 'syncToCommunity', false)
}
if (localStorage.getItem('article-topped')) {
this.$set(this, 'topped', localStorage.getItem('article-topped') === 'true')
Expand Down Expand Up @@ -472,6 +493,7 @@
this.$set(this, 'tags', responseData.tags.split(','))
this.$set(this, 'commentable', responseData.commentable)
this.$set(this, 'topped', responseData.topped)
this.$set(this, 'syncToCommunity', responseData.syncToCommunity)
}
} else {
// set storage
Expand Down
1 change: 1 addition & 0 deletions i18n/en_US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"syncToCommunity": "sync to community",
"isGoTo": "Your changes will not be saved. Do you want to continue?",
"ad": "advertisement",
"userName": "User Name",
Expand Down
1 change: 1 addition & 0 deletions i18n/zh_CN.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"syncToCommunity": "同步到社区",
"isGoTo": "系统不会保存您所做的更改。是否继续前往?",
"ad": "广告",
"month": "",
Expand Down

0 comments on commit d9d168f

Please sign in to comment.