Sha256: c0f1c5dd90164d836464c302f9b015bb673f6faed2a8626a84359649d0bf0b4d
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Maquina module Navbar class ProfileMenuItemLink < Phlex::HTML include ApplicationView delegate :t, to: :helpers def initialize(option, path, attributes, desktop: true, active: false) @option = option @path = path @attributes = attributes @desktop = desktop @active = active end def view_template link_method = link_attributes.dig(:method) if link_method == :delete button_to t("menu.profile.#{@option}"), @path, method: :delete, **link_attributes else a(href: @path, **link_attributes) { t("menu.profile.#{@option}") } end end private def link_attributes attrs = { role: "menuitem", tabindex: "-1" } attrs[:class] = @desktop ? "desktop-profile-menu-item" : "mobile-profile-menu-item" attrs.merge!(@attributes) if @attributes.is_a?(Hash) && @attributes.any? attrs end end end end
Version data entries
4 entries across 4 versions & 1 rubygems