-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/clear-github-data-on-account-deletion
- Loading branch information
Showing
205 changed files
with
1,715 additions
and
984 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions
55
app/components/calendar/nico_nico_calendar_component.html.slim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.a-card | ||
header.card-header.is-sm | ||
h2.card-header__title | ||
| ニコニコカレンダー | ||
hr.a-border-tint | ||
.card-body | ||
.card__description | ||
.niconico-calendar-nav | ||
- if prev_month?(current_date) | ||
= link_to prev_month_path do | ||
.niconico-calendar-nav__previous | ||
i.fa-solid.fa-angle-left | ||
- else | ||
.niconico-calendar-nav__next.is-blank | ||
.niconico-calendar-nav__year--month | ||
= "#{current_date.year}年#{current_date.month}月" | ||
- if next_month?(current_date) | ||
= link_to next_month_path do | ||
.niconico-calendar-nav__next | ||
i.fa-solid.fa-angle-right | ||
- else | ||
.niconico-calendar-nav__next.is-blank | ||
table.niconico-calendar | ||
thead.niconico-calendar__header | ||
tr | ||
th.niconico-calendar__header-day.is-sunday 日 | ||
th.niconico-calendar__header-day 月 | ||
th.niconico-calendar__header-day 火 | ||
th.niconico-calendar__header-day 水 | ||
th.niconico-calendar__header-day 木 | ||
th.niconico-calendar__header-day 金 | ||
th.niconico-calendar__header-day.is-saturday 土 | ||
tbody.niconico-calendar__body | ||
- user.niconico_calendar(current_calendar).each do |week| | ||
tr.niconico-calendar__week | ||
- week.each do |set| | ||
- day_css_class = frame_and_background(set[:date], set[:emotion]) | ||
- day_label_html = capture do | ||
.niconico-calendar__day-label | ||
= set[:date]&.day | ||
.niconico-calendar__day-value | ||
- if set[:emotion] | ||
img.niconico-calendar__emotion-image src="/images/emotion/#{set[:emotion]}.svg" alt="#{set[:emotion]}" | ||
- elsif set[:date] | ||
i.fa-solid.fa-minus | ||
td.niconico-calendar__day class=day_css_class | ||
- if set[:report] | ||
= link_to report_path(set[:report]), class: 'niconico-calendar__day-inner' do | ||
= day_label_html | ||
- elsif set[:date] && !set[:date].future? | ||
= link_to new_report_path(reported_on: set[:date]), class: 'niconico-calendar__day-inner' do | ||
= day_label_html | ||
- else | ||
.niconico-calendar__day-inner | ||
= day_label_html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
class Calendar::NicoNicoCalendarComponent < ViewComponent::Base | ||
def initialize(user:, path:, current_date:, current_calendar:) | ||
@user = user | ||
@path = path | ||
@current_date = current_date | ||
@current_calendar = current_calendar | ||
end | ||
|
||
def prev_month?(month) | ||
month.beginning_of_month > user.created_at.to_date.beginning_of_month | ||
end | ||
|
||
def prev_month_path | ||
send(path, niconico_calendar: current_date.prev_month.strftime('%Y-%m')) | ||
end | ||
|
||
def frame_and_background(date, emotion) | ||
day_class = emotion ? "is-#{emotion}" : 'is-blank' | ||
day_class += ' is-today' if date&.today? | ||
day_class | ||
end | ||
|
||
def next_month?(month) | ||
month.beginning_of_month < Time.zone.today.to_date.beginning_of_month | ||
end | ||
|
||
def next_month_path | ||
send(path, niconico_calendar: current_date.next_month.strftime('%Y-%m')) | ||
end | ||
|
||
private | ||
|
||
attr_reader :user, :path, :current_date, :current_calendar | ||
end |
2 changes: 0 additions & 2 deletions
2
...ducts/_product_practice_content.html.slim → ...actice_content_toggle_component.html.slim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/components/practice_content_toggle/practice_content_toggle_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module PracticeContentToggle | ||
class PracticeContentToggleComponent < ViewComponent::Base | ||
def initialize(content_type:, practice:) | ||
@content_type = content_type | ||
@practice = practice | ||
end | ||
|
||
def practice_content | ||
case @content_type | ||
when :practice | ||
{ | ||
id_name: 'toggle_description_body', | ||
title: 'プラクティスを確認', | ||
description: @practice.description | ||
} | ||
when :goal | ||
{ | ||
id_name: 'toggle_goal_body', | ||
title: '終了条件を確認', | ||
description: @practice.goal | ||
} | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class Mentor::HomeController < MentorController | ||
def index; end | ||
def index | ||
@worried_users = User.delayed.order(completed_at: :asc) | ||
end | ||
end |
44 changes: 44 additions & 0 deletions
44
app/controllers/mentor/practices/submission_answer_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
class Mentor::Practices::SubmissionAnswerController < ApplicationController | ||
before_action :require_admin_or_mentor_login | ||
before_action :set_submission_answer, only: %i[edit update] | ||
|
||
def new | ||
@practice = Practice.find(params[:practice_id]) | ||
@submission_answer = @practice.build_submission_answer | ||
end | ||
|
||
def edit | ||
@practice = @submission_answer.practice | ||
end | ||
|
||
def create | ||
@practice = Practice.find(params[:practice_id]) | ||
@submission_answer = @practice.build_submission_answer(submission_answer_params) | ||
if @submission_answer.save | ||
redirect_to practice_submission_answer_url, notice: '模範解答を作成しました。' | ||
else | ||
render :new, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
def update | ||
@practice = @submission_answer.practice | ||
if @submission_answer.update(submission_answer_params) | ||
redirect_to practice_submission_answer_url, notice: '模範解答を更新しました。' | ||
else | ||
render :edit, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_submission_answer | ||
@submission_answer = SubmissionAnswer.find_by(practice_id: params[:practice_id]) | ||
end | ||
|
||
def submission_answer_params | ||
params.require(:submission_answer).permit(:description) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class Practices::SubmissionAnswerController < ApplicationController | ||
before_action :check_permission!, only: %i[show] | ||
|
||
def show | ||
@practice = Practice.find(params[:practice_id]) | ||
@submission_answer = @practice.submission_answer | ||
end | ||
|
||
private | ||
|
||
def check_permission! | ||
practice = Practice.find(params[:practice_id]) | ||
submission_answer = practice.submission_answer || SubmissionAnswer.new(practice:) | ||
return if policy(submission_answer).show? | ||
|
||
redirect_to practice_path(practice), alert: 'プラクティスを修了するまで模範解答は見れません。' | ||
end | ||
end |
Oops, something went wrong.