Commit 7e53d6cc12296c46c589807919b7f58250e3dc78
1 parent
2f899f22
Exists in
master
and in
1 other branch
Projects#show
Showing
11 changed files
with
96 additions
and
7 deletions
Show diff stats
app/controllers/projects_controller.rb
app/models/err.rb
app/models/project.rb
... | ... | @@ -0,0 +1,23 @@ |
1 | +%table.errs | |
2 | + %thead | |
3 | + %tr | |
4 | + %th | |
5 | + - unless @project | |
6 | + %th Project | |
7 | + %th What & Where | |
8 | + %th Latest | |
9 | + %th Deploy | |
10 | + %th Count | |
11 | + %tbody | |
12 | + - errs.each do |err| | |
13 | + %tr | |
14 | + %td.environment | |
15 | + %abbr{:title => err.environment}= err.environment.chars.first.upcase | |
16 | + - unless @project | |
17 | + %td.project= err.project | |
18 | + %td.message | |
19 | + = link_to err.message, project_err_path(err.project, err) | |
20 | + %em= err.where | |
21 | + %td.latest #{time_ago_in_words(err.last_notice_at)} ago | |
22 | + %td.deploy= err.project.last_deploy_at ? err.project.last_deploy_at.to_date.to_s(:micro) : 'n/a' | |
23 | + %td.count= err.notices.count | |
0 | 24 | \ No newline at end of file | ... | ... |
app/views/layouts/application.html.haml
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | %html |
3 | 3 | %head |
4 | 4 | %title |
5 | - Cartless — | |
5 | + Hypnotoad — | |
6 | 6 | = yield(:page_title).present? ? yield(:page_title) : yield(:title) |
7 | 7 | %meta{ :content => "text/html; charset=utf-8", "http-equiv" => "content-type" }/ |
8 | 8 | = javascript_include_tag :defaults | ... | ... |
app/views/projects/index.html.haml
1 | 1 | - content_for :title, 'Projects' |
2 | 2 | |
3 | -%table | |
3 | +%table.projects | |
4 | 4 | %thead |
5 | 5 | %tr |
6 | - %th Project Name | |
6 | + %th Name | |
7 | + %th Last Deploy | |
7 | 8 | %th Errors |
8 | 9 | %tbody |
9 | 10 | - @projects.each do |project| |
10 | 11 | %tr |
11 | - %td= link_to project.name, project_path(project) | |
12 | - %td= link_to project.errs.unresolved.count, project_errs_path(project) | |
13 | 12 | \ No newline at end of file |
13 | + %td.name= link_to project.name, project_path(project) | |
14 | + %td.deploy= project.last_deploy_at ? project.last_deploy_at.to_s(:micro) : 'n/a' | |
15 | + %td.count= link_to project.errs.unresolved.count, project_errs_path(project) | |
14 | 16 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,13 @@ |
1 | +- content_for :title, @project.name | |
2 | +- content_for :meta do | |
3 | + %strong Errors Caught: | |
4 | + = @project.errs.count | |
5 | + %strong API Key: | |
6 | + = @project.api_key | |
7 | +- content_for :action_bar do | |
8 | + = link_to 'edit', edit_project_path(@project) | |
9 | + | | |
10 | + = link_to 'destroy', project_path(@project), :method => :destroy, :confirm => 'Seriously?' | |
11 | + | |
12 | +%h3 Errors | |
13 | += render 'errs/table', :errs => @errs | |
0 | 14 | \ No newline at end of file | ... | ... |
app/views/shared/_navigation.html.haml
1 | 1 | #nav-bar |
2 | 2 | %ul |
3 | 3 | //%li= link_to 'Dashboard', admin_dashboard_path, :class => active_if_here(:dashboards) |
4 | - %li= link_to 'Projects', projects_path, :class => active_if_here(:projects) | |
4 | + %li= link_to 'Projects', projects_path, :class => active_if_here(:projects) | |
5 | + %li= link_to 'Errors', errs_path, :class => active_if_here(:errs => :index) | |
5 | 6 | %div.clear |
6 | 7 | \ No newline at end of file | ... | ... |
config/routes.rb
... | ... | @@ -4,6 +4,7 @@ Hypnotoad::Application.routes.draw do |
4 | 4 | match '/notifier_api/v2/notices' => 'notices#create' |
5 | 5 | match '/deploys.txt' => 'deploys#create' |
6 | 6 | |
7 | + resources :errs, :only => [:index] | |
7 | 8 | resources :notices, :only => [:show] |
8 | 9 | resources :deploys, :only => [:show] |
9 | 10 | ... | ... |
public/stylesheets/application.css
... | ... | @@ -147,7 +147,7 @@ form > div > span { |
147 | 147 | /* Tables */ |
148 | 148 | table { width: 100%; border: 1px solid #C6C6C6; margin-bottom: 1.5em; } |
149 | 149 | table th, table td { border-bottom: 1px solid #C6C6C6; padding: 10px 8px; text-align: left; } |
150 | -table th { background-color: #E2E2E2; font-weight: bold; text-transform: uppercase; } | |
150 | +table th { background-color: #E2E2E2; font-weight: bold; text-transform: uppercase; white-space: nowrap; } | |
151 | 151 | table tbody tr:nth-child(odd) td { background-color: #F9F9F9; } |
152 | 152 | table .main { width: 100%; } |
153 | 153 | |
... | ... | @@ -159,3 +159,29 @@ table .main { width: 100%; } |
159 | 159 | .html ul, .html ol { margin-left: 2em; margin-bottom: 1em; } |
160 | 160 | .html ul li { margin-bottom: 0.5em; list-style: disc; } |
161 | 161 | .html ol li { margin-bottom: 0.5em; list-style: decimal; } |
162 | + | |
163 | +/* Projects Table */ | |
164 | +table.projects td.name { | |
165 | + width: 100%; | |
166 | +} | |
167 | +table.projects td.deploy { | |
168 | + white-space: no-wrap; | |
169 | +} | |
170 | + | |
171 | +/* Err Tables */ | |
172 | +table.errs td.message { | |
173 | + width: 100%; | |
174 | +} | |
175 | +table.errs td.message a { | |
176 | + display: block; | |
177 | +} | |
178 | +table.errs td.message em { | |
179 | + color: #727272; | |
180 | + font-size: 0.9em; | |
181 | +} | |
182 | +table.errs td.latest { | |
183 | + white-space: nowrap; | |
184 | +} | |
185 | +table.errs td.deploy { | |
186 | + white-space: nowrap; | |
187 | +} | |
162 | 188 | \ No newline at end of file | ... | ... |
spec/controllers/projects_controller_spec.rb
... | ... | @@ -11,4 +11,12 @@ describe ProjectsController do |
11 | 11 | end |
12 | 12 | end |
13 | 13 | |
14 | + describe "GET /projects/:id" do | |
15 | + it 'finds the project' do | |
16 | + project = Factory(:project) | |
17 | + get :show, :id => project.id | |
18 | + assigns(:project).should == project | |
19 | + end | |
20 | + end | |
21 | + | |
14 | 22 | end | ... | ... |