diff --git a/assets/scripts/app/helpers.coffee b/assets/scripts/app/helpers.coffee
index bcbd98c1..98608e18 100644
--- a/assets/scripts/app/helpers.coffee
+++ b/assets/scripts/app/helpers.coffee
@@ -1,3 +1,4 @@
require 'helpers/handlebars'
require 'helpers/helpers'
require 'helpers/urls'
+require 'helpers/status_image_formatter'
diff --git a/assets/scripts/app/helpers/status_image_formatter.coffee b/assets/scripts/app/helpers/status_image_formatter.coffee
new file mode 100644
index 00000000..b346a5c3
--- /dev/null
+++ b/assets/scripts/app/helpers/status_image_formatter.coffee
@@ -0,0 +1,50 @@
+@Travis.StatusImageFormatter =
+ slug: null
+ url: null
+ branch: null
+
+ format: (version, slug, branch) ->
+ @slug = slug
+ @branch = branch
+ @url = @urlRepo()
+
+ switch version
+ when 'Image URL' then @statusImageUrl()
+ when 'Markdown' then @markdownStatusImage()
+ when 'Textile' then @textileStatusImage()
+ when 'RDOC' then @rdocStatusImage()
+ when 'AsciiDoc' then @asciidocStatusImage()
+ when 'Rst' then @rstStatusImage()
+ when 'POD' then @podStatusImage()
+
+ urlRepo: (->
+ "https://#{location.host}/#{@slug}"
+ )
+
+ statusImageUrl: (->
+ Travis.Urls.statusImage(@slug, @branch)
+ )
+
+ markdownStatusImage: (->
+ "[})](#{@url})"
+ )
+
+ textileStatusImage: (->
+ "!#{@statusImageUrl()}!:#{@url}"
+ )
+
+ rdocStatusImage: (->
+ "{}[#{@url}]"
+ )
+
+ asciidocStatusImage: (->
+ "image:#{@statusImageUrl()}[\"Build Status\", link=\"#{@url}\"]"
+ )
+
+ rstStatusImage: (->
+ ".. image:: #{@statusImageUrl()}\n :target: #{@url}"
+ )
+
+ podStatusImage: (->
+ "=for HTML
"
+ )
diff --git a/assets/scripts/app/templates/status_images.hbs b/assets/scripts/app/templates/status_images.hbs
index 1b314730..4cff16a6 100644
--- a/assets/scripts/app/templates/status_images.hbs
+++ b/assets/scripts/app/templates/status_images.hbs
@@ -7,31 +7,8 @@
{{/if}}
- - -
-- - -
-- - -
-- - -
-- - -
-- - -
-- - + +
diff --git a/assets/scripts/app/views/status_images.coffee b/assets/scripts/app/views/status_images.coffee index a9a9ea88..2b3b75a6 100644 --- a/assets/scripts/app/views/status_images.coffee +++ b/assets/scripts/app/views/status_images.coffee @@ -9,10 +9,21 @@ Travis.StatusImagesView = Em.View.extend jobBinding: 'toolsView.job' branchesBinding: 'repo.branches' + formats: [ + 'Image URL', + 'Markdown', + 'Textile', + 'RDOC', + 'AsciiDoc', + 'Rst', + 'POD' + ] + didInsertElement: -> @_super.apply(this, arguments) @setStatusImageBranch() + @setStatusImageFormat() @show() show: -> @@ -21,9 +32,9 @@ Travis.StatusImagesView = Em.View.extend close: -> @destroy() - urlRepo: (-> - "https://#{location.host}/#{@get('repo.slug')}" - ).property('repo.slug') + setStatusImageFormat: (-> + @set('statusImageFormat', @formats[0]) + ) setStatusImageBranch: (-> if @get('repo.branches.isLoaded') @@ -32,30 +43,7 @@ Travis.StatusImagesView = Em.View.extend @set('statusImageBranch', null) ).observes('repo.branches', 'repo.branches.isLoaded', 'build.commit.branch') - statusImageUrl: (-> - Travis.Urls.statusImage(@get('repo.slug'), @get('statusImageBranch.commit.branch')) - ).property('repo.slug', 'statusImageBranch') + statusString: (-> + Travis.StatusImageFormatter.format(@get('statusImageFormat'), @get('repo.slug'), @get('statusImageBranch.commit.branch')) + ).property('statusImageFormat', 'repo.slug', 'statusImageBranch.commit.branch') - markdownStatusImage: (-> - "[})](#{@get('urlRepo')})" - ).property('statusImageUrl') - - textileStatusImage: (-> - "!#{@get('statusImageUrl')}!:#{@get('urlRepo')}" - ).property('statusImageUrl') - - rdocStatusImage: (-> - "{