mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-03 23:53:23 +00:00
Move some action links for issues and journals to the dropdown menu (#34714).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20765 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e0581b34b7
commit
6e93adbec3
@ -28,6 +28,7 @@ module JournalsHelper
|
||||
# Returns the action links for an issue journal
|
||||
def render_journal_actions(issue, journal, options={})
|
||||
links = []
|
||||
dropbown_links = []
|
||||
if journal.notes.present?
|
||||
if options[:reply_links]
|
||||
indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
|
||||
@ -47,16 +48,15 @@ module JournalsHelper
|
||||
:title => l(:button_edit),
|
||||
:class => 'icon-only icon-edit'
|
||||
)
|
||||
links << link_to(l(:button_delete),
|
||||
journal_path(journal, :journal => {:notes => ""}),
|
||||
:remote => true,
|
||||
:method => 'put', :data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete),
|
||||
:class => 'icon-only icon-del'
|
||||
)
|
||||
dropbown_links << link_to(l(:button_delete),
|
||||
journal_path(journal, :journal => {:notes => ""}),
|
||||
:remote => true,
|
||||
:method => 'put', :data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'icon icon-del'
|
||||
)
|
||||
end
|
||||
end
|
||||
safe_join(links, ' ')
|
||||
safe_join(links, ' ') + actions_dropdown {safe_join(dropbown_links, ' ')}
|
||||
end
|
||||
|
||||
def render_notes(issue, journal, options={})
|
||||
|
||||
@ -5,9 +5,11 @@
|
||||
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue),
|
||||
:class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
|
||||
<%= watcher_link(@issue, User.current) %>
|
||||
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
|
||||
:class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
|
||||
<%= link_to l(:button_delete), issue_path(@issue),
|
||||
:data => {:confirm => issues_destroy_confirmation_message(@issue)},
|
||||
:method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
|
||||
<%= actions_dropdown do %>
|
||||
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
|
||||
:class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
|
||||
<%= link_to l(:button_delete), issue_path(@issue),
|
||||
:data => {:confirm => issues_destroy_confirmation_message(@issue)},
|
||||
:method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -2072,6 +2072,13 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
get(:show, :params => {:id => 1})
|
||||
assert_response :success
|
||||
assert_select 'div.issue div.description', :text => /Unable to print recipes/
|
||||
assert_select '.contextual' do
|
||||
assert_select 'a', {:count => 2, :text => /Edit/}
|
||||
assert_select 'a', {:count => 0, :text => /Log time/}
|
||||
assert_select 'a', {:count => 0, :text => /Watch/}
|
||||
assert_select 'div.drdn-items a', {:count => 0, :text => /Copy/}
|
||||
assert_select 'div.drdn-items a', {:count => 0, :text => /Delete/}
|
||||
end
|
||||
# anonymous role is allowed to add a note
|
||||
assert_select 'form#issue-form' do
|
||||
assert_select 'fieldset' do
|
||||
@ -2086,6 +2093,13 @@ class IssuesControllerTest < Redmine::ControllerTest
|
||||
@request.session[:user_id] = 2
|
||||
get(:show, :params => {:id => 1})
|
||||
assert_select 'a', :text => /Quote/
|
||||
assert_select '.contextual' do
|
||||
assert_select 'a', {:count => 2, :text => /Edit/}
|
||||
assert_select 'a', :text => /Log time/
|
||||
assert_select 'a', :text => /Watch/
|
||||
assert_select 'div.drdn-items a', :text => /Copy/
|
||||
assert_select 'div.drdn-items a', :text => /Delete/
|
||||
end
|
||||
assert_select 'form#issue-form' do
|
||||
assert_select 'fieldset' do
|
||||
assert_select 'legend', :text => 'Change properties'
|
||||
|
||||
@ -22,7 +22,7 @@ require File.expand_path('../../test_helper', __FILE__)
|
||||
class JournalsHelperTest < Redmine::HelperTest
|
||||
include JournalsHelper
|
||||
|
||||
fixtures :projects, :trackers, :issue_statuses, :issues,
|
||||
fixtures :projects, :trackers, :issue_statuses, :issues, :journals,
|
||||
:enumerations, :issue_categories,
|
||||
:projects_trackers,
|
||||
:users, :roles, :member_roles, :members,
|
||||
@ -49,4 +49,15 @@ class JournalsHelperTest < Redmine::HelperTest
|
||||
assert_kind_of Attachment, thumbnails.first
|
||||
assert_equal 'image.png', thumbnails.first.filename
|
||||
end
|
||||
|
||||
def test_render_journal_actions_should_return_edit_link_and_actions_dropdown
|
||||
User.current = User.find(1)
|
||||
issue = Issue.find(1)
|
||||
journals = issue.visible_journals_with_index # add indice
|
||||
journal_actions = render_journal_actions(issue, journals.first, {reply_links: true})
|
||||
|
||||
assert_select_in journal_actions, 'a[title=?][class="icon-only icon-comment"]', 'Quote'
|
||||
assert_select_in journal_actions, 'a[title=?][class="icon-only icon-edit"]', 'Edit'
|
||||
assert_select_in journal_actions, 'div[class="drdn-items"] a[class="icon icon-del"]'
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user