Skip to content

Commit

Permalink
Merge pull request #2763 from AlchemyCMS/backport/7.0-stable/pr-2761
Browse files Browse the repository at this point in the history
[7.0-stable] Fix taggable uniqueness in tags admin table
  • Loading branch information
tvdeyen committed Feb 29, 2024
2 parents a2265b5 + a810160 commit e3399e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/alchemy/admin/tags/_tag.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<td class="icon"><%= render_icon :tag %></td>
<td class="name"><%= tag.name %></td>
<td>
<% tag.taggings.collect(&:taggable).compact.uniq.each do |taggable| %>
<% tag.taggings.collect(&:taggable).compact.uniq(&:class).each do |taggable| %>
<span class="label">
<%= taggable.class.model_name.human %>
</span>
Expand Down
19 changes: 19 additions & 0 deletions spec/features/admin/tags_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Tags", type: :system do
let!(:picture) { create(:alchemy_picture, tag_list: "Foo") }
let!(:picture2) { create(:alchemy_picture, tag_list: "Foo") }
let!(:a_page) { create(:alchemy_page, tag_list: "Bar") }

before { authorize_user(:as_admin) }

describe "index view" do
it "should list taggable class names" do
visit "/admin/tags"
expect(page).to have_selector(".label", text: "Picture", count: 1)
expect(page).to have_selector(".label", text: "Page", count: 1)
end
end
end

0 comments on commit e3399e9

Please sign in to comment.