Skip to content

Commit

Permalink
track deletion, initial config handles
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed Jun 8, 2024
1 parent 75169a4 commit ebcbd66
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ GEM
nio4r (2.7.3)
nokogiri (1.16.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
oauth (1.1.0)
Expand Down Expand Up @@ -608,6 +610,7 @@ GEM
stripe (8.6.0)
thor (1.3.1)
tiktoken_ruby (0.0.5-arm64-darwin)
tiktoken_ruby (0.0.5-x86_64-darwin)
tiktoken_ruby (0.0.5-x86_64-linux)
timeout (0.4.1)
transbank-sdk (3.0.2)
Expand Down Expand Up @@ -642,6 +645,7 @@ GEM
PLATFORMS
arm64-darwin-21
arm64-darwin-22
x86_64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/player_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ def update

def show
id = params[:id]
@track = Track.friendly.find(id)
@track = Track.friendly.find_by(id)

render status: :ok and return if @track.blank?
# @next_track = next_track(@track.id)
# @prev_track = previous(@track.id)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_tracks
User.track_preloaded_by_user(current_user_id: current_user&.id, user: @user )
#.where(user_id: @user.id)
else
User.track_preloaded_by_user_n(user: @user)
User.track_preloaded_by_user_n(user: @user).where(private: [nil, false])
#.where(user_id: @user.id)
#@user.tracks.published
end
Expand Down
8 changes: 4 additions & 4 deletions app/models/track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class Track < ApplicationRecord
has_many :listening_events
has_many :reposts
has_many :purchased_items, as: :purchased_item
has_many :likes, as: :likeable
has_many :comments, as: :commentable
has_one :track_peak
has_many :spotlights, as: :spotlightable
has_many :likes, as: :likeable, dependent: :destroy
has_many :comments, as: :commentable, dependent: :destroy
has_one :track_peak, dependent: :destroy
has_many :spotlights, as: :spotlightable, dependent: :destroy
# has_many :spotlighted_tracks, through: :spotlight_tracks

belongs_to :label, class_name: "User", optional: true
Expand Down
18 changes: 15 additions & 3 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,21 @@
<h1 class="font-bold text-4xl"><%= @title %></h1>

<% if @user.id == current_user&.id %>
<%= link_to @cta_url || new_account_connection_path, class: "button-sm-outline space-x-2", data: {turbo_frame: "modal"} do %>
<%= heroicon("plus") %>
<span><%= @cta_label || t("tracks.new_track") %></span>
<% if !@cta_url %>
<%= link_to new_track_path, class: "button-sm-outline space-x-2" do %>
<%= heroicon("plus") %>
<span><%= t("tracks.new_track") %></span>
<% end %>
<% else %>
<%= link_to @cta_url, class: "button-sm-outline space-x-2",
data: {turbo_frame: "modal"} do %>
<%= heroicon("plus") %>
<span><%= @cta_label %></span>
<% end %>
<% end %>
<% end %>

Expand Down
4 changes: 2 additions & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ebcbd66

Please sign in to comment.