diff options
author | skv-headless <skv-headless@yandex.ru> | 2014-02-25 17:54:30 +0400 |
---|---|---|
committer | skv-headless <skv-headless@yandex.ru> | 2014-02-25 18:23:23 +0400 |
commit | 2c28dbd2547d77054b0a080af6b0dfec674ad799 (patch) | |
tree | ac02f4d1536b1a59c8f38872eb08bfe57d224f20 /app | |
parent | 5f31caa0ed88b0d779336d909dc7f48b9f86cd25 (diff) | |
download | gitlab-ce-2c28dbd2547d77054b0a080af6b0dfec674ad799.tar.gz |
commit description in commit list
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/sections/commits.scss | 32 | ||||
-rw-r--r-- | app/models/commit.rb | 16 | ||||
-rw-r--r-- | app/views/projects/commits/_commit.html.haml | 9 |
3 files changed, 49 insertions, 8 deletions
diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index 78c268f60ea..03a545de6fa 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -168,6 +168,32 @@ li.commit { text-decoration: underline; } } + + .text-expander { + background: #ddd; + color: #555; + padding: 0 5px; + line-height: 6px; + height: 12px; + font-size: 12px; + font-weight: bold; + vertical-align: middle; + display: inline-block; + border-radius: 1px; + text-decoration: none; + cursor: pointer; + &:hover { + background-color: #ccc; + } + } + } + + .commit-row-description { + font-size: 14px; + border-left: 1px solid #e5e5e5; + padding: 0 15px 0 7px; + margin: 5px 0 10px 5px; + display: none; } .commit-row-info { @@ -192,4 +218,10 @@ li.commit { @extend .cgray; } } + + &.open { + .commit-row-description { + display: block; + } + } } diff --git a/app/models/commit.rb b/app/models/commit.rb index bcc1bcbd96a..c313aeb7572 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -99,14 +99,16 @@ class Commit # # cut off, ellipses (`&hellp;`) are prepended to the commit message. def description - description = safe_message + title_end = safe_message.index(/\n/) + @description ||= if (!title_end && safe_message.length > 100) || (title_end && title_end > 100) + "…".html_safe << safe_message[80..-1] + else + safe_message.split(/\n/, 2)[1].try(:chomp) + end + end - title_end = description.index(/\n/) - if (!title_end && description.length > 100) || (title_end && title_end > 100) - "…".html_safe << description[80..-1] - else - description.split(/\n/, 2)[1].try(:chomp) - end + def description? + description.present? end # Regular expression that identifies commit message clauses that trigger issue closing. diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index 9772d3ef2ef..a5e369e9366 100644 --- a/app/views/projects/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml @@ -1,9 +1,12 @@ %li.commit - .commit-row-title + .commit-row-title{"data-toggle" => "dropdown"} = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" %span.str-truncated = link_to_gfm commit.title, project_commit_path(project, commit.id), class: "commit-row-message" + - if commit.description? + %span.label-default.text-expander.js-details-target ... + = link_to "Browse Code ยป", project_tree_path(project, commit), class: "pull-right" .notes_count - notes = project.notes.for_commit_id(commit.id) @@ -12,6 +15,10 @@ %i.icon-comment = notes.count + - if commit.description? + .commit-row-description + = simple_format(commit.description) + .commit-row-info = commit_author_link(commit, avatar: true, size: 16) .committed_ago |