/** * Test widget with known contributor */ public function testWithKnownContributor() { /* @var $contributor User */ $contributor = $this->getModule('Yii2')->grabFixture('users', 'activeUser1'); $result = ContributorLine::widget(['contributor' => $contributor, 'avatarSize' => 'test-avatar-size', 'showEmail' => false, 'useLink' => false]); $this->assertContains('<span class="avatar avatar-test-avatar-size"></span>', $result); $this->assertContains($contributor->name, $result); $this->assertNotContains('Not registered', $result); $result = ContributorLine::widget(['contributor' => $contributor, 'avatarSize' => 'test-avatar-size', 'showEmail' => false, 'useLink' => true]); $this->assertContains('<span class="avatar avatar-test-avatar-size"></span>', $result); $this->assertContains($contributor->name, $result); $this->assertNotContains('Not registered', $result); $this->assertContains('<a href="#" data-user-id="' . $contributor->id . '" role="user-popup-button">', $result); }
<h4><?php echo Yii::t('project', 'Change log'); ?> </h4> <div id="historyGraph"></div> <div class="list-group" id="historySimple"> <?php foreach ($history as $commit) { ?> <a class="list-group-item col-md-12 history-simple-item js-history-simple-item" href="<?php echo Url::to(['commit-summary', 'id' => $project->id, 'commitId' => $commit->getId()]); ?> "> <div class="col-md-4"> <?php echo ContributorLine::widget(['contributor' => $contributorApi->getContributor($project->repo_type, $commit->contributorName, $commit->contributorEmail), 'avatarSize' => 'small', 'useLink' => false]); ?> <br /> <span class="label label-info"><?php echo Html::encode($project->title); ?> </span> <span class="commit-date"><?php echo $commit->getDate()->format('d\'M y H:i:s'); ?> </span> </div> <div class="col-md-8 commit-message"> <strong class="list-group-item-heading"><?php echo Html::encode($commit->message); ?>
} else { ?> <div class="list-group"> <?php foreach ($dataProvider->getModels() as $model) { ?> <?php /* @var $model ContributionReview */ ?> <a class="list-group-item col-md-12 history-simple-item" href="<?php echo Url::to(['/project/history/commit-summary', 'id' => $model->project_id, 'commitId' => $model->commit_id]); ?> "> <div class="col-md-4"> <?php echo ContributorLine::widget(['contributor' => $model->contributor, 'avatarSize' => 'small', 'useLink' => false]); ?> <br /> <span class="label label-info"><?php echo Html::encode($model->project->title); ?> </span> <span class="commit-date"><?php echo $model->getDateTime()->format('d\'M y H:i:s'); ?> </span> </div> <div class="col-md-8 commit-message"> <strong class="list-group-item-heading"><?php echo Html::encode($model->message); ?>
/** * Render review panel * * @return string */ protected function renderReviewPanel() { $ret = Html::tag('strong', 'Reviewed by') . '<br />'; if (is_null($this->reviewModel)) { $ret .= Yii::t('project', '(has no review)'); $ret .= ' ' . $this->renderBeReviewerButton(); } else { $reviewer = $this->reviewModel->reviewer; if ($reviewer) { $ret .= ContributorLine::widget(['contributor' => $reviewer]); } else { $ret .= Yii::t('project', '(reviewer is not set)'); $ret .= ' ' . $this->renderBeReviewerButton(); } if ($this->reviewModel->reviewIsFinished()) { $ret .= ' '; $ret .= Yii::t('project', 'at') . ' ' . $this->reviewModel->getReviewedDateTime()->format("d\\'M y H:i:s"); } elseif ($reviewer) { $ret .= ' ' . Yii::t('project', 'did not complete a review'); } // current user is current reviewer if ($this->reviewModel->canFinishReview($this->authUser->getId())) { // show finish review button $ret .= ' ' . $this->renderFinishButton(); } } return $ret; }