Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/helpers/pair_works_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ def meta_label_by_status(upcoming_pair_work)
today = upcoming_pair_work.reserved_at.to_date == Time.current.to_date
today ? 'a-meta__label is-important' : 'a-meta__label'
end

def meta_value_by_status(upcoming_pair_work)
today = upcoming_pair_work.reserved_at.to_date == Time.current.to_date
today ? 'a-meta__value is-important' : 'a-meta__value'
end
end
2 changes: 2 additions & 0 deletions app/views/home/_adviser_dashboard.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
.dashboard-category__body
.a-panels
.a-panels__items
- if @upcoming_pair_works.present?
= render 'upcoming_pair_works', upcoming_pair_works: @upcoming_pair_works
- if @upcoming_events_groups.present?
= render 'upcoming_events_groups', upcoming_events_groups: @upcoming_events_groups
.a-panels__item
Expand Down
4 changes: 4 additions & 0 deletions app/views/home/_mentor_dashboard.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
.dashboard-contents__cols
.dashboard-contents__col.is-sub.is-only-mentor
.dashboard-contents__categories
- if @upcoming_pair_works.present?
.dashboard-category
= render 'upcoming_pair_works', upcoming_pair_works: @upcoming_pair_works

.dashboard-category
- unchecked_report_count = Cache.unchecked_report_count
- if unchecked_report_count > 100
Expand Down
2 changes: 1 addition & 1 deletion app/views/home/_upcoming_pair_work.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
.a-meta
span class=meta_label_by_status(upcoming_pair_work)
| 開催日時
span class=meta_label_by_status(upcoming_pair_work)
span class=meta_value_by_status(upcoming_pair_work)
time datetime=upcoming_pair_work.reserved_at.iso8601
= l upcoming_pair_work.reserved_at
2 changes: 1 addition & 1 deletion db/fixtures/pair_works.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pair_work3:
reserved_at: <%= Time.current.beginning_of_day + 23.hours %>
user: kimura
practice: null
buddy: sotugyou
buddy: advijirou
published_at: <%= Time.current %>
created_at: <%= Time.current %>
wip: false
Expand Down
15 changes: 15 additions & 0 deletions test/helpers/pair_works_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,19 @@ def current_user
assert_not_equal normal_meta_label, meta_label_by_status(pair_work)
end
end

test 'meta_value_by_status' do
pair_work = pair_works(:pair_work2)
normal_meta_value = 'a-meta__value'
important_meta_value = 'a-meta__value is-important'

assert_equal normal_meta_value, meta_value_by_status(pair_work)
assert_not_equal important_meta_value, meta_value_by_status(pair_work)

reserved_on = Time.zone.local(2025, 1, 2)
travel_to reserved_on do
assert_equal important_meta_value, meta_value_by_status(pair_work)
assert_not_equal normal_meta_value, meta_value_by_status(pair_work)
end
end
end
Loading