#90: added commits and comments for commits to pull-request discussion

This commit is contained in:
Vokhmin Alexey V 2012-09-27 19:40:19 +04:00
parent a994e7dd74
commit f41aaecd72
7 changed files with 85 additions and 26 deletions

View File

@ -38,7 +38,7 @@ div.description-top div.name input {
height: 100%;
}
article div.activity {
article div.activity, .commits_activity {
border: 1px solid #D6D6D6;
border-radius: 5px 5px 5px 5px;
color: #333333;
@ -46,6 +46,13 @@ article div.activity {
padding: 6px;
}
.commits_activity {
display: block;
img { width: 16px; }
.date { width: 140px; }
.name { width: 250px; }
}
article div.messages div.activity {
margin-top: 0;
margin-bottom: 10px;
@ -101,20 +108,20 @@ article div.activity .fulltext.hidden {
display: none;
}
div.activity .data-expander {
margin-left: 10px;
display: inline-block;
width: 12px;
}
div.activity .data-expander.collapsed {
background: #FFF image-url('expand-gray.png') no-repeat;
background-position: 0 2px;
}
div.activity .data-expander.expanded {
background: #FFF image-url('expand-gray2.png') no-repeat;
background-position: 0 2px;
div.activity, .commits_activity {
.data-expander {
margin-left: 10px;
display: inline-block;
width: 12px;
}
.data-expander.collapsed {
background: #FFF image-url('expand-gray.png') no-repeat;
background-position: 0 2px;
}
.data-expander.expanded {
background: #FFF image-url('expand-gray2.png') no-repeat;
background-position: 0 2px;
}
}
div.activity .fulltext p {

View File

@ -0,0 +1,9 @@
- CommentPresenter.present(comment, :project => project, :commentable => commentable) do |presenter|
= render 'shared/feed_message', :presenter => presenter
#open-comment.comment.hidden{:class => "comment-#{comment.id}"}
%h3.tmargin0= t("layout.comments.edit_header")
= form_for comment, :url => project_commentable_comment_path(project, commentable, comment), :html => { :class => 'form edit_comment' } do |f|
= render "projects/comments/form", :f => f, :id => "edit_#{comment.id}"
.comment-left
=link_to t('layout.cancel'), '#', :id => "comment-#{comment.id}", :class => 'cancel_edit_comment button'
.both

View File

@ -2,13 +2,5 @@
.hr
%h3#block-list= t("layout.comments.comments_header")
- list.each do |comment|
- CommentPresenter.present(comment, :project => project, :commentable => commentable) do |presenter|
= render 'shared/feed_message', :presenter => presenter
#open-comment.comment.hidden{:class => "comment-#{comment.id}"}
%h3.tmargin0= t("layout.comments.edit_header")
= form_for comment, :url => project_commentable_comment_path(project, commentable, comment), :html => { :class => 'form edit_comment' } do |f|
= render "projects/comments/form", :f => f, :id => "edit_#{comment.id}"
.comment-left
=link_to t('layout.cancel'), '#', :id => "comment-#{comment.id}", :class => 'cancel_edit_comment button'
.both
= render 'projects/comments/comment', :comment => comment, :project => project, :commentable => commentable
= render "projects/comments/markdown_help"

View File

@ -1,9 +1,10 @@
- commits = split_commits_by_date(commits)
- cur_year = Date.today.year
- counter = 1
- hide_year_div ||= false
- commits.each_pair do |year, by_month|
- if year != cur_year
- if year != cur_year && !hide_year_div
.year= "#{year} #{t("layout.year")}"
- by_month.each_pair do |month, by_day|

View File

@ -0,0 +1,29 @@
%a{ :name => "comments" }
.hr
%h3#block-list= t("layout.comments.comments_header")
- issue_comments = @issue.comments.map{ |c| [c.created_at, c] }
- commits = @commits.map{ |c| [(c.committed_date || c.authored_date), c] }
- activity = (issue_comments + commits).sort_by{ |c| c[0].to_datetime }
- commits_queue = []
- activity.each do |a|
- item = a[1]
- if item.is_a?(Comment)
- if commits_queue.present?
= render :partial => 'commits', :object => commits_queue, :hide_year_div => true
- commits_queue = []
= render 'projects/comments/comment', :comment => item, :project => project, :commentable => commentable
- else
- comments_for_commit = Comment.for_commit(item)
- commits_queue << item
- if comments_for_commit.present?
= render :partial => 'commits', :object => commits_queue, :hide_year_div => true
- comments_for_commit.each do |c|
= render 'projects/comments/comment', :comment => c, :project => project, :commentable => item
- commits_queue = []
- if commits_queue.present?
= render :partial => 'commits', :object => commits_queue, :hide_year_div => true
= render "projects/comments/markdown_help"

View File

@ -0,0 +1,21 @@
%table.commits_activity
%tbody
- commits.each do |commit|
- item_no = commit.id
- GitPresenters::CommitAsMessagePresenter.present(commit, :branch => @branch, :project => @project) do |presenter|
%tr
%td
%img{:height => 16, :alt => "avatar", :src => presenter.image}
%td.date
= presenter.date
%td.name
= presenter.header
%td
- if presenter.caption?
%span.subject= presenter.caption
- if presenter.expandable? and presenter.content?
%span.data-expander.collapsed{:id => "expand#{item_no}"} &nbsp;
- if presenter.content?
.fulltext{:class => "#{presenter.expandable? ? "hidden" : ''} #{presenter.caption? ? "" : "alone"}",
:id => presenter.expandable? ? "content-expand#{item_no}" : ''}
.cm-s-default.md_and_cm=markdown presenter.content

View File

@ -9,7 +9,7 @@
.tab-content.pull_diff_fix
#discussion.tab-pane.active
=render 'projects/issues/header'
=render "projects/comments/list", :list => @issue.comments, :project => @project, :commentable => @issue
=render "comments", :list => @issue.comments, :project => @project, :commentable => @issue
%br
=render "projects/comments/add", :project => @project, :commentable => @issue if current_user
.pull_status