diff --git a/src/IDF/Views/Download.php b/src/IDF/Views/Download.php index 683afb2..efdfab7 100644 --- a/src/IDF/Views/Download.php +++ b/src/IDF/Views/Download.php @@ -185,6 +185,19 @@ class IDF_Views_Download } return substr($auto, 0, -1); } + + /** + * Get the download tags. + * + * @param IDF_Project + * @return ArrayObject The tags + */ + public static function getDownloadTags($project) + { + return $project->getTagsFromConfig('labels_downloads_predefined', + IDF_Form_UploadConf::init_predefined); + + } } /** diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php index ef6ac62..3b0edf3 100644 --- a/src/IDF/Views/Project.php +++ b/src/IDF/Views/Project.php @@ -39,10 +39,14 @@ class IDF_Views_Project $prj = $request->project; $team = $prj->getMembershipData(); $title = (string) $prj; + $tags = IDF_Views_Download::getDownloadTags($prj); + // the first tag is the featured, the last is the deprecated. + $downloads = $tags[0]->get_idf_upload_list(); return Pluf_Shortcuts_RenderToResponse('project-home.html', array( 'page_title' => $title, 'team' => $team, + 'downloads' => $downloads, ), $request); } diff --git a/src/IDF/relations.php b/src/IDF/relations.php index ad61a95..4f8e2aa 100644 --- a/src/IDF/relations.php +++ b/src/IDF/relations.php @@ -26,5 +26,7 @@ $m['IDF_Tag'] = array('relate_to' => array('IDF_Project')); $m['IDF_Issue'] = array('relate_to' => array('IDF_Project', 'Pluf_User', 'IDF_Tag'), 'relate_to_many' => array('IDF_Tag', 'Pluf_User')); $m['IDF_IssueComment'] = array('relate_to' => array('IDF_Issue', 'Pluf_User')); +$m['IDF_Upload'] = array('relate_to' => array('IDF_Project', 'Pluf_User'), + 'relate_to_many' => array('IDF_Tag')); return $m; diff --git a/src/IDF/templates/project-home.html b/src/IDF/templates/project-home.html index 6ceccb5..32ad8a2 100644 --- a/src/IDF/templates/project-home.html +++ b/src/IDF/templates/project-home.html @@ -10,6 +10,13 @@ {$project.description|markdown} {/block} {block context} +{if $downloads.count() > 0} +

{trans 'Featured Downloads'}
+{foreach $downloads as $download} +{$download}
+{/foreach} + {trans 'show more...'} +{/if} {assign $ko = 'owners'} {assign $km = 'members'}

{trans 'Development Team'}
@@ -17,7 +24,6 @@ {foreach $team[$ko] as $owner} {$owner}
{/foreach} - {if count($team[$km]) > 0} {trans 'Happy Crew'}
{foreach $team[$km] as $member}