Ver código fonte

Adds a "New issue" link on the global issue list (#6204).

git-svn-id: http://svn.redmine.org/redmine/trunk@15345 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.3.0
Jean-Philippe Lang 8 anos atrás
pai
commit
b56f77322a

+ 8
- 0
app/helpers/routes_helper.rb Ver arquivo

@@ -29,6 +29,14 @@ module RoutesHelper
end
end

def _new_project_issue_path(project, *args)
if project
new_project_issue_path(project, *args)
else
new_issue_path(*args)
end
end

def _project_calendar_path(project, *args)
project ? project_calendar_path(project, *args) : issues_calendar_path(*args)
end

+ 2
- 2
app/views/issues/index.html.erb Ver arquivo

@@ -1,6 +1,6 @@
<div class="contextual">
<% if @project && User.current.allowed_to?(:add_issues, @project) && @project.trackers.any? %>
<%= link_to l(:label_issue_new), new_project_issue_path(@project), :class => 'icon icon-add new-issue' %>
<% if User.current.allowed_to?(:add_issues, @project, :global => true) && (@project.nil? || @project.trackers.any?) %>
<%= link_to l(:label_issue_new), _new_project_issue_path(@project), :class => 'icon icon-add new-issue' %>
<% end %>
</div>


+ 6
- 0
test/functional/issues_controller_test.rb Ver arquivo

@@ -1081,6 +1081,12 @@ class IssuesControllerTest < ActionController::TestCase
assert_select 'a.new-issue', 0
end

def test_index_without_project_should_include_new_issue_link
@request.session[:user_id] = 2
get :index
assert_select 'a.new-issue[href="/issues/new"]', :text => 'New issue'
end

def test_show_by_anonymous
get :show, :id => 1
assert_response :success

Carregando…
Cancelar
Salvar