Skip to content

Commit

Permalink
Merge pull request #1034 from AlisProject/ALIS-5566
Browse files Browse the repository at this point in the history
ALIS-5566: BASHO の更新
  • Loading branch information
keillera authored Jul 17, 2020
2 parents 7dcec76 + 6543aae commit aa677a4
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 285 deletions.
Binary file removed app/assets/images/pc/topic/topic_fitness.png
Binary file not shown.
Binary file removed app/assets/images/pc/topic/topic_learn-english.png
Binary file not shown.
21 changes: 0 additions & 21 deletions app/components/molecules/DefaultHeaderNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
"
@click.native="resetData"
>
<span
v-if="topic.name === 'fitness' || topic.name === 'learn-english'"
class="topic-display-pre-name"
>
BASHO
</span>
<span class="topic-display-name">
{{ topic.display_name }}
</span>
Expand Down Expand Up @@ -175,10 +169,6 @@ $topicCount: 10;
}
}
.topic-display-pre-name {
display: none;
}
.topic-display-name {
bottom: 7px;
}
Expand Down Expand Up @@ -240,13 +230,6 @@ $topicCount: 10;
background-image: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(0, 0, 0, 0.4) 100%);
}
.topic-display-pre-name {
margin-top: 10px;
left: 0;
position: absolute;
right: 0;
}
.topic-display-name {
bottom: 6px;
left: 0;
Expand All @@ -262,10 +245,6 @@ $topicCount: 10;
margin: 3px 2px 0 2px;
width: 85px;
.topic-display-pre-name {
margin-top: 8px;
}
.topic-display-name {
bottom: 5px;
}
Expand Down
67 changes: 4 additions & 63 deletions app/components/molecules/EditHeaderNavPostArticleV1.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
選択してください
</option>
<option v-for="topic in topics" :value="topic.name">
{{
['筋トレ', '英語学習'].includes(topic.display_name)
? 'BASHO:' + topic.display_name
: topic.display_name
}}
{{ topic.display_name }}
</option>
</select>
</no-ssr>
Expand Down Expand Up @@ -131,70 +127,15 @@ export default {
return
}
// タグのデータ形式をAPIに適するように整形
const tags = this.tags.map((tag) => tag.text)
// BASHO 対応
if (['fitness', 'learn-english'].includes(topicType)) {
// タイトルの先頭が正しく設定されているか
if (
!title.startsWith('【質問】') &&
!title.startsWith('【議論】') &&
!title.startsWith('【共有】')
) {
this.sendNotification({
text:
'BASHOカテゴリ利用の際は、タイトルの先頭に【質問】、【議論】、【共有】のいずれかを記載ください',
dismissAfter: 7000
})
this.publishingArticle = false
return
}
// 正しいBASHO専用タグが設定されていない場合は付与
const tagHeader = topicType === 'fitness' ? '筋トレ:' : '英語学習:'
const bashoTags = ['質問', '議論', '共有']
let targetBashoTag = ''
for (const bashoTag of bashoTags) {
if (title.startsWith('' + bashoTag + '')) {
targetBashoTag = bashoTag
if (!tags.includes(tagHeader + bashoTag)) {
if (tags.length > 4) {
this.sendNotification({
text: 'タイトルに紐づくタグ、”' + tagHeader + bashoTag + '” を設定してください',
dismissAfter: 7000
})
this.publishingArticle = false
return
} else {
tags.push(tagHeader + bashoTag)
}
}
}
}
// 全てのBASHO専用タグを取得
const allBashoTags = bashoTags
.map((bashoTag) => '筋トレ:' + bashoTag)
.concat(bashoTags.map((bashoTag) => '英語学習:' + bashoTag))
const filterTags = tags.filter(
(tag) => tag !== tagHeader + targetBashoTag && allBashoTags.includes(tag)
)
// タイトルと異なるBASHO専用タグが設定されていないこと
if (filterTags.length > 0) {
this.sendNotification({
text: 'タイトルと異なるタグ、「' + filterTags.join('') + '」を削除してください',
dismissAfter: 7000
})
this.publishingArticle = false
return
}
}
const article = { title, body, overview }
if (this.thumbnail !== '') {
article.eye_catch_url = this.thumbnail
}
// タグのデータ形式をAPIに適するように整形
const tags = this.tags.map((tag) => tag.text)
if (
location.href.includes('/me/articles/draft') ||
location.href.includes('/me/articles/new')
Expand Down
66 changes: 3 additions & 63 deletions app/components/molecules/EditHeaderNavPostArticleV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
選択してください
</option>
<option v-for="topic in topics" :value="topic.name">
{{
['筋トレ', '英語学習'].includes(topic.display_name)
? 'BASHO:' + topic.display_name
: topic.display_name
}}
{{ topic.display_name }}
</option>
</select>
</no-ssr>
Expand Down Expand Up @@ -190,64 +186,6 @@ export default {
return
}
// タグのデータ形式をAPIに適するように整形
const tags = this.tags.map((tag) => tag.text)
// BASHO 対応
if (['fitness', 'learn-english'].includes(topicType)) {
// タイトルの先頭が正しく設定されているか
if (
!title.startsWith('【質問】') &&
!title.startsWith('【議論】') &&
!title.startsWith('【共有】')
) {
this.sendNotification({
text:
'BASHOカテゴリ利用の際は、タイトルの先頭に【質問】、【議論】、【共有】のいずれかを記載ください',
dismissAfter: 7000
})
this.publishingArticle = false
return
}
// 正しいBASHO専用タグが設定されていない場合は付与
const tagHeader = topicType === 'fitness' ? '筋トレ:' : '英語学習:'
const bashoTags = ['質問', '議論', '共有']
let targetBashoTag = ''
for (const bashoTag of bashoTags) {
if (title.startsWith('' + bashoTag + '')) {
targetBashoTag = bashoTag
if (!tags.includes(tagHeader + bashoTag)) {
if (tags.length > 4) {
this.sendNotification({
text: 'タイトルに紐づくタグ、”' + tagHeader + bashoTag + '” を設定してください',
dismissAfter: 7000
})
this.publishingArticle = false
return
} else {
tags.push(tagHeader + bashoTag)
}
}
}
}
// 全てのBASHO専用タグを取得
const allBashoTags = bashoTags
.map((bashoTag) => '筋トレ:' + bashoTag)
.concat(bashoTags.map((bashoTag) => '英語学習:' + bashoTag))
const filterTags = tags.filter(
(tag) => tag !== tagHeader + targetBashoTag && allBashoTags.includes(tag)
)
// タイトルと異なるBASHO専用タグが設定されていないこと
if (filterTags.length > 0) {
this.sendNotification({
text: 'タイトルと異なるタグ、「' + filterTags.join('') + '」を削除してください',
dismissAfter: 7000
})
this.publishingArticle = false
return
}
}
if (this.paymentType === 'pay') {
this.setSelectPayment({ title, body, price })
if (location.href.includes('/me/articles/draft')) {
Expand All @@ -261,6 +199,8 @@ export default {
const articleTitle = { title }
const articleBody = { body }
// タグのデータ形式をAPIに適するように整形
const tags = this.tags.map((tag) => tag.text)
if (
location.href.includes('/me/articles/draft') ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
選択してください
</option>
<option v-for="topic in topics" :value="topic.name">
{{
['筋トレ', '英語学習'].includes(topic.display_name)
? 'BASHO:' + topic.display_name
: topic.display_name
}}
{{ topic.display_name }}
</option>
</select>
</no-ssr>
Expand Down Expand Up @@ -161,64 +157,6 @@ export default {
return
}
// タグのデータ形式をAPIに適するように整形
const tags = this.tags.map((tag) => tag.text)
// BASHO 対応
if (['fitness', 'learn-english'].includes(topicType)) {
// タイトルの先頭が正しく設定されているか
if (
!title.startsWith('【質問】') &&
!title.startsWith('【議論】') &&
!title.startsWith('【共有】')
) {
this.sendNotification({
text:
'BASHOカテゴリ利用の際は、タイトルの先頭に【質問】、【議論】、【共有】のいずれかを記載ください',
dismissAfter: 7000
})
this.publishingArticle = false
return
}
// 正しいBASHO専用タグが設定されていない場合は付与
const tagHeader = topicType === 'fitness' ? '筋トレ:' : '英語学習:'
const bashoTags = ['質問', '議論', '共有']
let targetBashoTag = ''
for (const bashoTag of bashoTags) {
if (title.startsWith('' + bashoTag + '')) {
targetBashoTag = bashoTag
if (!tags.includes(tagHeader + bashoTag)) {
if (tags.length > 4) {
this.sendNotification({
text: 'タイトルに紐づくタグ、”' + tagHeader + bashoTag + '” を設定してください',
dismissAfter: 7000
})
this.publishingArticle = false
return
} else {
tags.push(tagHeader + bashoTag)
}
}
}
}
// 全てのBASHO専用タグを取得
const allBashoTags = bashoTags
.map((bashoTag) => '筋トレ:' + bashoTag)
.concat(bashoTags.map((bashoTag) => '英語学習:' + bashoTag))
const filterTags = tags.filter(
(tag) => tag !== tagHeader + targetBashoTag && allBashoTags.includes(tag)
)
// タイトルと異なるBASHO専用タグが設定されていないこと
if (filterTags.length > 0) {
this.sendNotification({
text: 'タイトルと異なるタグ、「' + filterTags.join('') + '」を削除してください',
dismissAfter: 7000
})
this.publishingArticle = false
return
}
}
if (this.paymentType === 'pay') {
this.setSelectPayment({ title, body, price })
this.setMobileEditorHeaderPostArticleModal({ isShow: false })
Expand All @@ -233,6 +171,8 @@ export default {
const articleTitle = { title }
const articleBody = { body }
// タグのデータ形式をAPIに適するように整形
const tags = this.tags.map((tag) => tag.text)
if (
location.href.includes('/me/articles/draft') ||
Expand Down
Loading

0 comments on commit aa677a4

Please sign in to comment.