[refs #18] refactoring

This commit is contained in:
Alexander Machehin 2012-01-16 00:10:50 +06:00
parent 674d5f8e56
commit e10dd56dff
3 changed files with 35 additions and 50 deletions

View File

@ -0,0 +1,33 @@
%a{ :name => "comments" }
.block#block-list
.content
%h2.title
= t("layout.issues.comments_header")
.inner
%ul.list
- list.each do |comment|
%li
.left
= link_to comment.user.uname, user_path(comment.user.uname)
.item
= comment.body
%br
%br
- if commentable.class == Issue
- edit_path = edit_project_issue_comment_path(project, commentable.id, comment)
- delete_path = project_issue_comment_path(project, commentable.id, comment)
- elsif commentable.class == Grit::Commit
- edit_path = edit_project_commit_comment_path(project, commentable.id, comment)
- delete_path = project_commit_comment_path(project, commentable.id, comment)
= link_to t("layout.edit"), edit_path if can? :update, comment
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), delete_path, :method => "delete", :class => "button", :confirm => t("layout.comments.confirm_delete") if can? :delete, comment
.block
.content
%h2.title
= t("layout.comments.new_header")
.inner
- new_path = project_issue_comments_path(project, commentable.id) if commentable.class == Issue
- new_path = project_commit_comments_path(project, commentable.id) if commentable.class == Grit::Commit
= form_for :comment, :url => new_path, :method => :post, :html => { :class => :form } do |f|
= render :partial => "comments/form", :locals => {:f => f}

View File

@ -27,28 +27,4 @@
- content_for :sidebar, render(:partial => 'git/shared/sidebar')
%a{ :name => "comments" }
.block#block-list
.content
%h2.title
= t("layout.issues.comments_header")
.inner
%ul.list
- Project.commit_comments(@commit, @project).each do |comment|
%li
.left
= link_to comment.user.uname, user_path(comment.user.uname)
.item
= comment.body
%br
%br
= link_to t("layout.edit"), edit_project_commit_comment_path(@project, @commit.id, comment) if can? :update, comment
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), project_commit_comment_path(@project, @commit.id, comment), :method => "delete", :class => "button", :confirm => t("layout.comments.confirm_delete") if can? :delete, comment
.block
.content
%h2.title
= t("layout.comments.new_header")
.inner
= form_for :comment, :url => project_commit_comments_path(@project, @commit.id), :method => :post, :html => { :class => :form } do |f|
= render :partial => "comments/form", :locals => {:f => f}
= render :partial => "comments/list", :locals => {:list => Project.commit_comments(@commit, @project), :project => @project, :commentable => @commit}

View File

@ -29,28 +29,4 @@
- else
= link_to t('layout.issues.subscribe_btn'), project_issue_subscribes_path(@project, @issue), :method => :post
%a{ :name => "comments" }
.block#block-list
.content
%h2.title
= t("layout.issues.comments_header")
.inner
%ul.list
- @issue.comments.each do |comment|
%li
.left
= link_to comment.user.uname, user_path(comment.user.uname)
.item
= comment.body
%br
%br
= link_to t("layout.edit"), edit_project_issue_comment_path(@project, @issue.id, comment) if can? :update, comment
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.delete")) + " " + t("layout.delete"), project_issue_comment_path(@project, @issue.id, comment), :method => "delete", :class => "button", :confirm => t("layout.comments.confirm_delete") if can? :delete, comment
.block
.content
%h2.title
= t("layout.comments.new_header")
.inner
= form_for :comment, :url => project_issue_comments_path(@project, @issue.id), :method => :post, :html => { :class => :form } do |f|
= render :partial => "comments/form", :locals => {:f => f}
= render :partial => "comments/list", :locals => {:list => @issue.comments, :project => @project, :commentable => @issue}