Skip to content

Commit a87c0d7

Browse files
committed
[spalenque] - #14539 * changes on software page
1 parent adb5f9a commit a87c0d7

6 files changed

Lines changed: 18 additions & 6 deletions

File tree

software/code/infrastructure/active_records/OpenStackComponentCategory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class OpenStackComponentCategory extends DataObject implements IOpenStackCompone
2121
static $db = array
2222
(
2323
'Name' => 'Varchar(255)',
24+
'Label' => 'Varchar(255)',
2425
'Description' => 'Text',
2526
'Slug' => 'Varchar(255)',
2627
'Order' => 'Int',
@@ -62,6 +63,10 @@ protected function onBeforeWrite()
6263
$this->Slug = $checkSlug;
6364
}
6465

66+
if (empty($this->Label)) {
67+
$this->Label = $this->Name;
68+
}
69+
6570
// if removed from a collection of subcategories we disable the category
6671
if (!$this->ParentCategoryID && $this->isChanged('ParentCategoryID')) {
6772
$this->Enabled = 0;

software/code/tasks/IngestOpenStackComponentsDataCronTask.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,25 +303,30 @@ private function processComponentsAndCategories()
303303

304304
foreach($categoryYaml['tabs'] as $tab) {
305305
$subcatName = $tab['name'];
306-
//echo sprintf("- cat %s ", $subcatName).PHP_EOL;
306+
$subcatDesc = $tab['prelude'];
307+
//echo sprintf("- cat %s - %s ", $subcatName, $subcatDesc).PHP_EOL;
307308

308309
// one level categories will have a tab with same name as category, so we skip the level
309310
if ($subcatName == $categoryName) {
310311
$subcat = $category;
312+
$subcat->Description = $subcatDesc;
313+
$subcat->write();
311314
} else {
312315
$subcat = OpenStackComponentCategory::get()->filter('Name', $subcatName)->first();
313316
if (!$subcat) {
314317
$subcat = new OpenStackComponentCategory();
315318
$subcat->Name = $subcatName;
316319
}
317320
$subcat->Enabled = 1;
321+
$subcat->Description = $subcatDesc;
318322
$subcat->ParentCategoryID = $category->ID;
319323
$subcat->Order = $subCatOrder;
320324
$subcat->write();
321325

322326
$subCatOrder++;
323327
}
324328

329+
325330
$subSubCatOrder = 1;
326331
foreach($tab['categories'] as $subcategory) {
327332
// DEBUG

software/code/ui/admin/OpenStackComponentCategoryAdminUI.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ final class OpenStackComponentCategoryAdminUI extends DataExtension
1717

1818
private static $summary_fields = [
1919
'Name' => 'Name',
20+
'Label' => 'Label',
2021
'Description' => 'Description',
2122
'Enabled' => 'Enabled'
2223
];
@@ -34,6 +35,7 @@ public function updateCMSFields(FieldList $fields)
3435
$fields->push(new LiteralField("Title", "<h2>OpenStack Component Category</h2>"));
3536
$fields->push(new CheckboxField("Enabled", "Enabled"));
3637
$fields->push(new TextField("Name", "Name"));
38+
$fields->push(new TextField("Label", "Label"));
3739
$fields->push(new TextField("Slug", "Slug"));
3840
$fields->push(new TextField("Description", "Description"));
3941

software/templates/Layout/Includes/SoftwareHomePage_MainNavMenu.ss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<ul class="nav nav-tabs project-tabs">
55
<li <% if Active == 'overview' %>class="active"<% end_if %>><a href="$Top.Link"><%t Software.OVERVIEW 'Overview' %></a></li>
66
<% loop $Top.getParentComponentCategories() %>
7-
<li <% if Active == $ID %>class="active"<% end_if %>><a href="$Top.Link('project-navigator')/{$Slug}">$Name</a></li>
7+
<li <% if Active == $ID %>class="active"<% end_if %>><a href="$Top.Link('project-navigator')/{$Slug}">$Label</a></li>
88
<% end_loop %>
99
<% if $Top.HasAvailableSampleConfigTypes %>
1010
<li <% if Active == 'sample-configs' %>class="active"<% end_if %>><a href="$Top.Link(sample-configs)"><%t Software.SAMPLE_CONFIGURATIONS 'Sample Configurations' %></a></li>
@@ -24,7 +24,7 @@
2424
<ul class="dropdown-menu">
2525
<li <% if Active == 'overview' %>class="active"<% end_if %>><a href="$Top.Link"><%t Software.OVERVIEW 'Overview' %></a></li>
2626
<% loop $Top.getParentComponentCategories() %>
27-
<li <% if Active == $ID %>class="active"<% end_if %>><a href="$Top.Link('project-navigator')/{$Slug}">$Name</a></li>
27+
<li <% if Active == $ID %>class="active"<% end_if %>><a href="$Top.Link('project-navigator')/{$Slug}">$Label</a></li>
2828
<% end_loop %>
2929
<% if $Top.HasAvailableSampleConfigTypes %>
3030
<li <% if Active == 'sample-configs' %>class="active"<% end_if %>><a href="$Top.Link(sample-configs)"><%t Software.SAMPLE_CONFIGURATIONS 'Sample Configurations' %></a></li>

software/ui/source/js/openstack-category-nav.tag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</button>
1919
<ul class="dropdown-menu">
2020
<li class="category-item" each={ categories } >
21-
<a id="{ 'category_' + ID }" data-slug={ Slug } href="#" data-id="{ ID }" onclick={ selectedCategory }>{ Name }</a>
21+
<a id="{ 'category_' + ID }" data-slug={ Slug } href="#" data-id="{ ID }" onclick={ selectedCategory }>{ Label }</a>
2222
</li>
2323
</ul>
2424
</div>

software/ui/source/js/service-group.tag

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require('./t.tag');
55
<service-group>
66
<div class="row">
77
<div class="col-sm-12 all-projects-wrapper">
8-
<h3><t entity="Software.SERVICES_SECTION_TITLE" text={ category.Name } /></h3>
8+
<h3><t entity="Software.SERVICES_SECTION_TITLE" text={ category.Label } /></h3>
99
<p><t entity="Software.SERVICES_SECTION_DESCRIPTION" text={ category.Description } /></p>
1010
<p></p>
1111
</div>
@@ -16,7 +16,7 @@ require('./t.tag');
1616
<div class="col-sm-12">
1717
<p class="service-section-title">
1818
<strong>
19-
<t entity="Software.SERVICES_SECTION_TITLE" text={ subcategory.category.Name } />
19+
<t entity="Software.SERVICES_SECTION_TITLE" text={ subcategory.category.Label } />
2020
</strong>
2121
</p>
2222
</div>

0 commit comments

Comments
 (0)