Skip to content

Commit afa378c

Browse files
committed
Refs errbit#1011 problems index layout fix
Long names in the problems index can blow up the table layout, causing ugliness and potentially horizontal scrolling. This change adds whitespace: nowrap and sets a few td widths to keep the layout from jumping around.
1 parent ff341e5 commit afa378c

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

app/assets/stylesheets/errbit.css.erb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ div.issue_tracker.nested label.r_on, div.issue_tracker.nested label.r_on:hover,
615615
/* Apps Table */
616616
table.apps tbody tr:hover td ,table.errs tbody tr:hover td { background-color: #F2F2F2;}
617617

618-
table.apps td.name, table.errs td.message { width: 100%; }
618+
table.apps td.name { width: 100%; }
619619
table.apps td { padding: 16px 20px; }
620620
table.apps th { padding: 10px 20px; }
621621

@@ -665,9 +665,12 @@ td.count, td.issue_link {
665665
}
666666

667667
/* Err Tables */
668-
table.errs td.app {
669-
padding-right: 2em;
670-
width: 20%;
668+
table.errs td.app .name {
669+
display: block;
670+
width: 150px;
671+
white-space: nowrap;
672+
text-overflow: ellipsis;
673+
overflow: hidden;
671674
}
672675
table.errs td.app .environment {
673676
font-size: 0.8em;
@@ -676,12 +679,10 @@ table.errs td.app .environment {
676679
table.errs td.message a {
677680
display: block;
678681
word-wrap: break-word;
679-
/* PjpG - configuration in WHAT & WHERE table's columns using ellipsis to avoid oversizing table's width */
680-
width: 300px;
681-
overflow: hidden;
682-
text-overflow: ellipsis;
683-
-o-text-overflow: ellipsis;
684-
/* ------ */
682+
width: 440px;
683+
white-space: nowrap;
684+
text-overflow: ellipsis;
685+
overflow: hidden;
685686
}
686687
table.errs td.message em {
687688
color: #727272;

app/helpers/problems_helper.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@ def problem_confirm(action)
33
t(format('problems.confirm.%s', action)) unless Errbit::Config.confirm_err_actions.eql? false
44
end
55

6-
def truncated_problem_message(problem)
7-
msg = problem.message
8-
return if msg.blank?
9-
10-
# Truncate & insert invisible chars so that firefox can emulate
11-
# 'word-wrap: break-word' CSS rule
12-
truncate(msg, length: 300, escape: false).
13-
scan(/.{1,5}/).map { |s| h(s) }.
14-
join("​").html_safe
15-
end
16-
176
def gravatar_tag(email, options = {})
187
return nil unless email.present?
198

app/views/problems/_table.html.haml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
%td.select
1818
= check_box_tag "problems[]", problem.id, selected_problems.member?(problem.id.to_s)
1919
%td.app
20-
= link_to problem.app.name, app_path(problem.app)
20+
= link_to problem.app.name, app_path(problem.app), class: 'name', title: problem.app.name
2121
- if current_page?(:controller => 'problems')
2222
%span.environment= link_to problem.environment, problems_path(:environment => problem.environment)
2323
- else
2424
%span.environment= link_to problem.environment, app_path(problem.app, :environment => problem.environment)
2525
%td.message
26-
= link_to truncated_problem_message(problem), app_problem_path(problem.app, problem)
26+
= link_to problem.message, app_problem_path(problem.app, problem), title: problem.message
2727
%em= problem.where
2828
- if problem.comments_count > 0
2929
- comment = problem.comments.last

spec/helpers/problems_helper_spec.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
describe ProblemsHelper do
2-
describe '#truncated_problem_message' do
3-
it 'is html safe' do
4-
problem = double('problem', message: '#<NoMethodError: ...>')
5-
truncated = helper.truncated_problem_message(problem)
6-
expect(truncated).to be_html_safe
7-
expect(truncated).to_not include('<', '>')
8-
end
9-
10-
it 'does not double escape html' do
11-
problem = double('problem', message: '#<NoMethodError: ...>')
12-
truncated = helper.truncated_problem_message(problem)
13-
expect(truncated).to be_html_safe
14-
expect(truncated).to_not include('&amp;')
15-
end
16-
end
17-
182
describe "#gravatar_tag" do
193
let(:email) { "[email protected]" }
204
let(:email_hash) { Digest::MD5.hexdigest email }

0 commit comments

Comments
 (0)