Skip to content

Commit

Permalink
Playlist description fixes (#5847)
Browse files Browse the repository at this point in the history
* Use i18n for consistent labelling and simple_format for display of newline characters

* Remove restrictions on playlist description length by converting to column to type text
  • Loading branch information
cjcolvar authored Jun 5, 2024
1 parent 3dbc7b9 commit 6e0a08c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/models/playlist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class Playlist < ActiveRecord::Base

validates :user, presence: true
validates :title, presence: true
validates :comment, length: { maximum: 255 }
validates :visibility, presence: true
validates :visibility, inclusion: { in: proc { [PUBLIC, PRIVATE, PRIVATE_WITH_TOKEN] } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Unless required by applicable law or agreed to in writing, software distributed
--- END LICENSE_HEADER BLOCK ---
%>
<% if @playlist.comment.present? %>
<h4>Comments</h4>
<%= @playlist.comment %>
<h4><%= t("activerecord.attributes.playlist.comment") %></h4>
<%= simple_format @playlist.comment %>
<% end %>
<% if @playlist.tags.present? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/playlists/_show_playlist_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Unless required by applicable law or agreed to in writing, software distributed
<% if @playlist.comment.blank? %>
<span class="info-text-gray">No description</span>
<% else %>
<%= @playlist.comment %>
<%= simple_format @playlist.comment %>
<% end %>
</dd>
<dt class="col-sm-2"><%= t("playlist.visibility") %>:</dt>
Expand Down
2 changes: 1 addition & 1 deletion app/views/playlists/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Unless required by applicable law or agreed to in writing, software distributed
playlist_item_ids: @playlist.item_ids,
token: @playlist_token,
share: { canShare: (will_partial_list_render? :share), content: render('share') },
comment_tag: { content: render('comments_and_tags') }
comment_tag: { content: render('description_and_tags') }
}
) %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_04_24_200346) do
ActiveRecord::Schema[7.0].define(version: 2024_05_31_201828) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -196,7 +196,7 @@
create_table "playlists", force: :cascade do |t|
t.string "title"
t.bigint "user_id", null: false
t.string "comment"
t.text "comment"
t.string "visibility"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
Expand Down

0 comments on commit 6e0a08c

Please sign in to comment.