diff --git a/app/assets/tailwind/application.css b/app/assets/tailwind/application.css index bab9ea57f..05d43058d 100644 --- a/app/assets/tailwind/application.css +++ b/app/assets/tailwind/application.css @@ -172,4 +172,16 @@ &::-webkit-scrollbar-thumb:hover { background: #a6a6a6; } +} + +.invite_code [data-clipboard-target="iconDefault"], +.invite_code [data-clipboard-target="iconSuccess"] { + transition: opacity 0.2s; + opacity: 1; +} +.invite_code .hidden { + display: none !important; + opacity: 0; + pointer-events: none; + position: absolute; } \ No newline at end of file diff --git a/app/controllers/invite_codes_controller.rb b/app/controllers/invite_codes_controller.rb index fa8aa97cd..e97cb6ec0 100644 --- a/app/controllers/invite_codes_controller.rb +++ b/app/controllers/invite_codes_controller.rb @@ -11,6 +11,12 @@ class InviteCodesController < ApplicationController redirect_back_or_to invite_codes_path, notice: "Code generated" end + def destroy + code = InviteCode.find(params[:id]) + code.destroy + redirect_back_or_to invite_codes_path, notice: "Code deleted" + end + private def ensure_self_hosted diff --git a/app/views/invite_codes/_invite_code.html.erb b/app/views/invite_codes/_invite_code.html.erb index b4f52d456..0a7e6ee92 100644 --- a/app/views/invite_codes/_invite_code.html.erb +++ b/app/views/invite_codes/_invite_code.html.erb @@ -1,16 +1,21 @@ <%# app/views/invite_codes/_invite_code.html.erb %>
-
+
- <%= invite_code.token %> + <%= invite_code.token %> +
+
+ + <%= button_to invite_code_path(invite_code), method: :delete, data: { confirm: "Are you sure?" }, class: "ml-2 text-red-600 text-xs" do %> + <%= icon("trash-2", size: "sm", class: "inline mr-1") %> + <% end %>
-
diff --git a/app/views/settings/_settings_nav.html.erb b/app/views/settings/_settings_nav.html.erb index 758a810de..6e7397272 100644 --- a/app/views/settings/_settings_nav.html.erb +++ b/app/views/settings/_settings_nav.html.erb @@ -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 %>