From c2623bf7a06489588ae02d55ed19e2934033ef55 Mon Sep 17 00:00:00 2001 From: Swayam Agrahari Date: Fri, 20 Dec 2024 17:54:54 +0530 Subject: [PATCH 1/2] add visual indicator for campaign view --- app/assets/stylesheets/modules/_tables.styl | 4 ++++ app/helpers/course_helper.rb | 6 ++++++ app/views/campaigns/_course_row.html.haml | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/modules/_tables.styl b/app/assets/stylesheets/modules/_tables.styl index 0e32965fbd..168592b2a7 100644 --- a/app/assets/stylesheets/modules/_tables.styl +++ b/app/assets/stylesheets/modules/_tables.styl @@ -216,6 +216,10 @@ .table > tbody > .table-row--faded background-color #fafafa +.table > tbody > .table-row--closed + background-color: #f8d7da; + color: #721c24; + font-weight: bold; // Align buttons/text to the right of the action cell diff --git a/app/helpers/course_helper.rb b/app/helpers/course_helper.rb index 231cf9740a..f742316426 100644 --- a/app/helpers/course_helper.rb +++ b/app/helpers/course_helper.rb @@ -50,4 +50,10 @@ def format_wiki_namespaces(wiki_namespaces) "#{wiki_domain}-namespace-#{namespace}" end end + + def closed_course_class(course) + return 'table-row--closed' if course.flags&.dig(:closed_date) + '' +end + end diff --git a/app/views/campaigns/_course_row.html.haml b/app/views/campaigns/_course_row.html.haml index 0657a1b1d0..c53cfe47cf 100644 --- a/app/views/campaigns/_course_row.html.haml +++ b/app/views/campaigns/_course_row.html.haml @@ -1,4 +1,4 @@ -%tr{:class => "#{user ? date_highlight_class(course) : private_highlight_class(course)}", "data-link" => "#{course_slug_path(course.slug)}"} +%tr{:class => "#{user ? date_highlight_class(course) : private_highlight_class(course)} #{closed_course_class(course)}", "data-link" => "#{course_slug_path(course.slug)}"} %td{:class => "table-link-cell", :role => "button", :tabindex => "0"} %a.course-link{:href => "#{course_slug_path(course.slug)}"} %span.title From 5223d0d94e891031378aff0b36c30331870581de Mon Sep 17 00:00:00 2001 From: Swayam Agrahari Date: Fri, 20 Dec 2024 18:43:01 +0530 Subject: [PATCH 2/2] fixed some linting issue --- app/helpers/course_helper.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/helpers/course_helper.rb b/app/helpers/course_helper.rb index f742316426..ae09ea05d7 100644 --- a/app/helpers/course_helper.rb +++ b/app/helpers/course_helper.rb @@ -51,9 +51,8 @@ def format_wiki_namespaces(wiki_namespaces) end end - def closed_course_class(course) - return 'table-row--closed' if course.flags&.dig(:closed_date) - '' -end - + def closed_course_class(course) + return 'table-row--closed' if course.flags&.dig(:closed_date) + return '' + end end