From cd21a38a9289629a249d703e186311c98c915c2d Mon Sep 17 00:00:00 2001 From: ArtOfCode- <hello@artofcode.co.uk> Date: Fri, 8 May 2020 19:42:36 +0100 Subject: [PATCH] Explicitly declare required tags --- app/views/posts/_form.html.erb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/views/posts/_form.html.erb b/app/views/posts/_form.html.erb index aba24f038..713d32852 100644 --- a/app/views/posts/_form.html.erb +++ b/app/views/posts/_form.html.erb @@ -38,6 +38,15 @@ <div class="form-group"> <%= f.label :tags_cache, 'Tags (at least one):', class: 'form-element' %> + <% required_tags = @category.required_tags.to_a %> + <% unless required_tags.empty? %> + <span class="form-caption"> + Requires at least one of + <% required_tags.each do |tag| %> + <span class="badge is-tag is-filled"><%= tag.name %></span> + <% end %> + </span> + <% end %> <%= f.select :tags_cache, options_for_select(@post.tags_cache.map { |t| [t, t] }, selected: @post.tags_cache), { include_blank: true }, multiple: true, class: "form-element js-tag-select", data: { tag_set: @category.tag_set_id } %> -- GitLab