diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index dbeabe95..db21efda 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -260,6 +260,36 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes) { ]); } +/** + * Renders the about info for an angeltype. + */ +function AngelTypes_about_view_angeltype($angeltype) { + $html = '

' . $angeltype['name'] . '

'; + + if (isset($angeltype['user_angeltype_id'])) { + $buttons = []; + if ($angeltype['user_angeltype_id'] != null) { + $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel'); + } else { + $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add'); + } + $html .= buttons($buttons); + } + + if ($angeltype['restricted']) { + $html .= info(_("This angeltype is restricted by double-opt-in by a team coordinator. Please show up at the according introduction meetings."), true); + } + if ($angeltype['description'] != "") { + $html .= '
' . $parsedown->parse($angeltype['description']) . '
'; + } + $html .= '
'; + + return $html; +} + +/** + * Renders a site that contains every angeltype and its description, basically as an overview of the needed help types. + */ function AngelTypes_about_view($angeltypes, $user_logged_in) { global $faq_url; @@ -275,25 +305,7 @@ function AngelTypes_about_view($angeltypes, $user_logged_in) { ]; $parsedown = new Parsedown(); foreach ($angeltypes as $angeltype) { - $content[] = '

' . $angeltype['name'] . '

'; - - if (isset($angeltype['user_angeltype_id'])) { - $buttons = []; - if ($angeltype['user_angeltype_id'] != null) { - $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel'); - } else { - $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add'); - } - $content[] = buttons($buttons); - } - - if ($angeltype['restricted']) { - $content[] = info(_("This angeltype is restricted by double-opt-in by a team coordinator. Please show up at the according introduction meetings."), true); - } - if ($angeltype['description'] != "") { - $content[] = '
' . $parsedown->parse($angeltype['description']) . '
'; - } - $content[] = '
'; + $content[] = AngelTypes_about_view_angeltype($angeltype); } return page_with_title(_("Teams/Job description"), $content);