Merge pull request #635 from Bugagazavr/commit_info

Show pull request link, when commit related with pull request
This commit is contained in:
Brad Rydzewski 2014-10-27 18:47:50 -07:00
commit aa1ce3c9ac
4 changed files with 61 additions and 23 deletions

View file

@ -75,6 +75,7 @@ func (r *Gitlab) GetRepos(user *model.User) ([]*model.Repo, error) {
CloneURL: item.HttpRepoUrl,
GitURL: item.HttpRepoUrl,
SSHURL: item.SshRepoUrl,
URL: item.Url,
Role: &model.Perm{},
}

View file

@ -11,29 +11,12 @@
<dd><h1>{{ commit.duration | toDuration}}</h1></dd>
</dl>
<dl>
<dd class="large" ng-if="repo.remote == 'gitlab.com' || repo.remote == 'github.com' || repo.remote == 'enterprise.github.com' ">
<strong>
commit
<a href="http://{{ repo.host }}/{{ repo.owner }}/{{ repo.name }}/commit/{{ commit.sha }}" >{{ commit.sha | shortHash}}</a>
to <a href="http://{{ repo.host }}/{{ repo.owner }}/{{ repo.name }}/tree/{{ commit.branch }}">{{ commit.branch }}</a> branch
</strong>
</dd>
<dd class="large" ng-if="repo.remote == 'bitbucket.org' ">
<strong>
commit
<a href="http://{{ repo.host }}/{{ repo.owner }}/{{ repo.name }}/commits/{{ commit.sha }}" >{{ commit.sha | shortHash}}</a>
to <a href="http://{{ repo.host }}/{{ repo.owner }}/{{ repo.name }}/src/?at={{ commit.branch }}">{{ commit.branch }}</a> branch
</strong>
</dd>
<dd class="large" ng-if="repo.remote != 'gitlab.com' && repo.remote != 'github.com' && repo.remote != 'enterprise.github.com' && repo.remote != 'bitbucket.org' ">
<strong>commit <u>{{ commit.sha | shortHash}}</u> to <u>{{ commit.branch }}</u> branch</strong>
</dd>
<dd ng-if="commit.finished_at != 0">{{ commit.finished_at | fromNow }}</dd>
<dd ng-if="commit.finished_at == 0 && commit.started_at != 0">Started {{ commit.started_at | fromNow }}</dd>
<dd ng-if="commit.finished_at == 0 && commit.started_at == 0">Created {{ commit.created_at}}</dd>
</dl>
</div>
<dl ng-include src="'/static/views/commit_detail.html'" ng-if="commit.pull_request.length == 0"></dl>
<dl ng-include src="'/static/views/commit_detail_pr.html'" ng-if="commit.pull_request.length != 0"></dl>
<dd ng-if="commit.finished_at != 0">{{ commit.finished_at | fromNow }}</dd>
<dd ng-if="commit.finished_at == 0 && commit.started_at != 0">Started {{ commit.started_at | fromNow }}</dd>
<dd ng-if="commit.finished_at == 0 && commit.started_at == 0">Created {{ commit.created_at}}</dd>
</div>
</aside>
<div id="main" class="output">

View file

@ -0,0 +1,23 @@
<!-- GITHUB && GITLAB -->
<dd class="large" ng-if="repo.remote == 'gitlab.com' || repo.remote == 'github.com' || repo.remote == 'enterprise.github.com' ">
<strong>
commit
<a href="{{ repo.url }}/commit/{{ commit.sha }}" >{{ commit.sha | shortHash}}</a>
to <a href="{{ repo.url }}/tree/{{ commit.branch }}">{{ commit.branch }}</a> branch
</strong>
</dd>
<!-- /GITHUB && GITLAB -->
<!-- BITBUCKET -->
<dd class="large" ng-if="repo.remote == 'bitbucket.org' ">
<strong>
commit
<a href="{{ repo.url }}/commits/{{ commit.sha }}" >{{ commit.sha | shortHash}}</a>
to <a href="{{ repo.url }}/src/?at={{ commit.branch }}">{{ commit.branch }}</a> branch
</strong>
</dd>
<!-- /BITBUCKET -->
<!-- STASH -->
<dd class="large" ng-if="repo.remote != 'gitlab.com' && repo.remote != 'github.com' && repo.remote != 'enterprise.github.com' && repo.remote != 'bitbucket.org' ">
<strong>commit <u>{{ commit.sha | shortHash}}</u> to <u>{{ commit.branch }}</u> branch</strong>
</dd>
<!-- /STASH -->

View file

@ -0,0 +1,31 @@
<!-- GITHUB -->
<dd class="large" ng-if="repo.remote == 'github.com' || repo.remote == 'enterprise.github.com' ">
<strong>
Pull Request
<a href="{{ repo.url }}/pull/{{ commit.pull_request }}" >#{{ commit.pull_request }}</a>
</strong>
</dd>
<!-- /GITHUB -->
<!-- GITLAB -->
<dd class="large" ng-if="repo.remote == 'gitlab.com'">
<strong>
Pull Request
<a href="{{ repo.url }}/merge_requests/{{ commit.pull_request }}" >#{{ commit.pull_request }}</a>
</strong>
</dd>
<!-- /GITLAB -->
<!-- BITBUCKET -->
<dd class="large" ng-if="repo.remote == 'bitbucket.org' ">
<strong>
Pull Request
<a href="{{ repo.url }}/pull-requests/{{ commit.pull_request }}" >#{{ commit.pull_request }}</a>
</strong>
</dd>
<!-- /BITBUCKET -->
<!-- STASH -->
<dd class="large" ng-if="repo.remote != 'gitlab.com' && repo.remote != 'github.com' && repo.remote != 'enterprise.github.com' && repo.remote != 'bitbucket.org' ">
<strong>
Pull Request #{{ commit.pull_request }}
</strong>
</dd>
<!-- /STASH -->