Skip to content

Commit

Permalink
Rename enabled to documented on Component
Browse files Browse the repository at this point in the history
  • Loading branch information
davidalejandroaguilar committed Oct 9, 2024
1 parent a8de889 commit 71811a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions app/models/component.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class Component
include ActiveModel::Model

attr_accessor :name, :category, :enabled
attr_writer :documented
attr_accessor :name, :category
attr_reader :id

@@registry = {}
Expand All @@ -11,7 +12,7 @@ def initialize(name:, category:)
@id = name.parameterize
@name = name
@category = category
@enabled = file_exists?
@documented = file_exists?
end

def self.load_components
Expand Down Expand Up @@ -43,6 +44,10 @@ def modifiers
"PhlexyUI::#{name}".constantize.modifiers
end

def documented?
@documented
end

private

def file_exists?
Expand Down
2 changes: 1 addition & 1 deletion app/views/components/sidebar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def view_template
item.submenu do |submenu|
category.components.each do |component|
submenu.item do
if component.enabled
if component.documented?
link_to(
component.name,
examples_path(component),
Expand Down

0 comments on commit 71811a1

Please sign in to comment.