Merge pull request #268 from simi/show-committer-only-when-needed

Show committer only when needed.
This commit is contained in:
Josh Kalderimis 2014-05-09 14:38:48 +12:00
commit ce6f609577
4 changed files with 54 additions and 8 deletions

View File

@ -26,3 +26,8 @@ require 'travis/model'
else
""
).property('message')
authorIsCommitter: ( ->
@get('authorName') == @get('committerName') and
@get('authorEmail') == @get('committerEmail')
).property('authorName', 'authorEmail', 'committerName', 'committerEmail')

View File

@ -31,11 +31,13 @@
<div class="footer">
<div class="author">
{{#if commit.authorName}}
<div class="authored"><img {{bind-attr src="view.urlAuthorGravatarImage"}}/>{{commit.authorName}} authored</div>
{{/if}}
{{#if commit.committerName}}
<div class="committed"><img {{bind-attr src="view.urlCommitterGravatarImage"}}/>{{commit.committerName}} committed</div>
<div class="authored"><img {{bind-attr src="view.urlAuthorGravatarImage"}}/>{{commit.authorName}} authored{{#if commit.authorIsCommitter}} and committed{{/if}}</div>
{{/if}}
{{#unless commit.authorIsCommitter}}
{{#if commit.committerName}}
<div class="committed"><img {{bind-attr src="view.urlCommitterGravatarImage"}}/>{{commit.committerName}} committed</div>
{{/if}}
{{/unless}}
</div>
<div class="commit-changes">

View File

@ -1,8 +1,8 @@
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>')
Travis.rootElement = '#ember-testing';
Travis.setupForTesting();
Travis.injectTestHelpers();
Travis.rootElement = '#ember-testing'
Travis.setupForTesting()
Travis.injectTestHelpers()
oldSetup = Travis.setup
Travis.ready = ->

View File

@ -0,0 +1,39 @@
record = null
module "Travis.Commit",
setup: ->
teardown: ->
Travis.Commit.resetData()
test 'it recognizes when author is committer', ->
Travis.Commit.load [
{
id: 1,
committer_name: 'Jimmy',
committer_email: 'jimmy@example.com',
author_name: 'Jimmy',
author_email: 'jimmy@example.com'
}
]
Ember.run ->
record = Travis.Commit.find 1
console.log(record.get('authorName'))
equal(true, record.get('authorIsCommitter'))
test 'it recognizes when author is not committer', ->
Travis.Commit.load [
{
id: 1,
committer_name: 'Jimmy',
committer_email: 'jimmy@example.com',
author_name: 'John',
author_email: 'john@example.com'
}
]
Ember.run ->
record = Travis.Commit.find 1
console.log(record.get('authorName'))
equal(false, record.get('authorIsCommitter'))