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

Commit

Permalink
Merge pull request #30 from srct/issue14
Browse files Browse the repository at this point in the history
Fix Issue 14
  • Loading branch information
zacwood9 authored Aug 25, 2020
2 parents ed5f47a + 3e9f1ce commit 5d0c07c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
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

0 comments on commit 5d0c07c

Please sign in to comment.