diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 53293340ebba4ba8f8be47dd432b14775a817059..c3d54dfe9cdbbd25082eda4ab2fa05c5a52d1dab 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,5 +1,5 @@ # redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Copyright (C) 2006-2007 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -239,7 +239,8 @@ class ProjectsController < ApplicationController :conditions => @query.statement, :limit => @issue_pages.items_per_page, :offset => @issue_pages.current.offset - end + end + @trackers = Tracker.find :all render :layout => false if request.xhr? end diff --git a/app/views/issues/_add_shortcut.rhtml b/app/views/issues/_add_shortcut.rhtml new file mode 100644 index 0000000000000000000000000000000000000000..f4890777708c43ef5aac5c6fd5f8bb95ef8c279a --- /dev/null +++ b/app/views/issues/_add_shortcut.rhtml @@ -0,0 +1,5 @@ +<% if authorize_for('projects', 'add_issue') %> +<%= start_form_tag({ :controller => 'projects', :action => 'add_issue', :id => @project }, :method => 'get') %> +<%= l(:label_issue_new) %>: <%= select_tag 'tracker_id', ("<option></option>" + options_from_collection_for_select(trackers, 'id', 'name')), :onchange => "if (this.value!='') {this.form.submit();}" %> +<%= end_form_tag %> +<% end %> diff --git a/app/views/projects/list_issues.rhtml b/app/views/projects/list_issues.rhtml index a8b1db7bcf803f9dd8933b4978b8ce689933ac75..7ccc5961127076dd99e17c66ec81597af239cbc8 100644 --- a/app/views/projects/list_issues.rhtml +++ b/app/views/projects/list_issues.rhtml @@ -1,4 +1,7 @@ <% if @query.new_record? %> + <div class="contextual"> + <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %> + </div> <h2><%=l(:label_issue_plural)%></h2> <%= start_form_tag({:action => 'list_issues'}, :id => 'query_form') %> @@ -24,12 +27,13 @@ </div> <br /> <% else %> - <% if authorize_for('projects', 'add_query') %> <div class="contextual"> - <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'pic picEdit' %> - <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %> + <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %> + <% if authorize_for('projects', 'add_query') %> + <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'pic picEdit' %> + <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :post => true, :class => 'pic picDelete' %> + <% end %> </div> - <% end %> <h2><%= @query.name %></h2> <% end %> <%= error_messages_for 'query' %> diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index d5da126e2db1e6ba27ee7e2f00677f2b6d571348..518ec38ffc99f213a066eb04de4bd62960b9a305 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -13,6 +13,9 @@ </ul> <div class="box"> + <div class="contextual"> + <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %> + </div> <h3><%= image_tag "tracker" %> <%=l(:label_tracker_plural)%></h3> <ul> <% for tracker in @trackers %> @@ -23,15 +26,7 @@ <%= lwr(:label_open_issues, issue_count) %> </li> <% end %> - </ul> - <% if authorize_for 'projects', 'add_issue' %> - » <%=l(:label_issue_new)%>: - <ul> - <% @trackers.each do |tracker| %> - <li><%= link_to tracker.name, :controller => 'projects', :action => 'add_issue', :id => @project, :tracker_id => tracker %></li> - <% end %> - </ul> - <% end %> + </ul> <center><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></center> </div> </div>