Example #1
0
/* @var $repository BaseRepository */
/* @var $commit BaseCommit */
/* @var $reviewModel ContributionReview */
/* @var $contributorApi ContributorApi */
$contributorApi = Yii::$app->contributors;
echo ProjectPanel::widget(['project' => $project]);
?>

<h4><?php 
echo Html::encode($commit->message);
?>
</h4>

<div class="js-commit-panel">
    <?php 
echo CommitPanel::widget(['reviewModel' => $reviewModel, 'authUser' => Yii::$app->user, 'contributor' => $reviewModel ? $reviewModel->contributor : $contributorApi->getContributor($project->repo_type, $commit->contributorName, $commit->contributorEmail), 'project' => $project, 'commit' => $commit, 'reviewButtonClass' => 'js-review-button']);
?>
</div>

<h5><?php 
echo Yii::t('project', 'Changed files');
?>
:</h5>

<?php 
foreach ($commit->getChangedFiles() as $item) {
    print RevisionFile::widget(['repository' => $repository, 'project' => $project, 'commit' => $commit, 'file' => $item]);
}
// JavaScript page options
$jsOptions = ['fileDetailsUrl' => Url::to(['file-view', 'id' => $project->getPrimaryKey(), 'commitId' => $commit->getId()]), 'fileContentSelector' => '.js-revision-file-content', 'fileLinkSelector' => '.js-revision-file', 'fileLinkActiveClass' => 'active', 'commitPanelSelector' => '.js-commit-panel', 'reviewButtonSelector' => '.js-review-button'];
CommitSummaryAsset::register($this, $jsOptions);
Example #2
0
 /**
  * Test unknown
  */
 public function testUnknownFileStatus()
 {
     /* @var $project Project */
     /* @var $commit BaseCommit */
     /* @var $file File */
     list($project, $commit, $file) = $this->prepareFixtures(File::STATUS_UNKNOWN);
     $result = RevisionFile::widget(['project' => $project, 'repository' => $project->getRepositoryObject(), 'commit' => $commit, 'file' => $file]);
     $this->assertContains($file->getPathname(), $result);
     $this->assertContains('<span class="label label-default">X</span>', $result);
     $expectedLinks = ['raw' => $this->prepareFileMode($project->id, $commit->getId(), $file, 'raw'), 'history' => $this->prepareFileMode($project->id, $commit->getId(), $file, 'history')];
     foreach ($expectedLinks as $link) {
         $this->assertContains($link, $result);
     }
     $unexpectedLinks = ['diff' => $this->prepareFileMode($project->id, $commit->getId(), $file, 'diff'), 'compare' => $this->prepareFileMode($project->id, $commit->getId(), $file, 'compare')];
     foreach ($unexpectedLinks as $link) {
         $this->assertNotContains($link, $result);
     }
 }