From 890f36a2d5bc0e87854cae484f8b8a0f9aeb934c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 16 Apr 2015 14:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/journals_helper.rb | 20 ++++++++++++++++++++ app/views/issues/_attributes.html.erb | 3 ++- app/views/issues/_edit.html.erb | 3 +++ app/views/issues/_form.html.erb | 2 +- app/views/issues/_history.html.erb | 2 +- app/views/issues/new.html.erb | 2 +- app/views/issues/show.html.erb | 2 +- 7 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 6e3155f48..0eee08b6b 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -46,6 +46,26 @@ module JournalsHelper content.html_safe end + def render_links_easy(issue, journal, options={}) + content = '' + editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) + destroyable = User.current.logged? && ((journal.user == User.current) || (issue.author_id == User.current.id) || (User.current.admin == 1)) + links = [] + if !journal.notes.blank? + links << link_to(l(:button_quote), + {:controller => 'journals', :action => 'new', :id => issue.id, :journal_id => journal}, + :remote => true, + :method => 'post', + :title => l(:button_quote)) if options[:reply_links] + if destroyable + links << link_to(l(:button_delete), { :controller => 'journals', :action => 'destroy', :id => journal, :format => 'js' }, + :title => l(:button_delete)) + end + end + content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? + content.html_safe + end + def render_notes (issue, journal, options={}) content = '' editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 8819c1e49..5efa3a3f4 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -47,7 +47,8 @@ :method => 'get', :title => l(:label_version_new), :tabindex => 200) if User.current.allowed_to?(:manage_versions, @issue.project) %> - + <%= link_to "", new_project_version_path(@issue.project), :class => "pic_add mt5 ml5 " %> + <% end %>
diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 3f5b30ecd..5ce65ab12 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -5,6 +5,9 @@ <% if @edit_allowed || !@allowed_statuses.empty? %> <% end %>
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index ddabbd89e..3afc47c20 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -97,7 +97,7 @@
- + <%= link_to "", {:controller => 'watchers', :action => 'new', :project_id => @issue.project}, diff --git a/app/views/issues/_history.html.erb b/app/views/issues/_history.html.erb index d9f9105ac..50ddbceee 100644 --- a/app/views/issues/_history.html.erb +++ b/app/views/issues/_history.html.erb @@ -18,7 +18,7 @@

-
<%= render_links(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
+
<%= render_links_easy(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>

<%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>

diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb index f906dc4a2..62e6947a7 100644 --- a/app/views/issues/new.html.erb +++ b/app/views/issues/new.html.erb @@ -14,7 +14,7 @@ <%= l(:button_create) %> - <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %> + <%#= preview_link preview_new_issue_path(:project_id => @project), 'issue-form', 'preview', {:class => "blue_btn fl ml10"} %> <% end %>
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index e170cb717..51d92b90f 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -120,7 +120,7 @@ <%= l(:button_submit) %> <%#= submit_tag l(:button_submit) %> - <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%> + <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%> <% if @changesets.present? %>