|
1 | | -<% if button %> |
2 | | - <%= link_to "#", class: "menu__input #{ "btn mt-3" if defined?(large)}", data: { behavior: "modal_trigger", modal: "create_tag" }, onclick: "document.getElementById('create_tag_hcb_code_id').value = #{button.to_json}" do %> |
3 | | - <%= inline_icon "plus", size: 15 %> |
4 | | - Create tag |
5 | | - <% end %> |
6 | | -<% else %> |
7 | | -<section class="modal modal--scroll max-w-md bg-snow" data-behavior="modal" role="dialog" id="create_tag"> |
8 | | - <%= modal_header("Create tag") %> |
9 | | - <%= form_with url: event_tags_path(@event), id: "create_tag_form", data: { turbo: true } do |form| %> |
10 | | - <%= form.hidden_field :hcb_code_id, value: "", id: "create_tag_hcb_code_id" %> |
11 | | - <div class="flex flex-col gap-3 mb-2"> |
12 | | - <div class="flex gap-3"> |
13 | | - <div data-controller="emoji-picker" class="relative" data-emoji-picker-target="container"> |
14 | | - <%= form.text_field :emoji, placeholder: "🏦", class: "!w-10 placeholder:opacity-50", autocomplete: "off", data: { turbo: true, "emoji-picker-target": "input", "action": "focus->emoji-picker#togglePicker input->emoji-picker#validateInput" }, required: true %> |
15 | | - <emoji-picker data-emoji-picker-target="picker" data-action="emoji-click->emoji-picker#addEmoji" class="fixed mt-3 z-[300]" style="display: none;"></emoji-picker> |
| 1 | +<% if OrganizerPosition.role_at_least?(current_user, @event, :member) %> |
| 2 | + <% if button %> |
| 3 | + <%= link_to "#", class: "menu__input #{ "btn mt-3" if defined?(large)}", data: { behavior: "modal_trigger", modal: "create_tag" }, onclick: "document.getElementById('create_tag_hcb_code_id').value = #{button.to_json}" do %> |
| 4 | + <%= inline_icon "plus", size: 15 %> |
| 5 | + Create tag |
| 6 | + <% end %> |
| 7 | + <% else %> |
| 8 | + <section class="modal modal--scroll max-w-md bg-snow" data-behavior="modal" role="dialog" id="create_tag"> |
| 9 | + <%= modal_header("Create tag") %> |
| 10 | + <%= form_with url: event_tags_path(@event), id: "create_tag_form", data: { turbo: true } do |form| %> |
| 11 | + <%= form.hidden_field :hcb_code_id, value: "", id: "create_tag_hcb_code_id" %> |
| 12 | + <div class="flex flex-col gap-3 mb-2"> |
| 13 | + <div class="flex gap-3"> |
| 14 | + <div data-controller="emoji-picker" class="relative" data-emoji-picker-target="container"> |
| 15 | + <%= form.text_field :emoji, placeholder: "🏦", class: "!w-10 placeholder:opacity-50", autocomplete: "off", data: { turbo: true, "emoji-picker-target": "input", "action": "focus->emoji-picker#togglePicker input->emoji-picker#validateInput" }, required: true %> |
| 16 | + <emoji-picker data-emoji-picker-target="picker" data-action="emoji-click->emoji-picker#addEmoji" class="fixed mt-3 z-[300]" style="display: none;"></emoji-picker> |
| 17 | + </div> |
| 18 | + <%= form.text_field :label, autofocus: true, placeholder: "Tag name", style: "max-width: 100%", autocomplete: "off", data: { turbo: true }, required: true %> |
| 19 | + </div> |
| 20 | + <div class="flex gap-3"> |
| 21 | + <% Tag::COLORS.each do |color| %> |
| 22 | + <label class="tags__radio"> |
| 23 | + <%# Default color: Muted %> |
| 24 | + <%= form.radio_button :color, color, checked: color == "muted" %> |
| 25 | + <div class="radio__control tag-darker tag-<%= color %>"></div> |
| 26 | + </label> |
| 27 | + <% end %> |
| 28 | + </div> |
16 | 29 | </div> |
17 | | - <%= form.text_field :label, autofocus: true, placeholder: "Tag name", style: "max-width: 100%", autocomplete: "off", data: { turbo: true }, required: true %> |
18 | | - </div> |
19 | | - <div class="flex gap-3"> |
20 | | - <% Tag::COLORS.each do |color| %> |
21 | | - <label class="tags__radio"> |
22 | | - <%# Default color: Muted %> |
23 | | - <%= form.radio_button :color, color, checked: color == "muted" %> |
24 | | - <div class="radio__control tag-darker tag-<%= color %>"></div> |
25 | | - </label> |
26 | | - <% end %> |
27 | | - </div> |
28 | | - </div> |
29 | | - <%= form.submit "Create", class: "btn bg-info mt-2 float-right" %> |
| 30 | + <%= form.submit "Create", class: "btn bg-info mt-2 float-right" %> |
| 31 | + <% end %> |
| 32 | + </section> |
30 | 33 | <% end %> |
31 | | -</section> |
32 | 34 | <% end %> |
0 commit comments