Skip to content

Commit

Permalink
Feature: Rename Tracks to Paths (TheOdinProject#1404)
Browse files Browse the repository at this point in the history
Because:
* It is a friendier name for this concept.
  • Loading branch information
KevinMulhern authored Oct 13, 2020
1 parent cbc0034 commit 0146ac2
Show file tree
Hide file tree
Showing 37 changed files with 206 additions and 205 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application_stylesheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
@import 'typography';
@import 'mixins';
@import 'utilities';
@import 'tracks';
@import 'paths';
@import 'components/**/*';
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// Place all the styles related to the tracks controller here.
// Place all the styles related to the paths controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.tracks-index {
.paths-index {
padding-bottom: 80px;
p {
margin: 24px auto;
max-width: 770px;
}
}

.track-description {
.path-description {
margin-bottom: 38px;
}

.track-card {
.path-card {
max-width: 770px;
margin: 0 auto;
}

.track-card-title {
.path-card-title {
display: flex;
align-items: center;
padding-bottom: 16px;
Expand Down
17 changes: 17 additions & 0 deletions app/controllers/paths_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class PathsController < ApplicationController
def show
@path = Path.friendly.find(params[:id])
@courses = decorated_courses
@user = current_user
end

def index
@paths = Path.all
end

private

def decorated_courses
@path.courses.map { |course| CourseDecorator.new(course) }
end
end
17 changes: 0 additions & 17 deletions app/controllers/tracks_controller.rb

This file was deleted.

20 changes: 20 additions & 0 deletions app/controllers/users/paths_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Users
class PathsController < ApplicationController
before_action :authenticate_user!

def create
current_user.update_attributes!(path_id: path_id)
redirect_to path
end

private

def path_id
params.fetch(:path_id)
end

def path
Path.find(path_id)
end
end
end
24 changes: 0 additions & 24 deletions app/controllers/users/tracks_controller.rb

This file was deleted.

10 changes: 5 additions & 5 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class UsersController < ApplicationController
authorize_resource only: %i[edit update]

def show
@courses = decorated_track_courses
@track = @user.track
@courses = decorated_path_courses
@path = @user.path
end

def update
Expand All @@ -15,8 +15,8 @@ def update

private

def decorated_track_courses
@user.track.courses.map do |course|
def decorated_path_courses
@user.path.courses.map do |course|
CourseDecorator.new(course)
end
end
Expand All @@ -34,7 +34,7 @@ def user_params
:learning_goal,
:uid,
:provider,
:track_id,
:path_id,
)
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def faq_items
{
question: 'Which technologies can one expect to learn from The Odin Project?',
answer:
"<p> The Odin Project contains three tracks for students to choose from: <a href='tracks/full-stack-ruby-on-rails'>Fullstack Ruby on Rails</a>, <a href='tracks/full-stack-javascript'>Fullstack Javascript</a>, and <a href='tracks/front-end-only'>Frontend only</a>. The Ruby on Rails track gives a general overview of what fullstack is. This is the default track for most beginners. The Javascript track focuses more on the connection between the webpage and the data with Javascript and NodeJS. The Frontend track primarily goes over HTML, CSS and Javascript but no Ruby on Rails. Below are some courses that are included in these curriculums:</p>
"<p> The Odin Project contains three paths for students to choose from: <a href='paths/full-stack-ruby-on-rails'>Fullstack Ruby on Rails</a>, <a href='paths/full-stack-javascript'>Fullstack Javascript</a>, and <a href='paths/front-end-only'>Frontend only</a>. The Ruby on Rails path gives a general overview of what fullstack is. This is the default path for most beginners. The Javascript path focuses more on the connection between the webpage and the data with Javascript and NodeJS. The Frontend path primarily goes over HTML, CSS and Javascript but no Ruby on Rails. Below are some courses that are included in these curriculums:</p>
<br />
<p>The <a href='courses/web-development-101'>Web Development 101 course</a> will give you a chance to explore several of the languages and technologies you’ll need to know on your journey to becoming a web developer. Web Development 101 introduces HTML, CSS, Javascript, Ruby, Rails, Git, databases and more. We’ve also created mini-projects that give you a chance to test your new knowledge by building your own applications and websites!</p>
<br />
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/tracks_helper.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/models/course.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class Course < ApplicationRecord
extend FriendlyId

has_many :track_courses
has_many :tracks, through: :track_courses
has_many :path_courses
has_many :paths, through: :path_courses
has_many :sections, -> { order(:position) }
has_many :lessons, through: :sections

Expand Down
6 changes: 3 additions & 3 deletions app/models/track.rb → app/models/path.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class Track < ApplicationRecord
class Path < ApplicationRecord
extend FriendlyId

has_many :users
has_many :track_courses, -> { order(:position) }, dependent: :destroy
has_many :courses, through: :track_courses
has_many :path_courses, -> { order(:position) }, dependent: :destroy
has_many :courses, through: :path_courses

validates :title, presence: true
validates :description, presence: true
Expand Down
6 changes: 6 additions & 0 deletions app/models/path_course.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class PathCourse < ApplicationRecord
belongs_to :path
belongs_to :course

validates :position, :course_id, :path_id, presence: true
end
6 changes: 0 additions & 6 deletions app/models/track_course.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class User < ApplicationRecord
has_many :project_submissions, dependent: :destroy
has_many :user_providers, dependent: :destroy
has_many :flags, foreign_key: :flagger_id, dependent: :destroy
belongs_to :track
belongs_to :path

def progress_for(course)
@progress ||= Hash.new { |hash, c| hash[c] = CourseProgress.new(c, self) }
Expand Down
23 changes: 23 additions & 0 deletions app/views/paths/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="curriculum-background">
<div class="container paths-index">
<h1 class="text-center camel light">Learning Paths</h1>
<h2 class="text-center">
Select from our available learning paths below
</h2>
<p class="text-center">Paths are our way of offering multiple paths through our curriculum.</p>
<p class="text-center">
You can change your path at any time, and your progress will not be lost. Many of our paths share the same fundamental lessons, so any progress you've made on any shared courses or lessons will transfer between paths.</p>


<% @paths.each do |path| %>
<div class="card-main path-card">
<div class="path-card-title">
<h1><%=path.title%></h1>
<%= link_to "View path", path_url(path), class:"button button--secondary" %>
</div>
<p><%= path.description%></p>
</div>
<% end %>
</div>
</div>

30 changes: 30 additions & 0 deletions app/views/paths/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div class="container">
<h1 class="text-center camel light curriculum-title"><%= @path.title %></h1>
<p class="text-center path-description"><%= @path.description %></p>


<% @courses.each do |course| %>
<%= render 'courses/course_card', course: course %>
<% end %>

<% if user_signed_in? %>
<%if current_user.path == @path %>
<p class="text-center path-description">
You are currently enrolled in this path.
</p>
<% else %>
<p class="text-center path-description">
<%= link_to 'Select This Path', users_paths_url(path_id: @path.id), remote: true, method: :post, class: 'button button--primary' %>
</p>
<% end %>
<% else %>
<p class="text-center path-description">
<%= render 'shared/bottom_cta',
button: sign_in_or_view_curriculum_button,
heading: 'Start learning for free now!',
sub_heading: ''
%>
</p>
<% end %>
<p class="text-center path-description">You are viewing the <%= @path.title %> path. To view all available paths <%= link_to 'click here', paths_url %></p>
</div>
4 changes: 2 additions & 2 deletions app/views/shared/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<!-- Full Width Navbar -->
<ul class="navbar-nav ml-auto hidden-md-down">
<li class="nav-item <%= active_class(courses_path) %>">
<%= link_to 'My Courses', track_path(current_user.track), class: 'nav-link' %>
<%= link_to 'My Courses', path_url(current_user.path), class: 'nav-link' %>
</li>
<li class="nav-item dropdown js-dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Expand All @@ -42,7 +42,7 @@
<nav class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item <%= active_class(courses_path) %>">
<%= link_to 'Curriculum', tracks_path, class: 'nav-link' %>
<%= link_to 'Curriculum', paths_url, class: 'nav-link' %>
</li>
<li class="nav-item dropdown js-dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_navbar_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</li>

<li class="nav-item <%= active_class(courses_path) %>">
<%= link_to 'Curriculum', track_path(current_user.track_id), class: 'nav-link' %>
<%= link_to 'Curriculum', path_url(current_user.path_id), class: 'nav-link' %>
</li>
<li class="nav-item">
<%= link_to 'Forum', forum_link, class: 'nav-link' %>
Expand All @@ -37,7 +37,7 @@

<% else %>
<li class="nav-item <%= active_class(courses_path) %>">
<%= link_to 'Curriculum', tracks_path, class: 'nav-link' %>
<%= link_to 'Curriculum', paths_url, class: 'nav-link' %>
</li>

<li class="nav-item">
Expand Down
2 changes: 1 addition & 1 deletion app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<header>
<h1 class="accent hero__main-heading"> Your Career in Web Development Starts Here </h1>
<p class="secondary hero__sub-heading"> Our full stack curriculum is free and supported by a passionate open source community.</p>
<%= link_to 'View Full Curriculum', tracks_path, class: 'button button--primary' %>
<%= link_to 'View Full Curriculum', paths_url, class: 'button button--primary' %>
</header>
<%= image_tag 'home-isometric.svg', class: 'hero__image', alt: 'home-page-banner' %>
</div>
Expand Down
23 changes: 0 additions & 23 deletions app/views/tracks/index.html.erb

This file was deleted.

30 changes: 0 additions & 30 deletions app/views/tracks/show.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/users/_skills.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<%= render 'skill', course: course %>
<% end %>

<p class="text-center">You are currently enrolled in the <%= @track.title %> track. To view all available tracks <%= link_to 'click here', tracks_path %></p>
<p class="text-center">You are currently enrolled in the <%= @path.title %> path. To view all available paths <%= link_to 'click here', paths_url %></p>
</div>
Loading

0 comments on commit 0146ac2

Please sign in to comment.