Sha256: c12c37db7ee92521f178da6ec86541113e66296d1d1ade4bae509abff2123ae2
Contents?: true
Size: 872 Bytes
Versions: 47
Compression:
Stored size: 872 Bytes
Contents
# frozen_string_literal: true module Decidim # # This class handles all logic regarding menu items # class MenuItem # Builds a new menu item # # @param label [String, Symbol] A compulsory label for the menu item # @param url [String, Symbol] The URL this item will link to # @param options [Hash] The options for the menu item # def initialize(label, url, identifier, options = {}) @label = label @url = url @identifier = identifier @position = options[:position] || Float::INFINITY @if = options[:if] @active = options[:active] @icon_name = options[:icon_name] @submenu = options[:submenu] end attr_accessor :position attr_reader :label, :url, :active, :icon_name, :submenu, :identifier def visible? return true if @if.nil? || @if false end end end
Version data entries
47 entries across 47 versions & 1 rubygems