mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Add ability to delete invite codes (#153)
* Add ability to delete invite codes Implemented destroy action in InviteCodesController and updated routes to support invite code deletion. Updated invite code partial to include a delete button and improved styling. Also refactored the generate tokens button in invite code settings to use DS::Button. * Show advanced settings only to admin users Updated the settings navigation to display the advanced section only for admin users. Also improved handling of hidden elements in the invite code CSS.
This commit is contained in:
@@ -20,16 +20,18 @@ nav_sections = [
|
||||
{ label: t(".merchants_label"), path: family_merchants_path, icon: "store" }
|
||||
]
|
||||
},
|
||||
{
|
||||
header: t(".advanced_section_title"),
|
||||
items: [
|
||||
{ label: t(".ai_prompts_label"), path: settings_ai_prompts_path, icon: "bot" },
|
||||
{ label: t(".api_keys_label"), path: settings_api_key_path, icon: "key" },
|
||||
{ label: t(".self_hosting_label"), path: settings_hosting_path, icon: "database", if: self_hosted? },
|
||||
{ label: t(".imports_label"), path: imports_path, icon: "download" },
|
||||
{ label: "SimpleFin", path: simplefin_items_path, icon: "building-2" }
|
||||
]
|
||||
},
|
||||
(
|
||||
Current.user.admin? ? {
|
||||
header: t(".advanced_section_title"),
|
||||
items: [
|
||||
{ label: t(".ai_prompts_label"), path: settings_ai_prompts_path, icon: "bot" },
|
||||
{ label: t(".api_keys_label"), path: settings_api_key_path, icon: "key" },
|
||||
{ label: t(".self_hosting_label"), path: settings_hosting_path, icon: "database", if: self_hosted? },
|
||||
{ label: t(".imports_label"), path: imports_path, icon: "download" },
|
||||
{ label: "SimpleFin", path: simplefin_items_path, icon: "building-2" }
|
||||
]
|
||||
} : nil
|
||||
),
|
||||
{
|
||||
header: t(".other_section_title"),
|
||||
items: [
|
||||
@@ -54,7 +56,7 @@ nav_sections = [
|
||||
<% end %>
|
||||
</div>
|
||||
<nav class="space-y-4 hidden md:block">
|
||||
<% nav_sections.each do |section| %>
|
||||
<% nav_sections.compact.each do |section| %>
|
||||
<section class="space-y-2">
|
||||
<div class="flex items-center gap-2 px-3">
|
||||
<h3 class="uppercase text-secondary font-medium text-xs"><%= section[:header] %></h3>
|
||||
@@ -87,7 +89,7 @@ nav_sections = [
|
||||
variant: "ghost",
|
||||
) %>
|
||||
</li>
|
||||
<% nav_sections.each do |section| %>
|
||||
<% nav_sections.compact.each do |section| %>
|
||||
<% section[:items].each do |item| %>
|
||||
<% next if item[:if] == false %>
|
||||
<li>
|
||||
|
||||
@@ -33,11 +33,12 @@
|
||||
<span class="text-primary text-base font-medium"><%= t(".generated_tokens") %></span>
|
||||
</div>
|
||||
<div>
|
||||
<%= button_to invite_codes_path,
|
||||
method: :post,
|
||||
class: "flex gap-1 bg-gray-50 text-primary text-sm rounded-lg px-3 py-2" do %>
|
||||
<span><%= t(".generate_tokens") %></span>
|
||||
<% end %>
|
||||
<%= render DS::Button.new(
|
||||
text: t(".generate_tokens"),
|
||||
variant: "primary",
|
||||
href: invite_codes_path,
|
||||
method: :post
|
||||
) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user