Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.1-stable] Merge pull request #2735 from tvdeyen/fix-tags #2736

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions app/assets/stylesheets/alchemy/labels.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.label {
@include label-base(
$margin: $default-margin/2 0,
$padding: $default-padding 2*$default-padding $default-padding
);
@include label-base($margin: 0, $padding: 0 2 * $default-padding);
}
6 changes: 5 additions & 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,11 @@
<td class="icon"><%= render_icon(:tag, size: "xl") %></td>
<td class="name"><%= tag.name %></td>
<td>
<%= tag.taggings.collect(&:taggable).collect { |t| t.class.model_name.human }.uniq.join(', ') %>
<% tag.taggings.collect(&:taggable).compact.uniq.each do |taggable| %>
<span class="label">
<%= taggable.class.model_name.human %>
</span>
<% end %>
</td>
<td class="count"><%= tag.taggings.count %></td>
<td class="tools">
Expand Down
16 changes: 16 additions & 0 deletions spec/controllers/alchemy/admin/tags_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,26 @@ module Admin
before { authorize_user(:as_admin) }

describe "#index" do
render_views

let!(:picture) { create(:alchemy_picture, tag_list: "Foo,Bar") }

it "renders index template" do
get :index
expect(response).to be_successful
end

context "with taggable missing" do
before do
picture.thumbs.destroy_all
picture.delete
end

it "does not raise error" do
get :index
expect(response).to be_successful
end
end
end

describe "#create" do
Expand Down
Loading