From 470ef4d11ee7465c7cc2ca19fd4535fec061395b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 2 Jan 2007 09:58:07 +0000 Subject: [PATCH] * replaced "add_issue" links on projects/show by a drop down list * added this shortcut on list_issues git-svn-id: http://redmine.rubyforge.org/svn/trunk@136 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 5 +++-- app/views/issues/_add_shortcut.rhtml | 5 +++++ app/views/projects/list_issues.rhtml | 12 ++++++++---- app/views/projects/show.rhtml | 13 ++++--------- 4 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 app/views/issues/_add_shortcut.rhtml diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 53293340eb..c3d54dfe9c 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 0000000000..f489077770 --- /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', ("" + 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 a8b1db7bcf..7ccc596112 100644 --- a/app/views/projects/list_issues.rhtml +++ b/app/views/projects/list_issues.rhtml @@ -1,4 +1,7 @@ <% if @query.new_record? %> +
+ <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %> +

<%=l(:label_issue_plural)%>

<%= start_form_tag({:action => 'list_issues'}, :id => 'query_form') %> @@ -24,12 +27,13 @@
<% else %> - <% 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' %> + <%= 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 %>
- <% end %>

<%= @query.name %>

<% end %> <%= error_messages_for 'query' %> diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index d5da126e2d..518ec38ffc 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -13,6 +13,9 @@
+
+ <%= render :partial => 'issues/add_shortcut', :locals => {:trackers => @trackers } %> +

<%= image_tag "tracker" %> <%=l(:label_tracker_plural)%>

- <% if authorize_for 'projects', 'add_issue' %> - » <%=l(:label_issue_new)%>: - - <% end %> +
<%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %>