From ae34fb75dc21aba15644250fb9399bf77ea2e2a1 Mon Sep 17 00:00:00 2001 From: comorebi-notes Date: Thu, 5 Jul 2018 18:47:20 +0900 Subject: [PATCH 1/9] change font --- app/assets/stylesheets/partials/fonts.sass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/partials/fonts.sass b/app/assets/stylesheets/partials/fonts.sass index 8bb33944..6b572aa8 100644 --- a/app/assets/stylesheets/partials/fonts.sass +++ b/app/assets/stylesheets/partials/fonts.sass @@ -1,3 +1,6 @@ -@import url("https://fonts.googleapis.com/css?family=Ubuntu:400,700") +@import url(//fonts.googleapis.com/earlyaccess/notosansjp.css) +@import url(//fonts.googleapis.com/css?family=Ubuntu:400,700) * - font-family: "Ubuntu", 'ヒラギノ角ゴシック Pro', 'Hiragino Kaku Gothic Pro', メイリオ, Meiryo, 游ゴシック体, 'Yu Gothic', YuGothic, Osaka, 'MS Pゴシック', 'MS PGothic', sans-serif + font-family: 'Noto Sans JP', sans-serif +#score-editor * + font-family: 'Ubuntu', sans-serif From 67b3d3bbeffb80d441b5144d5fe9e8675775accb Mon Sep 17 00:00:00 2001 From: comorebi-notes Date: Tue, 10 Jul 2018 18:18:46 +0900 Subject: [PATCH 2/9] update font style --- .gitignore | 3 +++ app/assets/stylesheets/partials/fonts.sass | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 18326316..450f6c63 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ /public/packs /public/packs-test /public/uploads +/public/assets/* +!/public/assets/images +!/public/assets/audios .byebug_history diff --git a/app/assets/stylesheets/partials/fonts.sass b/app/assets/stylesheets/partials/fonts.sass index 6b572aa8..ca53aaf4 100644 --- a/app/assets/stylesheets/partials/fonts.sass +++ b/app/assets/stylesheets/partials/fonts.sass @@ -2,5 +2,6 @@ @import url(//fonts.googleapis.com/css?family=Ubuntu:400,700) * font-family: 'Noto Sans JP', sans-serif -#score-editor * +#score-editor, .title-logo, .navbar, .tab-bar, .score-controls + *:not(.fa):not(.button):not(input) font-family: 'Ubuntu', sans-serif From f1ca9c1176cab5f32f12c299a940c64073078f1e Mon Sep 17 00:00:00 2001 From: kero-uzura Date: Thu, 19 Jul 2018 01:36:06 +0900 Subject: [PATCH 3/9] modify radio style --- .node-version | 2 +- app/assets/stylesheets/partials/modify-bulma.sass | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.node-version b/.node-version index 22333f1e..d1dd3f90 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -8.9.3 +10.6.0 diff --git a/app/assets/stylesheets/partials/modify-bulma.sass b/app/assets/stylesheets/partials/modify-bulma.sass index c2309c92..2b83eae6 100644 --- a/app/assets/stylesheets/partials/modify-bulma.sass +++ b/app/assets/stylesheets/partials/modify-bulma.sass @@ -35,6 +35,8 @@ h1, h2, h3 .has-checkradio .is-checkradio + label padding-right: 0 + padding-top: 0 + padding-bottom: 0 &:not(:last-of-type) .is-checkradio + label margin-right: 1.2rem From 42cf5705de653947c1d034cdb71582ee386c7dc2 Mon Sep 17 00:00:00 2001 From: kero-uzura Date: Thu, 19 Jul 2018 01:59:07 +0900 Subject: [PATCH 4/9] set error message by api --- app/controllers/scores_controller.rb | 5 ++++- app/controllers/users_controller.rb | 5 ++++- app/frontend/components/CardsList/index.js | 10 +++++----- app/frontend/components/Routes/EditScore/index.js | 2 +- app/frontend/components/Routes/User/index.js | 2 +- app/frontend/components/Routes/index.js | 3 ++- app/frontend/utils/index.js | 8 ++++++++ 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/controllers/scores_controller.rb b/app/controllers/scores_controller.rb index 962476b8..c7426cd6 100644 --- a/app/controllers/scores_controller.rb +++ b/app/controllers/scores_controller.rb @@ -73,7 +73,10 @@ def set_score end def authenticate! - if @score.user_id != current_user.id + case + when !user_signed_in? + render json: "この操作に対する権限がありません。ログインしてください。", status: :unprocessable_entity + when @score.user_id != current_user.id render json: "現在ログイン中のユーザは、この操作に対する権限がありません。", status: :unprocessable_entity end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e8fffe4e..dfaab033 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -100,7 +100,10 @@ def set_user end def authenticate! - if @user.id != current_user.id + case + when !user_signed_in? + render json: "この操作に対する権限がありません。ログインしてください。", status: :unprocessable_entity + when @user.id != current_user.id render json: "現在ログイン中のユーザは、この操作に対する権限がありません。", status: :unprocessable_entity end end diff --git a/app/frontend/components/CardsList/index.js b/app/frontend/components/CardsList/index.js index 139fc6f0..b70799dc 100644 --- a/app/frontend/components/CardsList/index.js +++ b/app/frontend/components/CardsList/index.js @@ -6,8 +6,8 @@ import OptionCheckbox from "./OptionCheckbox" import ScoresResult from "./ScoresResult" import UsersResult from "./UsersResult" import Pagination from "../commons/Pagination" -import * as utils from "./cardsListUtils" -import { setMeta } from "../../utils" +import * as cardsListUtils from "./cardsListUtils" +import * as utils from "../../utils" import { history } from "../../utils/browser-dependencies" import * as api from "../../api" import * as path from "../../utils/path" @@ -18,7 +18,7 @@ export default class CardsList extends Component { const { type, location } = props const query = qs.parse(location.search.substr(1)) this.state = { - query: utils.setDefault(query, type), + query: cardsListUtils.setDefault(query, type), result: [], loading: true } @@ -33,10 +33,10 @@ export default class CardsList extends Component { if (label) { const { query: { word } } = this.state const title = word ? `検索: ${word}` : `${label}一覧` - setMeta(title, "", this.props.history) + utils.setMeta(title, "", this.props.history) } }, - () => this.props.history.push(path.root, { flash: ["error", "読み込みに失敗しました。"] }) + (errors) => this.props.history.push(path.root, utils.setFlashError(errors)) ) ) handlePush = (type, query) => { diff --git a/app/frontend/components/Routes/EditScore/index.js b/app/frontend/components/Routes/EditScore/index.js index 496ae21d..aa136aea 100644 --- a/app/frontend/components/Routes/EditScore/index.js +++ b/app/frontend/components/Routes/EditScore/index.js @@ -56,7 +56,7 @@ export default class EditScore extends Component { token: score.token }) }, - () => this.props.history.push(path.root, { flash: ["error", "読み込みに失敗しました。"] }) + (errors) => this.props.history.push(path.root, utils.setFlashError(errors)) ) } } diff --git a/app/frontend/components/Routes/User/index.js b/app/frontend/components/Routes/User/index.js index 996bff2a..fd4507ef 100644 --- a/app/frontend/components/Routes/User/index.js +++ b/app/frontend/components/Routes/User/index.js @@ -26,7 +26,7 @@ export default class User extends Component { utils.setMeta(`${user.screen_name} のマイページ`, user.profile, this.props.history) this.setState({ loading: false, user }) }, - () => this.props.history.push(path.root, { flash: ["error", "読み込みに失敗しました。"] }) + (errors) => this.props.history.push(path.root, utils.setFlashError(errors)) ) } handleToggleEdit = () => this.setState({ edit: !this.state.edit }) diff --git a/app/frontend/components/Routes/index.js b/app/frontend/components/Routes/index.js index 1c52ecfa..4d9a2bf2 100644 --- a/app/frontend/components/Routes/index.js +++ b/app/frontend/components/Routes/index.js @@ -16,6 +16,7 @@ import Changelog from "./Changelog" import ScoresList from "./ScoresList" import UsersList from "./UsersList" import FavsList from "./FavsList" +import * as utils from "../../utils" import * as path from "../../utils/path" import * as api from "../../api" import { window } from "../../utils/browser-dependencies" @@ -39,7 +40,7 @@ class Container extends Component { if (currentVersion !== this.state.currentVersion) window.location.reload() // 更新があればブラウザをリロード this.setState({ loading: false, currentUser, notifications }) }, - () => history.push(path.root, { flash: ["error", "読み込みに失敗しました。"] }) + (errors) => history.push(path.root, utils.setFlashError(errors)) ) } render() { diff --git a/app/frontend/utils/index.js b/app/frontend/utils/index.js index b240dfa7..6ceb3a17 100644 --- a/app/frontend/utils/index.js +++ b/app/frontend/utils/index.js @@ -110,6 +110,14 @@ export const setApiErrors = (apiErrors) => { return errors } +export const setFlashError = ({ response: { status, data } }) => { + let errorMessage = "予期しないエラーが発生しました。読み込みに失敗しました。" + if (Number(status / 100) === 4 && data) { + errorMessage = data + } + return { flash: ["error", errorMessage] } +} + export const iconUrl = (icon, size) => { if (icon && icon.url) { return size === "thumb" ? icon.thumb.url : icon.url From 6cb7f2ca39dbf37434463ca95aad9e2b5f93438e Mon Sep 17 00:00:00 2001 From: kero-uzura Date: Sat, 21 Jul 2018 00:01:29 +0900 Subject: [PATCH 5/9] fix responsive styles --- app/frontend/styles/partials/navbar.sass | 9 ++++++--- app/frontend/styles/partials/tabbar.sass | 2 +- app/frontend/styles/partials/variables.sass | 1 + app/frontend/styles/rechord.sass | 7 ++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/frontend/styles/partials/navbar.sass b/app/frontend/styles/partials/navbar.sass index 493ef5c9..e4bf21a8 100644 --- a/app/frontend/styles/partials/navbar.sass +++ b/app/frontend/styles/partials/navbar.sass @@ -24,6 +24,12 @@ .navbar-item:last-child margin-right: -1rem +@media screen and (max-width: $mobile - 1) + .navbar + .navbar-brand + .title-logo + margin-left: 0 + @media screen and (max-width: $desktop - 1) .navbar .button.is-primary.login-button @@ -31,9 +37,6 @@ background-color: $primary border-color: transparent color: #fff - .navbar-brand - .title-logo - margin-left: 0 .navbar-menu &.is-active position: absolute diff --git a/app/frontend/styles/partials/tabbar.sass b/app/frontend/styles/partials/tabbar.sass index a89c8606..82a66a5f 100644 --- a/app/frontend/styles/partials/tabbar.sass +++ b/app/frontend/styles/partials/tabbar.sass @@ -26,7 +26,7 @@ .input, .button, .icon font-size: .95rem -@media screen and (max-width: $desktop - 1px) +@media screen and (max-width: $mobile - 1px) .tab-bar.tabs .container width: 100% diff --git a/app/frontend/styles/partials/variables.sass b/app/frontend/styles/partials/variables.sass index 31926d8f..ea252fd6 100644 --- a/app/frontend/styles/partials/variables.sass +++ b/app/frontend/styles/partials/variables.sass @@ -2,6 +2,7 @@ $gap: 32px $tablet: 769px $desktop: 960px + (2 * $gap) +$mobile: 1024px + (2 * $gap) $widescreen: 1152px + (2 * $gap) $fullhd: 1344px + (2 * $gap) !default diff --git a/app/frontend/styles/rechord.sass b/app/frontend/styles/rechord.sass index 8bf7ffc8..19f7c7eb 100644 --- a/app/frontend/styles/rechord.sass +++ b/app/frontend/styles/rechord.sass @@ -64,6 +64,11 @@ section.section display: flex flex-direction: column -@media screen and (max-width: $tablet - 1px) +@media screen and (max-width: $mobile - 1) + .section.root-section + .container + width: 100% + +@media screen and (max-width: $tablet - 1) .twitter-tl width: auto From de174e351fc9782b08c8c4c4697313e9455e8d33 Mon Sep 17 00:00:00 2001 From: kero-uzura Date: Sat, 21 Jul 2018 00:40:42 +0900 Subject: [PATCH 6/9] modify public or private status description --- .../Routes/EditScore/UpdateControl/index.js | 2 +- .../Routes/ShowScore/ScoreHeader/index.js | 15 +++++++++----- .../components/StatusControl/index.js | 20 +++++++++++++++++-- .../styles/partials/score-footer.sass | 4 ++++ .../styles/partials/score-header.sass | 10 +++++----- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/app/frontend/components/Routes/EditScore/UpdateControl/index.js b/app/frontend/components/Routes/EditScore/UpdateControl/index.js index 90703ce1..8fa9352c 100644 --- a/app/frontend/components/Routes/EditScore/UpdateControl/index.js +++ b/app/frontend/components/Routes/EditScore/UpdateControl/index.js @@ -35,7 +35,7 @@ class UpdateControl extends Component { status={status} handleSetState={handleSetState} /> -
+
+ {isClosed && ( +
+

+ + + + このスコアは非公開です。あなた以外には見えません。 +

+
+ )}

{title} - {isClosed && ( - - - - )}

diff --git a/app/frontend/components/StatusControl/index.js b/app/frontend/components/StatusControl/index.js index 4e0ca7c6..a39c466f 100644 --- a/app/frontend/components/StatusControl/index.js +++ b/app/frontend/components/StatusControl/index.js @@ -7,8 +7,20 @@ export default class StatusControl extends Component { render() { const { status } = this.props const radioParams = [ - { label: "Public", value: "published" }, - { label: "Private", value: "closed" } + { + label: "Public", + description:

保存されたスコアは誰でも閲覧可能になります。

, + value: "published" + }, { + label: "Private", + description: ( +

+ 保存されたスコアはあなた以外には見えません。
+ 検索にも表示されません。 +

+ ), + value: "closed" + } ] const renderRadioComponent = (param) => ( @@ -24,11 +36,15 @@ export default class StatusControl extends Component { ) + const currentParam = radioParams.find(param => param.value === status) || {} return (
{radioParams.map(renderRadioComponent)}
+
+ {currentParam.description} +
) } diff --git a/app/frontend/styles/partials/score-footer.sass b/app/frontend/styles/partials/score-footer.sass index db056a06..651aac55 100644 --- a/app/frontend/styles/partials/score-footer.sass +++ b/app/frontend/styles/partials/score-footer.sass @@ -7,6 +7,10 @@ .status-control font-weight: bold display: inline-block + .current-status-description + font-weight: normal + font-size: .9em + margin: .75em 0 2em .save-control display: inline-block width: 100% diff --git a/app/frontend/styles/partials/score-header.sass b/app/frontend/styles/partials/score-header.sass index 81c8cfc3..1399081d 100644 --- a/app/frontend/styles/partials/score-header.sass +++ b/app/frontend/styles/partials/score-header.sass @@ -1,13 +1,13 @@ .score-header margin-bottom: .4rem + .private-description + font-size: .9em + opacity: .5 + .icon + margin-right: .5em .title font-size: 1.8em margin-bottom: 1.2rem - .icon - color: #363636 - font-size: .85em - margin-left: .4em - opacity: .5 .button display: block margin-bottom: 1rem From 4e66871728a76bd4456ba6a15bcd3fb9f43bdd2c Mon Sep 17 00:00:00 2001 From: kero-uzura Date: Wed, 1 Aug 2018 02:05:18 +0900 Subject: [PATCH 7/9] modify words --- app/frontend/components/StatusControl/index.js | 4 ++-- app/frontend/styles/partials/score-footer.sass | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/frontend/components/StatusControl/index.js b/app/frontend/components/StatusControl/index.js index a39c466f..a69d09fa 100644 --- a/app/frontend/components/StatusControl/index.js +++ b/app/frontend/components/StatusControl/index.js @@ -15,8 +15,8 @@ export default class StatusControl extends Component { label: "Private", description: (

- 保存されたスコアはあなた以外には見えません。
- 検索にも表示されません。 + 保存されたスコアは非公開になります。
+ あなた以外には見えず、検索にも表示されません。

), value: "closed" diff --git a/app/frontend/styles/partials/score-footer.sass b/app/frontend/styles/partials/score-footer.sass index 651aac55..32dc490e 100644 --- a/app/frontend/styles/partials/score-footer.sass +++ b/app/frontend/styles/partials/score-footer.sass @@ -8,6 +8,7 @@ font-weight: bold display: inline-block .current-status-description + color: #888 font-weight: normal font-size: .9em margin: .75em 0 2em From 2061bff863171b4bc8803f640af6c2e77ce02873 Mon Sep 17 00:00:00 2001 From: kero-uzura Date: Mon, 6 Aug 2018 07:44:44 +0900 Subject: [PATCH 8/9] modify style --- app/assets/stylesheets/partials/fonts.sass | 7 +++++-- app/frontend/styles/partials/search.sass | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/partials/fonts.sass b/app/assets/stylesheets/partials/fonts.sass index ca53aaf4..c24cc7b3 100644 --- a/app/assets/stylesheets/partials/fonts.sass +++ b/app/assets/stylesheets/partials/fonts.sass @@ -2,6 +2,9 @@ @import url(//fonts.googleapis.com/css?family=Ubuntu:400,700) * font-family: 'Noto Sans JP', sans-serif -#score-editor, .title-logo, .navbar, .tab-bar, .score-controls - *:not(.fa):not(.button):not(input) +#score-editor, .title-logo, .navbar, .tab-bar, .score-controls, .button, input + *:not(.fa) font-family: 'Ubuntu', sans-serif +#score-editor + .comment + font-family: 'Noto Sans JP', sans-serif diff --git a/app/frontend/styles/partials/search.sass b/app/frontend/styles/partials/search.sass index 28879f16..5190925d 100644 --- a/app/frontend/styles/partials/search.sass +++ b/app/frontend/styles/partials/search.sass @@ -9,6 +9,8 @@ .control.options display: flex align-items: center + .pagination + min-height: 3em .hits font-size: 1rem align-self: center From 39fd08460afd3e58a3dd7b995d22178f2a0fdee2 Mon Sep 17 00:00:00 2001 From: kero Date: Fri, 31 Aug 2018 09:43:14 +0900 Subject: [PATCH 9/9] fix margin --- app/frontend/styles/partials/score-footer.sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/styles/partials/score-footer.sass b/app/frontend/styles/partials/score-footer.sass index 32dc490e..f80a27ea 100644 --- a/app/frontend/styles/partials/score-footer.sass +++ b/app/frontend/styles/partials/score-footer.sass @@ -11,7 +11,7 @@ color: #888 font-weight: normal font-size: .9em - margin: .75em 0 2em + margin: .75em 0 .5em .save-control display: inline-block width: 100%