diff --git a/app/controllers/embeds_controller.rb b/app/controllers/embeds_controller.rb
index 84a3434..5b5ff0f 100644
--- a/app/controllers/embeds_controller.rb
+++ b/app/controllers/embeds_controller.rb
@@ -30,10 +30,15 @@ def private_playlist
end
def oembed_show
- @track = Track.friendly.find(params[:track_id])
- return render status: 404, plain: "This track is private or not found" unless @track
-
- render json: data_for_oembed_track(@track)
+ if params[:track_id]
+ @track = Track.friendly.find(params[:track_id])
+ return render status: 404, plain: "This track is private or not found" unless @track
+ render json: data_for_oembed_track(@track)
+ else
+ @playlist = Playlist.friendly.find(params[:playlist_id])
+ return render status: 404, plain: "This playlist is private or not found" unless @playlist
+ render json: data_for_oembed_playlist(@playlist)
+ end
end
def oembed_private_show
@@ -80,4 +85,22 @@ def data_for_oembed_track(track)
author_url: user_url(track.user)
}
end
+
+ def data_for_oembed_playlist(playlist)
+ url = "#{playlist_private_embed_url(playlist.signed_id)}"
+ {
+ version: 1,
+ type: "rich",
+ provider_name: "Rauversion",
+ provider_url: root_url,
+ height: 450,
+ width: "100%",
+ title: "#{playlist.title} by #{playlist.user.username}",
+ description: playlist.description,
+ thumbnail_url: playlist.cover_url(:medium),
+ html: playlist.iframe_code_string(url),
+ author_name: playlist.user.username,
+ author_url: user_url(playlist.user)
+ }
+ end
end
diff --git a/app/controllers/playlists_controller.rb b/app/controllers/playlists_controller.rb
index af2d0c1..2018091 100644
--- a/app/controllers/playlists_controller.rb
+++ b/app/controllers/playlists_controller.rb
@@ -16,29 +16,7 @@ def show
@playlist ||= Playlist.published.friendly.find(params[:id])
@track = @playlist.tracks.first
- metatags = {
- title: @playlist.title,
- description: @playlist.description,
- keywords: "",
- # url: Routes.articles_show_url(socket, :show, playlist.id),
- title: "#{@playlist.title} on Rauversion",
- description: "Stream #{@playlist.title} by #{@playlist.user.username} on Rauversion.",
- image: @playlist.cover_url(:small),
- "twitter:player": playlist_embed_url(@playlist)
- }
-
- metatags.merge!({
- twitter: {
- card: "player",
- player: {
- stream: @playlist.tracks&.first&.mp3_audio&.url,
- "stream:content_type": "audio/mpeg",
- width: 290,
- height: 58
- }
- }
- })
- set_meta_tags(metatags)
+ get_meta_tags
end
def edit
@@ -89,7 +67,7 @@ def playlist_params
:id,
:title, :description, :private, :price,
:playlist_type, :release_date, :cover,
- :record_label, :buy_link,
+ :record_label, :buy_link, :buy_link_title,
:enable_label,
:copyright,
:attribution, :noncommercial, :non_derivative_works, :copies,
@@ -121,4 +99,34 @@ def find_playlist
.where(user_id: current_user.id).or(Playlist.where(label_id: current_user.id))
.friendly.find(params[:id])
end
+
+
+ def get_meta_tags
+ @supporters = []
+ set_meta_tags(
+ # title: @track.title,
+ # description: @track.description,
+ keywords: @playlist.tags.join(", "),
+ # url: Routes.articles_show_url(socket, :show, track.id),
+ title: "#{@playlist.title} on Rauversion",
+ description: "Stream #{@playlist.title} by #{@playlist.user.username} on Rauversion.",
+ image: @playlist.cover_url(:small),
+ "twitter:player": playlist_embed_url(@playlist),
+ twitter: {
+ card: "player",
+ player: {
+ stream: @playlist&.tracks&.first&.mp3_audio&.url,
+ "stream:content_type": "audio/mpeg",
+ width: 290,
+ height: 58
+ }
+ }
+ )
+
+ @oembed_json = !@playlist.private? ?
+ oembed_playlist_show_url(playlist_id: @playlist, format: :json)
+ : private_oembed_playlist_url(playlist_id: @playlist.signed_id, format: :json)
+
+
+ end
end
diff --git a/app/helpers/tailwind_form_builder.rb b/app/helpers/tailwind_form_builder.rb
index ad1055f..7be1e42 100644
--- a/app/helpers/tailwind_form_builder.rb
+++ b/app/helpers/tailwind_form_builder.rb
@@ -116,8 +116,8 @@ def color_fieldssss(object_name, method = "", options = {})
def div_radio_button(method, tag_value, options = {})
@template.tag.div(@template.radio_button(
- @object_name, method, tag_value, objectify_options(options)
- ))
+ @object_name, method, tag_value, objectify_options(options)
+ ))
end
def radio_button(method, value, options = {})
@@ -139,19 +139,25 @@ def radio_button(method, value, options = {})
end
end
end
-
+
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
- info = @template.label_tag(
- tr(options[:label] || method), nil,
- class: "block font-bold text-md leading-5 text-gray-900 dark:text-white pt-0"
- ) +
- field_details(method, object, options)
+ # Conditionally build the label if options[:label] is not false
+ info = ""
+ unless options[:label] == false
+ info = @template.label_tag(
+ tr(options[:label] || method), nil,
+ class: "block text-gray-500 dark:text-white text-sm font-normal"
+ ) + field_details(method, object, options)
+ end
+
+ # Merge in default class unless a specific class has been provided in options
+ options.merge!(class: "self-center mt-1-- mr-2 form-checkbox h-4 w-4 text-indigo-600 transition duration-150 ease-in-out") unless options.key?(:class)
- options[:class] = "self-start mt-1 mr-1 form-checkbox h-4 w-4 text-brand-600 transition duration-150 ease-in-out"
+ # Create the checkbox and, conditionally, its label
@template.tag.div(class: "flex items-center") do
@template.check_box(
@object_name, method, objectify_options(options), checked_value, unchecked_value
- ) + @template.tag.div(class: "flex-col items-center") { info }
+ ) + (info.present? ? @template.tag.div(class: "flex-col items-center") { info } : "".html_safe)
end
end
diff --git a/app/javascript/controllers/clipboard_controller.js b/app/javascript/controllers/clipboard_controller.js
new file mode 100644
index 0000000..9de8c0e
--- /dev/null
+++ b/app/javascript/controllers/clipboard_controller.js
@@ -0,0 +1,28 @@
+import { Controller } from "@hotwired/stimulus";
+
+export default class extends Controller {
+ static targets = ["source", "message"];
+
+ copy() {
+ const source = this.sourceTarget;
+ //source.select(); // Select the text field
+ navigator.clipboard.writeText(source.value);
+ //document.execCommand("copy"); // Copy the text inside the text field
+ //alert("Copied the text: " + source.value); // Alert the copied text
+
+ this.updateText()
+ }
+
+
+ updateText() {
+
+ this.messageTarget.textContent = this.messageTarget.dataset.text.ok || "Copied!"
+ this.messageTarget.classList.add("animate-pulse", "text-green-500"); // Adding animation and style
+
+ setTimeout(() => {
+ this.messageTarget.textContent = this.messageTarget.dataset.text;
+ this.messageTarget.classList.remove("animate-pulse", "text-green-500"); // Remove animation and style
+ }, 2000); // Revert after 2 seconds
+ }
+}
+
diff --git a/app/views/articles/_form.html.erb b/app/views/articles/_form.html.erb
index 661ed65..b5e3697 100644
--- a/app/views/articles/_form.html.erb
+++ b/app/views/articles/_form.html.erb
@@ -84,12 +84,18 @@
-
-
-
-
- Copiar enlace
-
+
+
+
+
+
+
+
+ Copiar enlace
+
+
+
+
diff --git a/app/views/embeds/_playlist.erb b/app/views/embeds/_playlist.erb
index 0321166..0670ee5 100644
--- a/app/views/embeds/_playlist.erb
+++ b/app/views/embeds/_playlist.erb
@@ -1 +1,199 @@
-yay!
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+ <%= image_tag @playlist.cover_url(:large),
+ class: "object-center object-cover group-hover:opacity-75"
+ %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= link_to user_path(@playlist.user.username) do %>
+ <%= @playlist.user.username %>
+ <% end %>
+
+
+
+
+
+ <%= render "sharer/share_button", resource: @playlist %>
+
+ <%= render "likes/like_button", resource: @playlist, button_class: liked?(@playlist) ? "button-active" : "button" %>
+
+
+ <% if user_signed_in? && @playlist.user_id == current_user.id %>
+ <%= link_to edit_playlist_path(@playlist), class: "button",
+ "data-turbo-frame": "modal" do %>
+
+
+
+
<%= t("playlists.edit") %>
+ <% end %>
+
+
+
+ <%= turbo_frame_tag "playlist-#{@playlist.id}-delete" do %>
+ <%= button_to playlist_path(@playlist),
+ method: :delete,
+ data: {confirm: t("delete.confirm"), turbo_method: :delete, turbo_confirm: t("delete.confirm")},
+ class: "button" do %>
+
+
+
+
<%= t("playlists.delete") %>
+ <% end %>
+ <% end %>
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= image_tag @playlist.user.avatar_url(:small), class: "rounded-full object-center object-cover group-hover:opacity-75" %>
+
+
+
+
+
+
+
+ <%= link_to @playlist.buy_link_title || "Payment Link",
+ @playlist.buy_link,
+ target: :blank,
+ class: "underline dark:border-white hover:bg-white hover:text-black border-black rounded-sm border-4 px-3 py-3" %>
+
+
+
+
+
+
+
+ <%= auto_link sanitize(@playlist.description, auto_link: true) %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%= t("profile.comments") %>
+
+
+
+
+
+ <%= render "comments/comment_list", comments: @playlist.comments.limit(10) %>
+ <% if user_signed_in? %>
+ <%= render "comments/form", resource: @playlist, comment: current_user.comments.new(commentable: @playlist) %>
+ <% end %>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/playlists/_metadata_tab.html.erb b/app/views/playlists/_metadata_tab.html.erb
index a768d72..e1b1167 100644
--- a/app/views/playlists/_metadata_tab.html.erb
+++ b/app/views/playlists/_metadata_tab.html.erb
@@ -3,6 +3,7 @@
<%= form.text_field :buy_link %>
+ <%= form.text_field :buy_link_title %>
<%= form.text_field :record_label %>
diff --git a/app/views/playlists/show.html.erb b/app/views/playlists/show.html.erb
index d7790f6..0d585bd 100644
--- a/app/views/playlists/show.html.erb
+++ b/app/views/playlists/show.html.erb
@@ -248,6 +248,14 @@
+
+
+ <%= link_to @playlist.buy_link_title || "Payment Link",
+ @playlist.buy_link,
+ target: :blank,
+ class: "underline dark:border-white hover:bg-white hover:text-black border-black rounded-sm border-4 px-3 py-3" %>
+
+