Commit 717eec1a27540a51127a9b9c3921222e199f6f7e
Committed by
Nick Recobra
1 parent
0651a96c
Exists in
master
and in
1 other branch
Added a view of the last five deploys to the
application view Conflicts: app/controllers/apps_controller.rb app/models/deploy.rb
Showing
3 changed files
with
25 additions
and
2 deletions
Show diff stats
app/controllers/apps_controller.rb
| @@ -8,7 +8,8 @@ class AppsController < ApplicationController | @@ -8,7 +8,8 @@ class AppsController < ApplicationController | ||
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | def show | 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 | end | 13 | end |
| 13 | 14 | ||
| 14 | def new | 15 | def new |
app/models/deploy.rb
| @@ -6,6 +6,8 @@ class Deploy | @@ -6,6 +6,8 @@ class Deploy | ||
| 6 | field :repository | 6 | field :repository |
| 7 | field :environment | 7 | field :environment |
| 8 | field :revision | 8 | field :revision |
| 9 | + | ||
| 10 | + index :created_at, Mongo::DESCENDING | ||
| 9 | 11 | ||
| 10 | embedded_in :app, :inverse_of => :deploys | 12 | embedded_in :app, :inverse_of => :deploys |
| 11 | 13 |
app/views/apps/show.html.haml
| @@ -23,9 +23,29 @@ | @@ -23,9 +23,29 @@ | ||
| 23 | %td | 23 | %td |
| 24 | %em Sadly, no one is watching this app | 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 | - if @app.errs.any? | 46 | - if @app.errs.any? |
| 27 | %h3 Errs | 47 | %h3 Errs |
| 28 | = render 'errs/table', :errs => @errs | 48 | = render 'errs/table', :errs => @errs |
| 29 | - else | 49 | - else |
| 30 | %h3 No errs have been caught yet, make sure you setup your app | 50 | %h3 No errs have been caught yet, make sure you setup your app |
| 31 | - = render 'configuration_instructions', :app => @app | ||
| 32 | \ No newline at end of file | 51 | \ No newline at end of file |
| 52 | + = render 'configuration_instructions', :app => @app |