24cb5da194
* Make Fizzy Ask invisible but usable by staff * Remove unused span * Prevent non-staff users from creating or browsing messages * Extract staff-only into a mixin * Keep existing markup, use the utility class we already have --------- Co-authored-by: Jason Zimdars <jz@37signals.com>
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
<%= tag.div \
|
|
class: "bar full-width",
|
|
data: {
|
|
controller: "bar",
|
|
bar_dialog_outlet: "#bar-modal",
|
|
bar_search_url_value: search_path,
|
|
bar_ask_url_value: conversation_path
|
|
} do %>
|
|
<div class="flex justify-center bar__placeholder" data-bar-target="buttonsContainer">
|
|
<%= tag.button \
|
|
class: "btn btn--plain",
|
|
data: {
|
|
controller: "hotkey",
|
|
action: "
|
|
bar#search
|
|
keydown.meta+k@document->hotkey#click keydown.ctrl+k@document->hotkey#click" } do %>
|
|
<span>Search (<%= hotkey_label(["ctrl", "K"]) %>)</span>
|
|
<% end %>
|
|
<% if Current.user.staff? %>
|
|
<%= tag.button \
|
|
class: "btn btn--plain visually-hidden",
|
|
data: {
|
|
controller: "hotkey",
|
|
action: "
|
|
bar#ask
|
|
keydown.meta+a@document->hotkey#click keydown.ctrl+a@document->hotkey#click" } do %>
|
|
<span>Ask (<%= hotkey_label(["ctrl", "A"]) %>)</span>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="bar__input" data-bar-target="searchInput" hidden>
|
|
<%= render "searches/form", query_terms: "" %>
|
|
</div>
|
|
|
|
<% if Current.user.staff? %>
|
|
<div class="bar__input" data-bar-target="askInput" hidden>
|
|
<%= render "conversations/composer" %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= tag.dialog \
|
|
id: "bar-modal",
|
|
class: "bar__modal",
|
|
data: {
|
|
controller: "dialog",
|
|
dialog_target: "dialog",
|
|
action: "keydown.esc@document->bar#reset:stop" } do %>
|
|
<%= turbo_frame_tag "bar-content", data: { bar_target: "turboFrame" } %>
|
|
<% end %>
|
|
<% end %>
|