Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Fix Issue 14 #30

Merged
merged 5 commits into from
Aug 25, 2020
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: 4 additions & 1 deletion schedules/app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ footer {
}
}

/* This does nothing.
/* This does nothing.
I can't seem to find a way to edit these given the current HTML structure.
If possible, I think that it would look more pleasing to make the background
of the pop-up $white and the text contained inside of it $black, as it currently
Expand All @@ -397,4 +397,7 @@ footer {
}
}*/

:target{
background-color: $lightgreen;
}
}
4 changes: 3 additions & 1 deletion schedules/app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def index
end

/[0-9]{5}/.match(params[:query]) do |m|
redirect_to(course_url(CourseSection.latest_by_crn(m[0]).course))
course = CourseSection.latest_by_crn(m[0])
url = course_url(course.course) + "#section-" + course.id.to_s
redirect_to(url)
end

if @courses&.count == 1 && @instructors&.count&.zero?
Expand Down
12 changes: 12 additions & 0 deletions schedules/app/views/courses/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<%= render partial: 'shared/navbar' %>

<script>
//turbolinks prevents the site from properly jumping to an element when using https://www.url.com/page#element-id
//additionally, CSS styling is not properly applied to any :target attributes
//this prevented issue 14 from being resolved (https://github.com/srct/schedules/issues/14)
//the following script forces the page to update both the CSS and the window's location *after* turbolinks does its thing.
document.addEventListener("turbolinks:load", function(){
if(window.location.hash){
window.location = window.location.hash;
}
});
</script>

<div class="row">
<div class="col-12 col-lg">
<h1><%= @course.full_name %></h1>
Expand Down