Skip to content

Commit bd6f03b

Browse files
committed
[spalenque] - #14274 * changes in component page
1 parent 1236d99 commit bd6f03b

File tree

5 files changed

+46
-23
lines changed

5 files changed

+46
-23
lines changed

openstack/code/infrastructure/active_records/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Link extends DataObject {
2222
);
2323

2424
static $has_one = array(
25-
'Page' => 'Page'
25+
'Page' => 'DataObject'
2626
);
2727

2828
static $singular_name = 'Link';

software/code/infrastructure/active_records/OpenStackComponent.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class OpenStackComponent extends DataObject implements IOpenStackComponent
4949
(
5050
'Versions' => 'OpenStackApiVersion',
5151
'RelatedContent' => 'OpenStackComponentRelatedContent',
52-
'Caveats' => 'OpenStackComponentReleaseCaveat'
52+
'Caveats' => 'OpenStackComponentReleaseCaveat',
53+
'Links' => 'Link'
5354
);
5455

5556
static $many_many = array

software/code/tasks/IngestOpenStackComponentsDataCronTask.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,26 @@ private function processComponentsAndCategories()
361361
$comp->Since = (isset($component['since'])) ? $component['since'] : '';
362362
$comp->CategoryID = $subcat2->ID;
363363
$comp->Order = $compOrder;
364+
365+
$comp->Links()->removeAll();
366+
367+
if (isset($component['links'])) {
368+
foreach ($component['links'] as $linkArray) {
369+
foreach ($linkArray as $label => $link) {
370+
$linkObj = Link::get()->filter(['Label' => $label, 'URL' => $link])->First();
371+
372+
if (!$linkObj) {
373+
$linkObj = new Link();
374+
$linkObj->Label = $label;
375+
$linkObj->URL = $link;
376+
$linkObj->write();
377+
}
378+
379+
$comp->Links()->add($linkObj);
380+
}
381+
}
382+
}
383+
364384
$comp->write();
365385

366386
$compOrder++;

software/css/software.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,3 +1593,7 @@ th.maturity, td.maturity {
15931593
color: #1F78BC!important;
15941594
width: 45px;
15951595
}
1596+
1597+
.component-link {
1598+
margin-right: 10px;
1599+
}

software/templates/Layout/SoftwareHomePage_getComponent.ss

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</p>
2929
<% end_if %>
3030
<p>
31-
<a href="/marketplace" target="_blank"><%t Software.FIND_SERVICE_MARKETPLACE 'Find this service in the Marketplace' %></a>
31+
<%t Software.FIRST_APPEARANCE 'First appear in ' %> $Component.Since
3232
</p>
3333
</div>
3434
</div>
@@ -37,6 +37,19 @@
3737
<div class="col-sm-12 about-project-details">
3838
<h4><%t Software.ABOUT_PROJECT 'About this project' %></h4>
3939
$Component.Description
40+
41+
<% if $Component.Links().Count %>
42+
<hr style="margin: 40px 0;">
43+
<h4><%t Software.RELATED_LINKS 'Related Links' %></h4>
44+
<div class="row">
45+
<div class="col-sm-12">
46+
<% loop $Component.Links() %>
47+
<a class="component-link" href="{$URL}">{$Label}</a>
48+
<% end_loop %>
49+
</div>
50+
</div>
51+
<% end_if %>
52+
4053
<% if $HasAdditionalInfo || $HasMaturityIndicators %>
4154
<hr style="margin: 40px 0;">
4255
<h4><%t Software.PROJECT_DETAILS 'Project details' %></h4>
@@ -240,14 +253,6 @@
240253
<% end_loop %>
241254
</ul>
242255
<% end_if %>
243-
<% if $MostActiveIndividualContributors %>
244-
<h4>Most Active Individual Contributors</h4>
245-
<ul>
246-
<% loop $MostActiveIndividualContributors %>
247-
<li>$Name</li>
248-
<% end_loop %>
249-
</ul>
250-
<% end_if %>
251256
<% if $Component.RelatedContent %>
252257
<h4><%t Software.RELATED_CONTENT 'Related Content' %></h4>
253258
<ul>
@@ -258,21 +263,14 @@
258263
<% end_if %>
259264
</div>
260265
<div class="col-sm-6 right">
261-
<h4><%t Software.API_HISTORY 'API Version History' %></h4>
262-
<div class="project-timeline">
266+
<% if $MostActiveIndividualContributors %>
267+
<h4>Most Active Individual Contributors</h4>
263268
<ul>
264-
<% loop Releases %>
265-
<li <% if $Status == Current %>class="timeline-current"<% end_if %><% if $Status == Future %>class="timeline-future"<% end_if %>>
266-
<a href="https://releases.openstack.org/{$Slug}/index.html#{$Slug}-{$Top.Component.Slug}" target="_blank">
267-
<%t Software.VERSION 'Version' %> {$getCurrentSupportedApiVersionLabel($Top.Component.ID)} ({$Name}) <% if $Status == Current %>- LATEST RELEASE<% end_if %>
268-
</a>
269-
</li>
269+
<% loop $MostActiveIndividualContributors %>
270+
<li>$Name</li>
270271
<% end_loop %>
271-
<li class="timeline-past">
272-
<%t Software.PREVIOUS_DEPRECATED 'Previous Versions Deprecated' %>
273-
</li>
274272
</ul>
275-
</div>
273+
<% end_if %>
276274
</div>
277275
</div>
278276
<div class="row">

0 commit comments

Comments
 (0)