From 23d3eb29752488b3590c135a42580a46655768e5 Mon Sep 17 00:00:00 2001 From: Tristan Date: Wed, 3 Sep 2025 21:36:09 -0400 Subject: [PATCH 1/2] views and routes --- app/controllers/artists_controller.rb | 9 +++++++++ app/controllers/dashboard_controller.rb | 6 ++++++ app/controllers/tracks_controller.rb | 9 +++++++++ app/views/artists/index.html.erb | 9 +++++++++ app/views/artists/show.html.erb | 11 ++++++++++ app/views/dashboard/index.html.erb | 23 +++++++++++++++++++++ app/views/tracks/index.html.erb | 11 ++++++++++ app/views/tracks/show.html.erb | 27 +++++++++++++++++++++++++ config/routes.rb | 6 ++++++ 9 files changed, 111 insertions(+) create mode 100644 app/controllers/artists_controller.rb create mode 100644 app/controllers/dashboard_controller.rb create mode 100644 app/controllers/tracks_controller.rb create mode 100644 app/views/artists/index.html.erb create mode 100644 app/views/artists/show.html.erb create mode 100644 app/views/dashboard/index.html.erb create mode 100644 app/views/tracks/index.html.erb create mode 100644 app/views/tracks/show.html.erb diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb new file mode 100644 index 0000000..aa9db3d --- /dev/null +++ b/app/controllers/artists_controller.rb @@ -0,0 +1,9 @@ +class ArtistsController < ApplicationController + def index + @artists = Artist.all + end + + def show + @artist = Artist.find(params[:id]) + end +end \ No newline at end of file diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb new file mode 100644 index 0000000..f1db2e2 --- /dev/null +++ b/app/controllers/dashboard_controller.rb @@ -0,0 +1,6 @@ +class DashboardController < ApplicationController + def index + @recent_tracks = Track.order(created_at: :desc).limit(5) + @recent_comments = Comment.order(created_at: :desc).limit(5) + end +end diff --git a/app/controllers/tracks_controller.rb b/app/controllers/tracks_controller.rb new file mode 100644 index 0000000..902d73c --- /dev/null +++ b/app/controllers/tracks_controller.rb @@ -0,0 +1,9 @@ +class TracksController < ApplicationController + def index + @tracks = Track.all + end + + def show + @track = Track.find(params[:id]) + end +end \ No newline at end of file diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb new file mode 100644 index 0000000..cd379a4 --- /dev/null +++ b/app/views/artists/index.html.erb @@ -0,0 +1,9 @@ +

All Artists

+ + \ No newline at end of file diff --git a/app/views/artists/show.html.erb b/app/views/artists/show.html.erb new file mode 100644 index 0000000..35d09fc --- /dev/null +++ b/app/views/artists/show.html.erb @@ -0,0 +1,11 @@ +

<%= @artist.name %>

+ +

Tracks

+ \ No newline at end of file diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb new file mode 100644 index 0000000..1d09314 --- /dev/null +++ b/app/views/dashboard/index.html.erb @@ -0,0 +1,23 @@ +

Dashboard

+ +

Recent Tracks

+ + +

Recent Comments

+ \ No newline at end of file diff --git a/app/views/tracks/index.html.erb b/app/views/tracks/index.html.erb new file mode 100644 index 0000000..a2586a8 --- /dev/null +++ b/app/views/tracks/index.html.erb @@ -0,0 +1,11 @@ +

All Tracks

+ + \ No newline at end of file diff --git a/app/views/tracks/show.html.erb b/app/views/tracks/show.html.erb new file mode 100644 index 0000000..52201b4 --- /dev/null +++ b/app/views/tracks/show.html.erb @@ -0,0 +1,27 @@ +

<%= @track.title %>

+

+ Artist: <%= @track.artist.name %>
+ Year: <%= @track.year %>
+ BPM: <%= @track.bpm %> +

+ +

Samples Used

+ + +

Sampled By

+ + +

Comments

+ \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 48254e8..e8323ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,11 @@ Rails.application.routes.draw do # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + resources :artists, only: [:index, :show] + resources :tracks, only: [:index, :show] + + get "/dashboard", to: "dashboard#index" + + # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. From 6dc7e76baed5191eda3a2a67cd0266528ed996c9 Mon Sep 17 00:00:00 2001 From: Tristan Date: Wed, 3 Sep 2025 21:37:20 -0400 Subject: [PATCH 2/2] lint fix --- app/controllers/artists_controller.rb | 2 +- app/controllers/dashboard_controller.rb | 8 ++++---- app/controllers/tracks_controller.rb | 2 +- config/routes.rb | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index aa9db3d..b542d50 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -6,4 +6,4 @@ def index def show @artist = Artist.find(params[:id]) end -end \ No newline at end of file +end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index f1db2e2..91905ae 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,6 +1,6 @@ class DashboardController < ApplicationController - def index - @recent_tracks = Track.order(created_at: :desc).limit(5) - @recent_comments = Comment.order(created_at: :desc).limit(5) - end + def index + @recent_tracks = Track.order(created_at: :desc).limit(5) + @recent_comments = Comment.order(created_at: :desc).limit(5) + end end diff --git a/app/controllers/tracks_controller.rb b/app/controllers/tracks_controller.rb index 902d73c..b1529a3 100644 --- a/app/controllers/tracks_controller.rb +++ b/app/controllers/tracks_controller.rb @@ -6,4 +6,4 @@ def index def show @track = Track.find(params[:id]) end -end \ No newline at end of file +end diff --git a/config/routes.rb b/config/routes.rb index e8323ee..bdd92c0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,12 +1,10 @@ Rails.application.routes.draw do # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html - resources :artists, only: [:index, :show] - resources :tracks, only: [:index, :show] + resources :artists, only: [ :index, :show ] + resources :tracks, only: [ :index, :show ] get "/dashboard", to: "dashboard#index" - - # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. get "up" => "rails/health#show", as: :rails_health_check