Skip to content

Commit

Permalink
不要なインスタンス変数を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
reckyy committed Jul 9, 2024
1 parent aa26b90 commit 0dbb683
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
.card-body
.card__description
.niconico-calendar-nav
- if prev_month?(@current_date)
- 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)
= "#{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
Expand All @@ -31,7 +31,7 @@
th.niconico-calendar__header-day
th.niconico-calendar__header-day.is-saturday
tbody.niconico-calendar__body
- user.niconico_calendar(@current_calendar).each do |week|
- 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])
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def display_dashboard
@collegue_trainees_recent_reports = collegue_trainees_reports.order(reported_on: :desc).limit(10)
@recent_reports = Report.with_avatar.where(wip: false).order(reported_on: :desc, created_at: :desc).limit(10)
@collegues = current_user.collegues_other_than_self
calendar = NicoNicoCalendar.new(current_user, params[:niconico_calendar])
@current_date = calendar.current_date
@current_calendar = calendar.with_reports
@calendar = NicoNicoCalendar.new(current_user, params[:niconico_calendar])
end

def display_events_on_dashboard
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ def show
.where(status: 3)
.order(updated_at: :desc)

calendar = NicoNicoCalendar.new(@user, params[:niconico_calendar])
@current_date = calendar.current_date
@current_calendar = calendar.with_reports
@calendar = NicoNicoCalendar.new(@user, params[:niconico_calendar])

if logged_in?
render :show
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
- if current_user.github_account.present?
= render 'users/github_grass', user: current_user
- if current_user.student_or_trainee?
= render(Calendar::NicoNicoCalendarComponent.new(user: current_user, path: :niconico_calendar_date_path, current_date: @current_date, current_calendar: @current_calendar))
= render(Calendar::NicoNicoCalendarComponent.new(user: current_user, path: :niconico_calendar_date_path, current_date: @calendar.current_date, current_calendar: @calendar.with_reports))
= render partial: 'recent_reports'
2 changes: 1 addition & 1 deletion app/views/users/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
- unless @user.total_learning_time.zero? || @user.mentor?
= react_component 'Grass', { userId: @user.id }, { class: 'a-card' }
- if @user.student_or_trainee?
= render(Calendar::NicoNicoCalendarComponent.new(user: @user, path: :niconico_calendar_date_in_profile_path, current_date: @current_date, current_calendar: @current_calendar))
= render(Calendar::NicoNicoCalendarComponent.new(user: @user, path: :niconico_calendar_date_in_profile_path, current_date: @calendar.current_date, current_calendar: @calendar.with_reports))
- if @user.completed_practices.present?
- cache [@user, @completed_learnings] do
= render '/users/practices/completed_practices', user: @user, completed_learnings: @completed_learnings
Expand Down

0 comments on commit 0dbb683

Please sign in to comment.