Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAY-1391] Add Category to Playbook kit generator #3488

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions playbook-website/app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def aggregate_kits
end

def categories
aggregate_kits.map { |item| item["name"] }
aggregate_kits.map { |item| item["category"] }
end

def all_kits
Expand All @@ -232,7 +232,7 @@ def set_js
end

def set_category
@category = params[:name]
@category = params[:category]
if categories.include?(@category) && helpers.category_has_kits?(category_kits: kit_categories, type: params[:type])
@category_kits = kit_categories
@kits = params[:name]
Expand All @@ -242,8 +242,8 @@ def set_category
end

def kit_categories
@category = params[:name]
aggregate_kits.find { |item| item["name"] == @category }["components"].map { |component| component["name"] }
@category = params[:category]
aggregate_kits.find { |item| item["category"] == @category }["components"].map { |component| component["name"] }
end

def set_kit
Expand Down
6 changes: 3 additions & 3 deletions playbook-website/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ def aggregate_kits_with_status
all_kits = []

MENU["kits"].each do |kit|
kit_name = kit["name"]
kit_category = kit["category"]
# Modify this line to include both name and status in the components array
components = kit["components"].map { |c| { name: c["name"], status: c["status"] } }

all_kits << { kit_name => components }
all_kits << { kit_category => components }
end

all_kits
Expand All @@ -166,7 +166,7 @@ def search_list

aggregate_kits_with_status.each do |kit|
if kit.is_a? Hash
_kit_name, components = kit.first
_kit_category, components = kit.first
components.each do |component|
all_kits.push(component[:name]) if component[:status] != "beta"
end
Expand Down
Loading
Loading