<% grouped_tags.each do |tag, page_list| %>
<%=
link_to send(
"#{content_type.name.downcase.pluralize}_path",
slug: PageTagService.slug_for(tag)
) do
%>
<%= tag %>
<% end %>
<%= form_for tag, url: rename_tag_path(tag: tag) do |f| %>
<%= f.text_field :label, class: '', value: tag %>
<%= f.label :label, 'Rename tag' %>
<%= f.submit 'Mass-rename', class: 'btn white blue-text', onclick: "javascript: M.toast({ html: 'Saving changes...' });" %>
<% end %>
<%=
link_to 'Delete this tag', tag_remove_path(
page_type: content_type.name,
slug: PageTagService.slug_for(tag)
), data: {
confirm: "Are you sure? This will delete this tag and remove it from all pages."
}, class: 'red-text btn red white-text'
%>
Used by <%= pluralize page_list.length, 'page' %>
<% page_list.each do |page_tag| %>
<%= link_to send("#{page_tag.page_type.downcase}_path", page_tag.page_id) do %>
<%= content_type.icon %>
Loading <%= content_type.name %> name...
<% end %>
<%= link_to destroy_specific_tag_path(page_tag), method: :delete, class: 'tooltipped', data: { tooltip: 'Remove this tag from this page' }, remote: true do %>
close
<% end %>
<% end %>
<% end %>