Commit 717eec1a27540a51127a9b9c3921222e199f6f7e

Authored by Barry Hess
Committed by Nick Recobra
1 parent 0651a96c
Exists in master and in 1 other branch production

Added a view of the last five deploys to the

application view
Conflicts:

	app/controllers/apps_controller.rb
	app/models/deploy.rb
app/controllers/apps_controller.rb
... ... @@ -8,7 +8,8 @@ class AppsController < ApplicationController
8 8 end
9 9  
10 10 def show
11   - @errs = @app.errs.ordered.paginate(:page => params[:page], :per_page => Err.per_page)
  11 + @errs = @app.errs.ordered.paginate(:page => params[:page], :per_page => Err.per_page)
  12 + @deploys = @app.deploys.order_by(:created_at.desc).limit(5)
12 13 end
13 14  
14 15 def new
... ...
app/models/deploy.rb
... ... @@ -6,6 +6,8 @@ class Deploy
6 6 field :repository
7 7 field :environment
8 8 field :revision
  9 +
  10 + index :created_at, Mongo::DESCENDING
9 11  
10 12 embedded_in :app, :inverse_of => :deploys
11 13  
... ...
app/views/apps/show.html.haml
... ... @@ -23,9 +23,29 @@
23 23 %td
24 24 %em Sadly, no one is watching this app
25 25  
  26 +%h3 Latest Deploys
  27 +- if @deploys.any?
  28 + %table.deploys
  29 + %thead
  30 + %tr
  31 + %th When
  32 + %th Who
  33 + %th Repository
  34 + %th Revision
  35 +
  36 + %tbody
  37 + - @deploys.each do |deploy|
  38 + %tr
  39 + %td.when #{deploy.created_at.to_s(:micro)}
  40 + %td.who #{deploy.username}
  41 + %td.repository #{deploy.repository}
  42 + %td.revision #{deploy.revision}
  43 +- else
  44 + %h3 No deploys
  45 +
26 46 - if @app.errs.any?
27 47 %h3 Errs
28 48 = render 'errs/table', :errs => @errs
29 49 - else
30 50 %h3 No errs have been caught yet, make sure you setup your app
31   - = render 'configuration_instructions', :app => @app
32 51 \ No newline at end of file
  52 + = render 'configuration_instructions', :app => @app
... ...