Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 49
0.00% covered (danger)
0.00%
0 / 7
CRAP
0.00% covered (danger)
0.00%
0 / 1
MenteeOverview
0.00% covered (danger)
0.00%
0 / 49
0.00% covered (danger)
0.00%
0 / 7
56
0.00% covered (danger)
0.00%
0 / 1
 getHeaderText
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSubheaderText
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSubheaderTag
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getBody
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
 getClientSideBody
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 getRecentEditsByMenteesBody
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
0.00%
0 / 1
2
 getMobileSummaryBody
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace GrowthExperiments\MentorDashboard\Modules;
4
5use MediaWiki\Html\Html;
6use MediaWiki\SpecialPage\SpecialPage;
7
8class MenteeOverview extends BaseModule {
9
10    /** @var string Option name to store user presets. This is client-side hardcoded. */
11    public const PRESETS_PREF = 'growthexperiments-mentee-overview-presets';
12
13    /**
14     * @inheritDoc
15     */
16    protected function getHeaderText() {
17        return $this->msg( 'growthexperiments-mentor-dashboard-mentee-overview-headline' )->text();
18    }
19
20    /**
21     * @inheritDoc
22     */
23    protected function getSubheaderText() {
24        return $this->msg( 'growthexperiments-mentor-dashboard-mentee-overview-intro' )->text();
25    }
26
27    /**
28     * @inheritDoc
29     */
30    protected function getSubheaderTag() {
31        return 'p';
32    }
33
34    /**
35     * @inheritDoc
36     */
37    protected function getBody() {
38        return Html::rawElement(
39            'div',
40            [
41                'class' => 'growthexperiments-mentor-dashboard-module-mentee-overview-container'
42            ],
43            implode( "\n", [
44                $this->getClientSideBody(),
45                $this->getRecentEditsByMenteesBody()
46            ] )
47        );
48    }
49
50    /**
51     * Get skeleton body to be replaced on the client side
52     *
53     * Should only have a no-js-fallback in it, to display meaningful
54     * information for no-JS clients.
55     *
56     *
57     * @return string
58     */
59    protected function getClientSideBody(): string {
60        return Html::rawElement(
61            'div',
62            [
63                'id' => 'vue-root',
64                'class' => 'growthexperiments-mentor-dashboard-module-mentee-overview-content'
65            ],
66            Html::element(
67                'p',
68                [ 'class' => 'growthexperiments-mentor-dashboard-no-js-fallback' ],
69                $this->msg( 'growthexperiments-mentor-dashboard-mentee-overview-no-js-fallback' )->text()
70            )
71        );
72    }
73
74    /**
75     * @return string
76     */
77    private function getRecentEditsByMenteesBody(): string {
78        return Html::rawElement(
79            'div',
80            [
81                'class' => 'growthexperiments-mentor-dashboard-module-mentee-overview-recent-by-mentees'
82            ],
83            implode( "\n", [
84                Html::element(
85                    'h4',
86                    [],
87                    $this->msg( 'growthexperiments-mentor-dashboard-mentee-overview-recent-edits-headline' )
88                        ->text()
89                ),
90                Html::rawElement(
91                    'p',
92                    [],
93                    $this->msg( 'growthexperiments-mentor-dashboard-mentee-overview-recent-edits-text' )
94                        ->params( SpecialPage::getTitleFor( 'Recentchanges' )->getFullURL( [
95                            'mentorship' => 'all',
96                        ] ) )
97                        ->parse()
98                )
99            ] )
100        );
101    }
102
103    /**
104     * @inheritDoc
105     */
106    protected function getMobileSummaryBody() {
107        return $this->getBody();
108    }
109}