Commit 03770698417563abe70fdea223700ca370e9f062

Authored by Dmitriy Zaporozhets
1 parent 18fac587

Use css truncation instead of rails

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/assets/stylesheets/generic/common.scss
... ... @@ -119,3 +119,12 @@ pre.well-pre {
119 119 padding: 0;
120 120 color: #666;
121 121 }
  122 +
  123 +.str-truncated {
  124 + display: inline-block;
  125 + overflow: hidden;
  126 + text-overflow: ellipsis;
  127 + vertical-align: top;
  128 + white-space: nowrap;
  129 + max-width: 82%;
  130 +}
... ...
app/assets/stylesheets/sections/commits.scss
... ... @@ -481,6 +481,10 @@ li.commit {
481 481 font-family: $monospace_font;
482 482 }
483 483  
  484 + .str-truncated {
  485 + max-width: 70%;
  486 + }
  487 +
484 488 .commit-row-message {
485 489 color: #333;
486 490 font-weight: 500;
... ...
app/assets/stylesheets/sections/tree.scss
... ... @@ -61,6 +61,10 @@
61 61 top:-1px;
62 62 }
63 63 }
  64 +
  65 + .tree_time_ago {
  66 + min-width: 135px;
  67 + }
64 68 }
65 69  
66 70 .tree_author {
... ...
app/views/dashboard/_project.html.haml
1 1 = link_to project_path(project), class: dom_class(project) do
2 2 .dash-project-access-icon
3 3 = visibility_level_icon(project.visibility_level)
4   - %span.namespace-name
5   - - if project.namespace
6   - = project.namespace.human_name
7   - \/
8   - %span.project-name.filter-title
9   - = truncate(project.name, length: 25)
  4 + %span.str-truncated
  5 + %span.namespace-name
  6 + - if project.namespace
  7 + = project.namespace.human_name
  8 + \/
  9 + %span.project-name.filter-title
  10 + = project.name
10 11 %span.arrow
11 12 %i.icon-angle-right
... ...
app/views/groups/_projects.html.haml
... ... @@ -14,7 +14,8 @@
14 14 = link_to project_path(project), class: dom_class(project) do
15 15 .dash-project-access-icon
16 16 = visibility_level_icon(project.visibility_level)
17   - %span.project-name
18   - = truncate(project.name, length: 25)
  17 + %span.str-truncated
  18 + %span.project-name
  19 + = truncate(project.name, length: 25)
19 20 %span.arrow
20 21 %i.icon-angle-right
... ...
app/views/projects/commits/_commit.html.haml
... ... @@ -2,7 +2,8 @@
2 2 .commit-row-title
3 3 = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
4 4 &nbsp;
5   - = link_to_gfm truncate(commit.title, length: 70), project_commit_path(project, commit.id), class: "commit-row-message"
  5 + %span.str-truncated
  6 + = link_to_gfm commit.title, project_commit_path(project, commit.id), class: "commit-row-message"
6 7 = link_to "Browse Code »", project_tree_path(project, commit), class: "pull-right"
7 8 .notes_count
8 9 - notes = project.notes.for_commit_id(commit.id)
... ...
app/views/projects/issues/_issue.html.haml
... ... @@ -5,7 +5,8 @@
5 5  
6 6 .issue-title
7 7 %span.light= "##{issue.iid}"
8   - = link_to_gfm truncate(issue.title, length: 100), project_issue_path(issue.project, issue), class: "row_title"
  8 + %span.str-truncated
  9 + = link_to_gfm issue.title, project_issue_path(issue.project, issue), class: "row_title"
9 10 - if issue.closed?
10 11 %small.pull-right
11 12 = "CLOSED"
... ...
app/views/projects/tree/_blob_item.html.haml
1 1 %tr{ class: "tree-item #{tree_hex_class(blob_item)}" }
2 2 %td.tree-item-file-name
3 3 = tree_icon(type)
4   - %span= link_to truncate(blob_item.name, length: 40), project_blob_path(@project, tree_join(@id || @commit.id, blob_item.name))
  4 + %span.str-truncated
  5 + = link_to blob_item.name, project_blob_path(@project, tree_join(@id || @commit.id, blob_item.name))
5 6 %td.tree_time_ago.cgray
6 7 %span.log_loading.hide
7 8 Loading commit data...
... ...
app/views/projects/tree/_tree_commit_column.html.haml
1   -%span.tree_author= commit_author_link(commit, avatar: true, size: 16)
2   -= link_to_gfm truncate(commit.title, length: 80), project_commit_path(@project, commit.id), class: "tree-commit-link"
  1 +%span.str-truncated
  2 + %span.tree_author= commit_author_link(commit, avatar: true, size: 16)
  3 + = link_to_gfm commit.title, project_commit_path(@project, commit.id), class: "tree-commit-link"
... ...
app/views/projects/tree/_tree_item.html.haml
1 1 %tr{ class: "tree-item #{tree_hex_class(tree_item)}" }
2 2 %td.tree-item-file-name
3 3 = tree_icon(type)
4   - %span= link_to truncate(tree_item.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
  4 + %span.str-truncated
  5 + = link_to tree_item.name, project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
5 6 %td.tree_time_ago.cgray
6 7 %span.log_loading.hide
7 8 Loading commit data...
... ...