Skip to content

Commit

Permalink
Use css truncation instead of rails
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
  • Loading branch information
dzaporozhets committed Jan 8, 2014
1 parent 18fac58 commit 0377069
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 14 deletions.
9 changes: 9 additions & 0 deletions app/assets/stylesheets/generic/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,12 @@ pre.well-pre {
padding: 0;
color: #666;
}

.str-truncated {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: top;
white-space: nowrap;
max-width: 82%;
}
4 changes: 4 additions & 0 deletions app/assets/stylesheets/sections/commits.scss
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ li.commit {
font-family: $monospace_font;
}

.str-truncated {
max-width: 70%;
}

.commit-row-message {
color: #333;
font-weight: 500;
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/sections/tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
top:-1px;
}
}

.tree_time_ago {
min-width: 135px;
}
}

.tree_author {
Expand Down
13 changes: 7 additions & 6 deletions app/views/dashboard/_project.html.haml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
= link_to project_path(project), class: dom_class(project) do
.dash-project-access-icon
= visibility_level_icon(project.visibility_level)
%span.namespace-name
- if project.namespace
= project.namespace.human_name
\/
%span.project-name.filter-title
= truncate(project.name, length: 25)
%span.str-truncated
%span.namespace-name
- if project.namespace
= project.namespace.human_name
\/
%span.project-name.filter-title
= project.name
%span.arrow
%i.icon-angle-right
5 changes: 3 additions & 2 deletions app/views/groups/_projects.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
= link_to project_path(project), class: dom_class(project) do
.dash-project-access-icon
= visibility_level_icon(project.visibility_level)
%span.project-name
= truncate(project.name, length: 25)
%span.str-truncated
%span.project-name
= truncate(project.name, length: 25)
%span.arrow
%i.icon-angle-right
3 changes: 2 additions & 1 deletion app/views/projects/commits/_commit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
.commit-row-title
= link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
&nbsp;
= link_to_gfm truncate(commit.title, length: 70), project_commit_path(project, commit.id), class: "commit-row-message"
%span.str-truncated
= link_to_gfm commit.title, project_commit_path(project, commit.id), class: "commit-row-message"
= link_to "Browse Code »", project_tree_path(project, commit), class: "pull-right"
.notes_count
- notes = project.notes.for_commit_id(commit.id)
Expand Down
3 changes: 2 additions & 1 deletion app/views/projects/issues/_issue.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

.issue-title
%span.light= "##{issue.iid}"
= link_to_gfm truncate(issue.title, length: 100), project_issue_path(issue.project, issue), class: "row_title"
%span.str-truncated
= link_to_gfm issue.title, project_issue_path(issue.project, issue), class: "row_title"
- if issue.closed?
%small.pull-right
= "CLOSED"
Expand Down
3 changes: 2 additions & 1 deletion app/views/projects/tree/_blob_item.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%tr{ class: "tree-item #{tree_hex_class(blob_item)}" }
%td.tree-item-file-name
= tree_icon(type)
%span= link_to truncate(blob_item.name, length: 40), project_blob_path(@project, tree_join(@id || @commit.id, blob_item.name))
%span.str-truncated
= link_to blob_item.name, project_blob_path(@project, tree_join(@id || @commit.id, blob_item.name))
%td.tree_time_ago.cgray
%span.log_loading.hide
Loading commit data...
Expand Down
5 changes: 3 additions & 2 deletions app/views/projects/tree/_tree_commit_column.html.haml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
%span.tree_author= commit_author_link(commit, avatar: true, size: 16)
= link_to_gfm truncate(commit.title, length: 80), project_commit_path(@project, commit.id), class: "tree-commit-link"
%span.str-truncated
%span.tree_author= commit_author_link(commit, avatar: true, size: 16)
= link_to_gfm commit.title, project_commit_path(@project, commit.id), class: "tree-commit-link"
3 changes: 2 additions & 1 deletion app/views/projects/tree/_tree_item.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%tr{ class: "tree-item #{tree_hex_class(tree_item)}" }
%td.tree-item-file-name
= tree_icon(type)
%span= link_to truncate(tree_item.name, length: 40), project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
%span.str-truncated
= link_to tree_item.name, project_tree_path(@project, tree_join(@id || @commit.id, tree_item.name))
%td.tree_time_ago.cgray
%span.log_loading.hide
Loading commit data...
Expand Down

0 comments on commit 0377069

Please sign in to comment.