diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index 6e57753..84533de 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -8,7 +8,8 @@ class AppsController < ApplicationController end def show - @errs = @app.errs.ordered.paginate(:page => params[:page], :per_page => Err.per_page) + @errs = @app.errs.ordered.paginate(:page => params[:page], :per_page => Err.per_page) + @deploys = @app.deploys.order_by(:created_at.desc).limit(5) end def new diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 9158db5..c8b4fac 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -6,6 +6,8 @@ class Deploy field :repository field :environment field :revision + + index :created_at, Mongo::DESCENDING embedded_in :app, :inverse_of => :deploys diff --git a/app/views/apps/show.html.haml b/app/views/apps/show.html.haml index 57c6a81..8ef8b0a 100644 --- a/app/views/apps/show.html.haml +++ b/app/views/apps/show.html.haml @@ -23,9 +23,29 @@ %td %em Sadly, no one is watching this app +%h3 Latest Deploys +- if @deploys.any? + %table.deploys + %thead + %tr + %th When + %th Who + %th Repository + %th Revision + + %tbody + - @deploys.each do |deploy| + %tr + %td.when #{deploy.created_at.to_s(:micro)} + %td.who #{deploy.username} + %td.repository #{deploy.repository} + %td.revision #{deploy.revision} +- else + %h3 No deploys + - if @app.errs.any? %h3 Errs = render 'errs/table', :errs => @errs - else %h3 No errs have been caught yet, make sure you setup your app - = render 'configuration_instructions', :app => @app \ No newline at end of file + = render 'configuration_instructions', :app => @app -- libgit2 0.21.2