-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
プラクティス完了ツイート機能の実装 #3385
プラクティス完了ツイート機能の実装 #3385
Changes from all commits
e3784c8
10c6e4b
829e992
73a4609
c17c3e1
b864793
c5c56cb
96bfa02
0e8ef77
2e3b57b
5d8e040
9cfe3e6
84e239a
58e3d6a
293d57e
d84b135
1a35971
b6443d5
64bd09c
aac43fd
226ed7e
a5ce05b
f4fb7a8
cad0d2a
bfcdf78
0cda629
678e225
122c058
731e8ac
4e34beb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.a-completion-message | ||
background-color: $info | ||
+padding(vertical, .75rem) | ||
&:not(:last-child) | ||
margin-bottom: 1.25rem | ||
|
||
.a-completion-message__inner | ||
+media-breakpoint-up(md) | ||
display: flex | ||
justify-content: center | ||
align-items: center | ||
|
||
.a-completion-message__title | ||
+text-block(1em 1.45, center $reversal-text 600) | ||
+media-breakpoint-up(md) | ||
font-size: 1rem | ||
+media-breakpoint-down(sm) | ||
font-size: .8125rem | ||
|
||
.a-completion-message__actions-item | ||
+media-breakpoint-up(md) | ||
width: 10rem | ||
+media-breakpoint-down(sm) | ||
|
||
.a-completion-message__inner-end | ||
+media-breakpoint-up(md) | ||
margin-left: 1rem | ||
+media-breakpoint-down(sm) | ||
margin-top: .75rem |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.congrats-card-body__title | ||
+text-block(1.5rem 1.5, 700) | ||
+media-breakpoint-up(md) | ||
font-size: 1.5rem | ||
+media-breakpoint-down(sm) | ||
font-size: 1rem | ||
|
||
.congrats-card-body__image-container | ||
margin-top: 1.25rem | ||
|
||
.congrats-card-body__image-container | ||
width: 100% | ||
max-width: 28rem | ||
+margin(horizontal, auto) | ||
|
||
.congrats-card-body__image | ||
border-radius: .75rem | ||
border: solid .5rem $background | ||
|
||
.congrats-card-body | ||
.card-main-actions | ||
margin-top: 1.25rem |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.page-tools | ||
.page-header + & | ||
border-top: solid 1px $border-more-shade | ||
& + .page-body | ||
border-top: solid 1px $border-more-shade | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.completion-massage | ||
background-color: $success |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@import common-imports | ||
@import blocks/shared/flash | ||
@import blocks/shared/modal | ||
@import completion/**/* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
$completion: #00a0dd | ||
|
||
body.is-completion | ||
background-color: $completion | ||
|
||
.completion-wrapper | ||
min-height: 100vh | ||
display: flex | ||
flex-direction: column | ||
&::before | ||
content: '' | ||
background-image: image_url('completion/completion_background.svg') | ||
background-repeat: repeat | ||
+position(fixed, left 0, top 0, right 0, bottom 0, 1) | ||
+size(100%) | ||
opacity: .075 | ||
+media-breakpoint-up(md) | ||
background-size: 16rem auto | ||
|
||
.completion-wrapper__start | ||
flex: 1 | ||
+position(relative, 2) | ||
|
||
.completion-wrapper__end | ||
+position(relative, 2) | ||
|
||
.complestion | ||
+padding(vertical, 4rem 2rem) | ||
|
||
.complestion__title | ||
+text-block(2rem 1.5, 800 center $reversal-text) | ||
font-family: YakuHanJP_Narrow,Hiragino Sans,Hiragino Kaku Gothic ProN,BIZ UDPGothic,Meiryo,sans-serif | ||
|
||
.complestion__body | ||
margin-top: 3rem | ||
|
||
.complestion__image | ||
border-radius: 1rem | ||
border: solid .75rem shade($completion, 30%) | ||
|
||
.welcome-footer | ||
+media-breakpoint-up(md) | ||
+padding(vertical, 3rem) | ||
+media-breakpoint-down(sm) | ||
padding-bottom: 1.5rem | ||
body.welcome & .container | ||
+padding(horizontal, 0) | ||
|
||
.welcome-footer__nav | ||
margin-bottom: 1.5rem | ||
|
||
.welcome-footer__nav-items | ||
+media-breakpoint-up(md) | ||
display: flex | ||
justify-content: center | ||
|
||
.welcome-footer__nav-item | ||
+media-breakpoint-up(md) | ||
+padding(horizontal, .5rem) | ||
|
||
.welcome-footer__nav-item-link | ||
+text-block(.875rem 1, $reversal-text) | ||
+media-breakpoint-up(md) | ||
+hover-link | ||
+media-breakpoint-down(sm) | ||
text-decoration: none | ||
display: flex | ||
align-items: center | ||
+padding(horizontal, 1rem) | ||
border-bottom: solid 1px $border | ||
+size(100% 2.75rem) | ||
|
||
.welcome-footer-copyright | ||
justify-content: center | ||
align-items: center | ||
+text-block(.875rem 1.45, flex $reversal-text) | ||
|
||
.welcome-footer-copyright__author | ||
display: block | ||
+margin(horizontal, .1em .5em) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class API::Practices::Learning::CompletionMessageController < API::BaseController | ||
def update | ||
learning = current_user.learnings.find_by(practice_id: params[:practice_id]) | ||
if learning.update(completion_message_displayed: true) | ||
head :ok | ||
else | ||
head :bad_request | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
class Practices::CompletionController < ApplicationController | ||
layout 'completion' | ||
|
||
def show | ||
@practice = Practice.find(params[:practice_id]) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module LearningDecorator | ||
def should_display_message_automatically?(current_user:) | ||
user == current_user && complete? && !completion_message_displayed? | ||
end | ||
end | ||
Comment on lines
+3
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. モーダルの初回表示判定はviewでしか使わないのでメソッドはdecoratorにしましたが、 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. うーん、正直どこにメソッド定義をしたらいいか自分には判断できませんね😥 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 現在viewでしか使わず、今後も他で使われなさそうであればこれで良いと思います〜 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const modal = document.querySelector('#modal-learning_completion') | ||
if (!modal) { | ||
return null | ||
} | ||
|
||
const datasetNode = document.querySelector('#modal-learning_completion-data') | ||
|
||
if (datasetNode.dataset.shouldDisplayMessageAutomatically === 'true') { | ||
modal.checked = true | ||
} | ||
|
||
modal.addEventListener('change', () => { | ||
if (!modal.checked) { | ||
const practiceId = datasetNode.dataset.practiceId | ||
fetch(`/api/practices/${practiceId}/learning/completion_message`, { | ||
method: 'PATCH', | ||
headers: { | ||
'Content-Type': 'application/json; charset=utf-8', | ||
'X-Requested-With': 'XMLHttpRequest', | ||
'X-CSRF-Token': token() | ||
}, | ||
credentials: 'same-origin', | ||
redirect: 'manual' | ||
}).catch((error) => { | ||
console.warn('Failed to parsing', error) | ||
}) | ||
} | ||
}) | ||
|
||
function token() { | ||
const meta = document.querySelector('meta[name="csrf-token"]') | ||
return meta ? meta.getAttribute('content') : '' | ||
} | ||
}) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,8 +10,9 @@ | |||||
i.fas.fa-check | ||||||
| 完了しています | ||||||
li.card-main-actions__item(v-else) | ||||||
button#js-complete.a-button.is-md.is-warning.is-block( | ||||||
@click='pushComplete' | ||||||
label#js-complete.a-button.is-md.is-warning.is-block( | ||||||
@click='pushComplete', | ||||||
for='modal-learning_completion' | ||||||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
bootcamp/app/assets/stylesheets/blocks/shared/_modal.sass Lines 5 to 6 in 2901dfa
|
||||||
) | ||||||
i.fas.fa-check | ||||||
| 完了 | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@machida
通知一覧ページの表示が、意図されている内容なのか気になったので、一応コメントさせていただきました😅
意図通り or 他の箇所で修正であれば、スルーしていただければ🙏
ここのborder-topについて、おそらく下図のような部分での区切り線を意図されていると思います。
通知一覧ページも同じような構造なのですが、未読・既読のトグルがあるので、余計な線が入っている or マージンが足りないように見えました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
おおーすいません、こちら見逃してました🙇♂️