add permissions mixin to dashboard row
This commit is contained in:
parent
2220334265
commit
65cf81169b
|
@ -1,8 +1,9 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
|
import { githubCommit as githubCommitUrl } from 'travis/utils/urls';
|
||||||
import config from 'travis/config/environment';
|
import config from 'travis/config/environment';
|
||||||
|
import Permissions from 'travis/mixins/permissions';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend(Permissions, {
|
||||||
tagName: 'li',
|
tagName: 'li',
|
||||||
classNameBindings: ['repo.default_branch.last_build.state'],
|
classNameBindings: ['repo.default_branch.last_build.state'],
|
||||||
classNames: ['rows', 'rows--dashboard'],
|
classNames: ['rows', 'rows--dashboard'],
|
||||||
|
@ -15,6 +16,14 @@ export default Ember.Component.extend({
|
||||||
return githubCommitUrl(this.get('repo.slug'), this.get('repo.default_branch.last_build.commit.sha'));
|
return githubCommitUrl(this.get('repo.slug'), this.get('repo.default_branch.last_build.commit.sha'));
|
||||||
}.property('repo'),
|
}.property('repo'),
|
||||||
|
|
||||||
|
displayMenuTofu: function() {
|
||||||
|
return this.hasPushPermission(this.get('currentUser'), this.get('repo.id'));
|
||||||
|
},
|
||||||
|
|
||||||
|
displayActivateLink: function() {
|
||||||
|
return this.hasAdminPermission(this.get('currentUser'), this.get('repo.id'));
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
tiggerBuild(branch) {
|
tiggerBuild(branch) {
|
||||||
this.set('isTriggering', true);
|
this.set('isTriggering', true);
|
||||||
|
|
|
@ -60,16 +60,28 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="dash-menu">
|
{{#if displayMenuTofu}}
|
||||||
<div class="dropup {{if dropupIsOpen "is-open"}}">
|
<div class="dash-menu">
|
||||||
<button type="button" class="dropup-tofu" {{action "openDropup"}}>open action menu</button>
|
<div class="dropup {{if dropupIsOpen "is-open"}}">
|
||||||
<ul class="dropup-list">
|
<button type="button" class="dropup-tofu" {{action "openDropup"}}>open action menu</button>
|
||||||
<li><a href="#" title="Trigger a new build"><span class="icon-trigger"></span><span class="label-align">Trigger a build</span></a></li>
|
<ul class="dropup-list">
|
||||||
<li><a href="#" title="Deactivate builds for this repository"><span class="icon-deactivate"></span><span class="label-align">Deactivate repository</span></a></li>
|
<li><a href="#" title="Trigger a new build">
|
||||||
<li><a href="#" title="See the settings for this repository"><span class="icon-settings"></span><span class="label-align">Settings</span></a></li>
|
<span class="icon-trigger"></span>
|
||||||
</ul>
|
<span class="label-align">Trigger a build</span></a></li>
|
||||||
|
{{#if displayActiavteLink}}
|
||||||
|
<li><a href="#" title="Deactivate builds for this repository">
|
||||||
|
<span class="icon-deactivate"></span>
|
||||||
|
<span class="label-align">Deactivate repository</span></a></li>
|
||||||
|
{{/if}}
|
||||||
|
<li>
|
||||||
|
{{#link-to 'settings' repo title="Settings for this repository"}}
|
||||||
|
<span class="icon-settings"></span>
|
||||||
|
<span class="label-align">Settings</span>
|
||||||
|
{{/link-to}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside class="dash-aside">
|
<aside class="dash-aside">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user