travis-web/assets/scripts/app/models/commit.coffee
Mathias Meyer 35fc98edaf Only show message body when it exists.
Otherwise the script will return the message subject again rather
than show nothing at all.
2014-05-05 10:02:30 +02:00

29 lines
818 B
CoffeeScript

require 'travis/model'
@Travis.Commit = Travis.Model.extend
buildId: Ember.attr('number')
sha: Ember.attr('string')
branch: Ember.attr('string')
message: Ember.attr('string')
compareUrl: Ember.attr('string')
authorName: Ember.attr('string')
authorEmail: Ember.attr('string')
committerName: Ember.attr('string')
committerEmail: Ember.attr('string')
subject: Ember.attr('string')
body: Ember.attr('string')
build: Ember.belongsTo('Travis.Build')
subject: ( ->
@get('message').split("\n", 1)[0]
).property('message')
body: ( ->
message = @get('message')
if message.indexOf("\n") > 0
message.substr(message.indexOf("\n") + 1).trim()
else
""
).property('message')