Skip to content

Commit

Permalink
Replace tags table partial with table component
Browse files Browse the repository at this point in the history
Use the new table component to render the tags table. The CSS had to be adjusted to change the width of the table columns.
  • Loading branch information
kulturbande committed Jul 24, 2024
1 parent b17a9de commit 42b9b3c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 50 deletions.
2 changes: 1 addition & 1 deletion app/assets/builds/alchemy/admin.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/builds/alchemy/admin.css.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions app/assets/stylesheets/alchemy/admin/tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,17 @@ td,
}
}

th.count,
td.count {
th.taggings_count,
td.taggings_count {
width: 10%;
text-align: right;
padding-right: var(--spacing-4);
}

td.taggings_types {
width: 15%;
}

.list .login_status {
width: 16px;
}
Expand Down
32 changes: 0 additions & 32 deletions app/views/alchemy/admin/tags/_tag.html.erb

This file was deleted.

29 changes: 15 additions & 14 deletions app/views/alchemy/admin/tags/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@
<%= render 'alchemy/admin/resources/table_header' %>
<% if @tags.any? %>

<table class="list">
<thead>
<tr>
<th class="icon"></th>
<th class="name"><%= sort_link(@query, :name) %></th>
<th style="width: 15%"><%= Gutentag::Tag.human_attribute_name(:taggings_types) %></th>
<th class="count"><%= sort_link(@query, :taggings_count) %></th>
<th class="tools"></th>
</tr>
</thead>
<tbody>
<%= render partial: 'tag', collection: @tags %>
</tbody>
</table>
<%= render Alchemy::Admin::Resource::Table.new(@tags, query: @query, search_filter_params: search_filter_params) do |table| %>
<% table.icon_column "tag" %>
<% table.column :name, sortable: true %>
<% table.column :taggings_types do |tag| %>
<% tag.taggings.collect(&:taggable).compact.uniq(&:class).each do |taggable| %>
<span class="label">
<%= taggable.class.model_name.human %>
</span>
<% end %>
<% end %>
<% table.column :taggings_count, sortable: true %>

<% table.delete_button tooltip: Alchemy.t(:delete_tag), message: Alchemy.t(:do_you_really_want_to_delete_this_tag?) %>
<% table.edit_button tooltip: Alchemy.t(:edit_tag), title: Alchemy.t(:edit_tag) %>
<% end %>

<%= paginate @tags, theme: 'alchemy' %>

Expand Down

0 comments on commit 42b9b3c

Please sign in to comment.