diff --git a/app/helpers/menus_helper.rb b/app/helpers/menus_helper.rb index 41907fa0..b5ec8444 100644 --- a/app/helpers/menus_helper.rb +++ b/app/helpers/menus_helper.rb @@ -6,7 +6,7 @@ module MenusHelper end end - def contextual_menu_modal_action_item(label, url, icon: "pencil-line", turbo_frame: nil) + def contextual_menu_modal_action_item(label, url, icon: "pencil-line", turbo_frame: :modal) link_to url, class: "flex items-center rounded-lg text-gray-900 hover:bg-gray-50 py-2 px-3 gap-2", data: { turbo_frame: } do concat(lucide_icon(icon, class: "shrink-0 w-5 h-5 text-gray-500")) concat(tag.span(label, class: "text-sm")) diff --git a/app/javascript/controllers/merchant_avatar_controller.js b/app/javascript/controllers/merchant_avatar_controller.js index 5f5134b2..077c9e9a 100644 --- a/app/javascript/controllers/merchant_avatar_controller.js +++ b/app/javascript/controllers/merchant_avatar_controller.js @@ -1,32 +1,29 @@ -import {Controller} from "@hotwired/stimulus"; +import { Controller } from "@hotwired/stimulus"; // Connects to data-controller="merchant-avatar" // Used by the transaction merchant form to show a preview of what the avatar will look like export default class extends Controller { static targets = [ "name", - "color", "avatar" ]; connect() { this.nameTarget.addEventListener("input", this.handleNameChange); - this.colorTarget.addEventListener("input", this.handleColorChange); } disconnect() { this.nameTarget.removeEventListener("input", this.handleNameChange); - this.colorTarget.removeEventListener("input", this.handleColorChange); } handleNameChange = (e) => { this.avatarTarget.textContent = (e.currentTarget.value?.[0] || "?").toUpperCase(); } - handleColorChange = (e) => { + handleColorChange(e) { const color = e.currentTarget.value; this.avatarTarget.style.backgroundColor = `color-mix(in srgb, ${color} 5%, white)`; this.avatarTarget.style.borderColor = `color-mix(in srgb, ${color} 10%, white)`; this.avatarTarget.style.color = color; } -} +} \ No newline at end of file diff --git a/app/views/merchants/_form.html.erb b/app/views/merchants/_form.html.erb index 9e78369c..626ccb4c 100644 --- a/app/views/merchants/_form.html.erb +++ b/app/views/merchants/_form.html.erb @@ -1,19 +1,16 @@ -<% is_editing = @merchant.id.present? %>
- <%= merchant.name %> -
-+ <%= merchant.name %> +
+<%= t(".empty") %>
<%= link_to new_merchant_path, class: "w-fit flex text-white text-sm font-medium items-center gap-1 bg-gray-900 rounded-lg p-2 pr-3", data: { turbo_frame: "modal" } do %> <%= lucide_icon("plus", class: "w-5 h-5") %> - <%= t(".new_long") %> + <%= t(".new") %> <% end %><%= t(".title") %>
- · + ·<%= @merchants.count %>