Commit 9f8770d1e50f7fd327416b01ae22425787982c21
Exists in
master
and in
1 other branch
Merge pull request #309 from lest/patch-1
Cleanup problems/show view
Showing
3 changed files
with
18 additions
and
10 deletions
Show diff stats
app/assets/stylesheets/errbit.css
... | ... | @@ -894,6 +894,11 @@ table.errs tr td.message .inline_comment em.commenter { |
894 | 894 | color: #777; |
895 | 895 | } |
896 | 896 | |
897 | +textarea#comment_body { | |
898 | + width: 420px; | |
899 | + height: 80px; | |
900 | +} | |
901 | + | |
897 | 902 | .current.asc:after { content: ' ↑'; } |
898 | 903 | .current.desc:after { content: ' ↓'; } |
899 | 904 | ... | ... |
app/models/problem.rb
... | ... | @@ -57,6 +57,10 @@ class Problem |
57 | 57 | Notice.for_errs(errs).ordered |
58 | 58 | end |
59 | 59 | |
60 | + def comments_allowed? | |
61 | + Errbit::Config.allow_comments_with_issue_tracker || !app.issue_tracker_configured? | |
62 | + end | |
63 | + | |
60 | 64 | def resolve! |
61 | 65 | self.update_attributes!(:resolved => true, :resolved_at => Time.now) |
62 | 66 | end | ... | ... |
app/views/problems/show.html.haml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | - content_for :title, @problem.error_class || truncate(@problem.message, :length => 32) |
4 | 4 | - content_for :meta do |
5 | 5 | %strong App: |
6 | - = link_to @app.name, app_path(@app) | |
6 | + = link_to @app.name, @app | |
7 | 7 | %strong Where: |
8 | 8 | = @problem.where |
9 | 9 | %br |
... | ... | @@ -13,14 +13,14 @@ |
13 | 13 | = @problem.last_notice_at.to_s(:precise) |
14 | 14 | - content_for :action_bar do |
15 | 15 | - if @problem.unresolved? |
16 | - %span= link_to 'resolve', resolve_app_problem_path(@app, @problem), :method => :put, :data => { :confirm => problem_confirm }, :class => 'resolve' | |
16 | + %span= link_to 'resolve', [:resolve, @app, @problem], :method => :put, :data => { :confirm => problem_confirm }, :class => 'resolve' | |
17 | 17 | - if current_user.authentication_token |
18 | - %span= link_to 'iCal', app_problem_path(:app_id => @app.id, :id => @problem.id, :format => "ics", :auth_token => current_user.authentication_token), :class => "calendar_link" | |
18 | + %span= link_to 'iCal', polymorphic_path([@app, @problem], :format => "ics", :auth_token => current_user.authentication_token), :class => "calendar_link" | |
19 | 19 | %span>= link_to 'up', (request.env['HTTP_REFERER'] ? :back : app_problems_path(@app)), :class => 'up' |
20 | 20 | %br |
21 | 21 | = render "issue_tracker_links" |
22 | 22 | |
23 | -- if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @problem.comments.any? | |
23 | +- if @problem.comments_allowed? || @problem.comments.any? | |
24 | 24 | - content_for :comments do |
25 | 25 | %h3 Comments |
26 | 26 | - @problem.comments.each do |comment| |
... | ... | @@ -33,18 +33,17 @@ |
33 | 33 | = gravatar_tag comment.user.email, :s => 24 |
34 | 34 | %span.comment-info |
35 | 35 | = time_ago_in_words(comment.created_at, true) << " ago by " |
36 | - = link_to comment.user.email, user_path(comment.user) | |
37 | - %span.delete= link_to '✘'.html_safe, app_problem_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment" | |
36 | + = link_to comment.user.email, comment.user | |
38 | 37 | - else |
39 | 38 | %span.comment-info |
40 | 39 | = time_ago_in_words(comment.created_at, true) << " ago by [Unknown User]" |
41 | - %span.delete= link_to '✘'.html_safe, app_problem_comment_path(@app, @problem, comment), :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment" | |
40 | + %span.delete= link_to '✘'.html_safe, [@app, @problem, comment], :method => :delete, :data => { :confirm => "Are sure you don't need this comment?" }, :class => "destroy-comment" | |
42 | 41 | %tr |
43 | 42 | %td= simple_format comment.body |
44 | - - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? | |
45 | - = form_for @comment, :url => app_problem_comments_path(@app, @problem) do |comment_form| | |
43 | + - if @problem.comments_allowed? | |
44 | + = form_for [@app, @problem, @comment] do |comment_form| | |
46 | 45 | %p Add a comment |
47 | - = comment_form.text_area :body, :style => "width: 420px; height: 80px;" | |
46 | + = comment_form.text_area :body | |
48 | 47 | = comment_form.submit "Save Comment" |
49 | 48 | |
50 | 49 | %h4= @notice.try(:message) | ... | ... |