From e205a085737ab0143213d4521bf420ebd2797933 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 14 Dec 2016 16:57:56 +0800 Subject: [PATCH] =?UTF-8?q?issue=20commit=20=E5=85=B3=E8=81=94=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/_issue_commit_ids.html.erb | 4 +--- .../issues/_issue_commit_ids_show.html.erb | 20 +++++++++++++++++++ app/views/issues/show.html.erb | 6 ++---- 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 app/views/issues/_issue_commit_ids_show.html.erb diff --git a/app/views/issues/_issue_commit_ids.html.erb b/app/views/issues/_issue_commit_ids.html.erb index 745b8ebf9..fc9ebf253 100644 --- a/app/views/issues/_issue_commit_ids.html.erb +++ b/app/views/issues/_issue_commit_ids.html.erb @@ -1,4 +1,4 @@ -<% if @issue_commit_ids %> +<% unless @issue_commit_ids.blank? %> <% @issue_commit_ids.each do |commit_id| %>
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %> @@ -13,6 +13,4 @@ <% end %>
<% end %> -<% else %> -
暂无
<% end %> \ No newline at end of file diff --git a/app/views/issues/_issue_commit_ids_show.html.erb b/app/views/issues/_issue_commit_ids_show.html.erb new file mode 100644 index 000000000..e50241cbc --- /dev/null +++ b/app/views/issues/_issue_commit_ids_show.html.erb @@ -0,0 +1,20 @@ +<% if !@issue_commit_ids.blank? %> + 关联Commit + <% @issue_commit_ids.each do |commit_id| %> +
+ <%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %> + <% if @issue %> + <% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %> + <%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %> + <% end %> + <% else %> + <% if User.current.member_of?(@project) %> + <%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %> + <% end %> + <% end %> +
+ <% end %> +<% else %> + 关联Commit + +<% end %> \ No newline at end of file diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 8022430c6..fbb3ac538 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -74,10 +74,8 @@ <%= @issue.done_ratio %>% <% end %> -
  • 关联Commit -
    - <%= render :partial => "issues/issue_commit_ids" %> -
    +
  • + <%= render :partial => "issues/issue_commit_ids_show" %>