added the ability to set the sort order for issue statuses

git-svn-id: http://redmine.rubyforge.org/svn/trunk@205 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Jean-Philippe Lang 18 years ago
parent d29ba0b80f
commit fe22797d69
  1. 20
      app/controllers/issue_statuses_controller.rb
  2. 4
      app/controllers/issues_controller.rb
  3. 2
      app/controllers/reports_controller.rb
  4. 2
      app/controllers/roles_controller.rb
  5. 1
      app/models/issue_status.rb
  6. 2
      app/models/query.rb
  7. 7
      app/views/issue_statuses/list.rhtml
  8. 10
      db/migrate/019_add_issue_status_position.rb
  9. 1
      doc/CHANGELOG
  10. 5
      lang/de.yml
  11. 5
      lang/en.yml
  12. 5
      lang/es.yml
  13. 5
      lang/fr.yml
  14. BIN
      public/images/1downarrow.png
  15. BIN
      public/images/1uparrow.png
  16. BIN
      public/images/2downarrow.png
  17. BIN
      public/images/2uparrow.png

@ -19,13 +19,16 @@ class IssueStatusesController < ApplicationController
layout 'base' layout 'base'
before_filter :require_admin before_filter :require_admin
verify :method => :post, :only => [ :destroy, :create, :update, :move ],
:redirect_to => { :action => :list }
def index def index
list list
render :action => 'list' unless request.xhr? render :action => 'list' unless request.xhr?
end end
def list def list
@issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10 @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position"
render :action => "list", :layout => false if request.xhr? render :action => "list", :layout => false if request.xhr?
end end
@ -55,6 +58,21 @@ class IssueStatusesController < ApplicationController
else else
render :action => 'edit' render :action => 'edit'
end end
end
def move
@issue_status = IssueStatus.find(params[:id])
case params[:position]
when 'highest'
@issue_status.move_to_top
when 'higher'
@issue_status.move_higher
when 'lower'
@issue_status.move_lower
when 'lowest'
@issue_status.move_to_bottom
end if params[:position]
redirect_to :action => 'list'
end end
def destroy def destroy

@ -25,7 +25,7 @@ class IssuesController < ApplicationController
include IfpdfHelper include IfpdfHelper
def show def show
@status_options = @issue.status.workflows.find(:all, :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user @status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
@custom_values = @issue.custom_values.find(:all, :include => :custom_field) @custom_values = @issue.custom_values.find(:all, :include => :custom_field)
@journals_count = @issue.journals.count @journals_count = @issue.journals.count
@journals = @issue.journals.find(:all, :include => [:user, :details], :limit => 15, :order => "journals.created_on desc") @journals = @issue.journals.find(:all, :include => [:user, :details], :limit => 15, :order => "journals.created_on desc")
@ -83,7 +83,7 @@ class IssuesController < ApplicationController
def change_status def change_status
#@history = @issue.histories.build(params[:history]) #@history = @issue.histories.build(params[:history])
@status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user @status_options = @issue.status.workflows.find(:all, :order => 'position', :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
@new_status = IssueStatus.find(params[:new_status_id]) @new_status = IssueStatus.find(params[:new_status_id])
if params[:confirm] if params[:confirm]
begin begin

@ -20,7 +20,7 @@ class ReportsController < ApplicationController
before_filter :find_project, :authorize before_filter :find_project, :authorize
def issue_report def issue_report
@statuses = IssueStatus.find :all @statuses = IssueStatus.find(:all, :order => 'position')
case params[:detail] case params[:detail]
when "tracker" when "tracker"

@ -79,6 +79,6 @@ class RolesController < ApplicationController
end end
@roles = Role.find :all @roles = Role.find :all
@trackers = Tracker.find :all @trackers = Tracker.find :all
@statuses = IssueStatus.find(:all, :include => :workflows) @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
end end
end end

@ -18,6 +18,7 @@
class IssueStatus < ActiveRecord::Base class IssueStatus < ActiveRecord::Base
before_destroy :check_integrity before_destroy :check_integrity
has_many :workflows, :foreign_key => "old_status_id" has_many :workflows, :foreign_key => "old_status_id"
acts_as_list
validates_presence_of :name validates_presence_of :name
validates_uniqueness_of :name validates_uniqueness_of :name

@ -69,7 +69,7 @@ class Query < ActiveRecord::Base
def available_filters def available_filters
return @available_filters if @available_filters return @available_filters if @available_filters
@available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all).collect{|s| [s.name, s.id.to_s] } }, @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } },
"tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } }, "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } },
"priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } }, "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } },
"subject" => { :type => :text, :order => 8 }, "subject" => { :type => :text, :order => 8 },

@ -9,6 +9,7 @@
<th><%=l(:field_status)%></th> <th><%=l(:field_status)%></th>
<th><%=l(:field_is_default)%></th> <th><%=l(:field_is_default)%></th>
<th><%=l(:field_is_closed)%></th> <th><%=l(:field_is_closed)%></th>
<th><%=l(:button_sort)%></th>
<th></th> <th></th>
</tr></thead> </tr></thead>
<tbody> <tbody>
@ -17,6 +18,12 @@
<td><div class="square" style="background:#<%= status.html_color %>;"></div> <%= link_to status.name, :action => 'edit', :id => status %></td> <td><div class="square" style="background:#<%= status.html_color %>;"></div> <%= link_to status.name, :action => 'edit', :id => status %></td>
<td align="center"><%= image_tag 'true.png' if status.is_default? %></td> <td align="center"><%= image_tag 'true.png' if status.is_default? %></td>
<td align="center"><%= image_tag 'true.png' if status.is_closed? %></td> <td align="center"><%= image_tag 'true.png' if status.is_closed? %></td>
<td align="center">
<%= link_to image_tag('2uparrow.png', :alt => l(:label_sort_highest)), {:action => 'move', :id => status, :position => 'highest'}, :method => :post, :title => l(:label_sort_highest) %>
<%= link_to image_tag('1uparrow.png', :alt => l(:label_sort_higher)), {:action => 'move', :id => status, :position => 'higher'}, :method => :post, :title => l(:label_sort_higher) %> -
<%= link_to image_tag('1downarrow.png', :alt => l(:label_sort_lower)), {:action => 'move', :id => status, :position => 'lower'}, :method => :post, :title => l(:label_sort_lower) %>
<%= link_to image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), {:action => 'move', :id => status, :position => 'lowest'}, :method => :post, :title => l(:label_sort_lowest) %>
</td>
<td align="center"> <td align="center">
<%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %> <%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
</td> </td>

@ -0,0 +1,10 @@
class AddIssueStatusPosition < ActiveRecord::Migration
def self.up
add_column :issue_statuses, :position, :integer, :default => 1, :null => false
IssueStatus.find(:all).each_with_index {|status, i| status.update_attribute(:position, i+1)}
end
def self.down
remove_column :issue_statuses, :position
end
end

@ -11,6 +11,7 @@ http://redmine.rubyforge.org/
* settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used) * settings are now stored in the database and editable through the application in: Admin -> Settings (config_custom.rb is no longer used)
* mail notifications added when a document, a file or an attachment is added * mail notifications added when a document, a file or an attachment is added
* tooltips added on Gantt chart and calender to view the details of the issues * tooltips added on Gantt chart and calender to view the details of the issues
* ability to set the sort order for issue statuses
* added missing fields to csv export: priority, start date, due date, done ratio * added missing fields to csv export: priority, start date, due date, done ratio
* all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-) * all icons replaced (new icons are based on GPL icon set: "KDE Crystal Diamond 2.5" -by paolino- and "kNeu! Alpha v0.1" -by Pablo Fabregat-)
* added back "fixed version" field on issue screen and in filters * added back "fixed version" field on issue screen and in filters

@ -309,6 +309,10 @@ label_latest_revision: Neueste Neuausgabe
label_view_revisions: Die Neuausgaben ansehen label_view_revisions: Die Neuausgaben ansehen
label_max_size: Maximale Größe label_max_size: Maximale Größe
label_on: auf label_on: auf
label_sort_highest: Erste
label_sort_higher: Aufzurichten
label_sort_lower: Herabzusteigen
label_sort_lowest: Letzter
button_login: Einloggen button_login: Einloggen
button_submit: Einreichen button_submit: Einreichen
@ -332,6 +336,7 @@ button_move: Bewegen
button_back: Rückkehr button_back: Rückkehr
button_cancel: Annullieren button_cancel: Annullieren
button_activate: Aktivieren button_activate: Aktivieren
button_sort: Sortieren
text_select_mail_notifications: Aktionen für die Mailbenachrichtigung aktiviert werden soll. text_select_mail_notifications: Aktionen für die Mailbenachrichtigung aktiviert werden soll.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$

@ -309,6 +309,10 @@ label_latest_revision: Latest revision
label_view_revisions: View revisions label_view_revisions: View revisions
label_max_size: Maximum size label_max_size: Maximum size
label_on: 'on' label_on: 'on'
label_sort_highest: Move to top
label_sort_higher: Move up
label_sort_lower: Move down
label_sort_lowest: Move to bottom
button_login: Login button_login: Login
button_submit: Submit button_submit: Submit
@ -332,6 +336,7 @@ button_move: Move
button_back: Back button_back: Back
button_cancel: Cancel button_cancel: Cancel
button_activate: Activate button_activate: Activate
button_sort: Sort
text_select_mail_notifications: Select actions for which mail notifications should be sent. text_select_mail_notifications: Select actions for which mail notifications should be sent.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$

@ -309,6 +309,10 @@ label_latest_revision: La revisión más última
label_view_revisions: Ver las revisiones label_view_revisions: Ver las revisiones
label_max_size: Tamaño máximo label_max_size: Tamaño máximo
label_on: en label_on: en
label_sort_highest: Primero
label_sort_higher: Subir
label_sort_lower: Bajar
label_sort_lowest: Último
button_login: Conexión button_login: Conexión
button_submit: Someter button_submit: Someter
@ -332,6 +336,7 @@ button_move: Mover
button_back: Atrás button_back: Atrás
button_cancel: Cancelar button_cancel: Cancelar
button_activate: Activar button_activate: Activar
button_sort: Clasificar
text_select_mail_notifications: Seleccionar las actividades que necesitan la activación de la notificación por mail. text_select_mail_notifications: Seleccionar las actividades que necesitan la activación de la notificación por mail.
text_regexp_info: eg. ^[A-Z0-9]+$ text_regexp_info: eg. ^[A-Z0-9]+$

@ -309,6 +309,10 @@ label_latest_revision: Dernière révision
label_view_revisions: Voir les révisions label_view_revisions: Voir les révisions
label_max_size: Taille maximale label_max_size: Taille maximale
label_on: sur label_on: sur
label_sort_highest: Remonter en premier
label_sort_higher: Remonter
label_sort_lower: Descendre
label_sort_lowest: Descendre en dernier
button_login: Connexion button_login: Connexion
button_submit: Soumettre button_submit: Soumettre
@ -332,6 +336,7 @@ button_move: Déplacer
button_back: Retour button_back: Retour
button_cancel: Annuler button_cancel: Annuler
button_activate: Activer button_activate: Activer
button_sort: Trier
text_select_mail_notifications: Sélectionner les actions pour lesquelles la notification par mail doit être activée. text_select_mail_notifications: Sélectionner les actions pour lesquelles la notification par mail doit être activée.
text_regexp_info: ex. ^[A-Z0-9]+$ text_regexp_info: ex. ^[A-Z0-9]+$

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Loading…
Cancel
Save