@@ -0,0 +1,15 | |||||
|
1 | <h2><%=l(:label_issue_category)%>: <%=h @category.name %></h2> | |||
|
2 | ||||
|
3 | <% form_tag({}) do %> | |||
|
4 | <div class="box"> | |||
|
5 | <p><strong><%= l(:text_issue_category_destroy_question, @issue_count) %></strong></p> | |||
|
6 | <p><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_issue_category_destroy_assignments) %><br /> | |||
|
7 | <% if @categories.size > 0 %> | |||
|
8 | <%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_issue_category_reassign_to) %>: | |||
|
9 | <%= select_tag 'reassign_to_id', options_from_collection_for_select(@categories, 'id', 'name') %></p> | |||
|
10 | <% end %> | |||
|
11 | </div> | |||
|
12 | ||||
|
13 | <%= submit_tag l(:button_apply) %> | |||
|
14 | <%= link_to l(:button_cancel), :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' %> | |||
|
15 | <% end %> |
@@ -0,0 +1,41 | |||||
|
1 | # redMine - project management software | |||
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |||
|
3 | # | |||
|
4 | # This program is free software; you can redistribute it and/or | |||
|
5 | # modify it under the terms of the GNU General Public License | |||
|
6 | # as published by the Free Software Foundation; either version 2 | |||
|
7 | # of the License, or (at your option) any later version. | |||
|
8 | # | |||
|
9 | # This program is distributed in the hope that it will be useful, | |||
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
12 | # GNU General Public License for more details. | |||
|
13 | # | |||
|
14 | # You should have received a copy of the GNU General Public License | |||
|
15 | # along with this program; if not, write to the Free Software | |||
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
|
17 | ||||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |||
|
19 | ||||
|
20 | class IssueCategoryTest < Test::Unit::TestCase | |||
|
21 | fixtures :issue_categories, :issues | |||
|
22 | ||||
|
23 | def setup | |||
|
24 | @category = IssueCategory.find(1) | |||
|
25 | end | |||
|
26 | ||||
|
27 | def test_destroy | |||
|
28 | issue = @category.issues.first | |||
|
29 | @category.destroy | |||
|
30 | # Make sure the category was nullified on the issue | |||
|
31 | assert_nil issue.reload.category | |||
|
32 | end | |||
|
33 | ||||
|
34 | def test_destroy_with_reassign | |||
|
35 | issue = @category.issues.first | |||
|
36 | reassign_to = IssueCategory.find(2) | |||
|
37 | @category.destroy(reassign_to) | |||
|
38 | # Make sure the issue was reassigned | |||
|
39 | assert_equal reassign_to, issue.reload.category | |||
|
40 | end | |||
|
41 | end |
@@ -18,6 +18,8 | |||||
18 | class IssueCategoriesController < ApplicationController |
|
18 | class IssueCategoriesController < ApplicationController | |
19 | layout 'base' |
|
19 | layout 'base' | |
20 | before_filter :find_project, :authorize |
|
20 | before_filter :find_project, :authorize | |
|
21 | ||||
|
22 | verify :method => :post, :only => :destroy | |||
21 |
|
23 | |||
22 | def edit |
|
24 | def edit | |
23 | if request.post? and @category.update_attributes(params[:category]) |
|
25 | if request.post? and @category.update_attributes(params[:category]) | |
@@ -27,11 +29,17 class IssueCategoriesController < ApplicationController | |||||
27 | end |
|
29 | end | |
28 |
|
30 | |||
29 | def destroy |
|
31 | def destroy | |
30 | @category.destroy |
|
32 | @issue_count = @category.issues.size | |
31 | redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories', :id => @project |
|
33 | if @issue_count == 0 | |
32 | rescue |
|
34 | # No issue assigned to this category | |
33 | flash[:error] = "Categorie can't be deleted" |
|
35 | @category.destroy | |
34 |
redirect_to :controller => 'projects', :action => 'settings', :tab => 'categories' |
|
36 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' | |
|
37 | elsif params[:todo] | |||
|
38 | reassign_to = @project.issue_categories.find_by_id(params[:reassign_to_id]) if params[:todo] == 'reassign' | |||
|
39 | @category.destroy(reassign_to) | |||
|
40 | redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' | |||
|
41 | end | |||
|
42 | @categories = @project.issue_categories - [@category] | |||
35 | end |
|
43 | end | |
36 |
|
44 | |||
37 | private |
|
45 | private |
@@ -16,15 +16,21 | |||||
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class IssueCategory < ActiveRecord::Base |
|
18 | class IssueCategory < ActiveRecord::Base | |
19 | before_destroy :check_integrity |
|
|||
20 | belongs_to :project |
|
19 | belongs_to :project | |
21 | belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id' |
|
20 | belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id' | |
22 |
|
21 | has_many :issues, :foreign_key => 'category_id', :dependent => :nullify | ||
|
22 | ||||
23 | validates_presence_of :name |
|
23 | validates_presence_of :name | |
24 | validates_uniqueness_of :name, :scope => [:project_id] |
|
24 | validates_uniqueness_of :name, :scope => [:project_id] | |
25 |
|
25 | |||
26 | private |
|
26 | alias :destroy_without_reassign :destroy | |
27 | def check_integrity |
|
27 | ||
28 | raise "Can't delete category" if Issue.find(:first, :conditions => ["category_id=?", self.id]) |
|
28 | # Destroy the category | |
|
29 | # If a category is specified, issues are reassigned to this category | |||
|
30 | def destroy(reassign_to = nil) | |||
|
31 | if reassign_to && reassign_to.is_a?(IssueCategory) && reassign_to.project == self.project | |||
|
32 | Issue.update_all("category_id = #{reassign_to.id}", "category_id = #{id}") | |||
|
33 | end | |||
|
34 | destroy_without_reassign | |||
29 | end |
|
35 | end | |
30 | end |
|
36 | end |
@@ -12,7 +12,7 | |||||
12 | <td><%=h(category.name) %></td> |
|
12 | <td><%=h(category.name) %></td> | |
13 | <td><%=h(category.assigned_to.name) if category.assigned_to %></td> |
|
13 | <td><%=h(category.assigned_to.name) if category.assigned_to %></td> | |
14 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'issue_categories', :action => 'edit', :id => category }, :class => 'icon icon-edit' %></small></td> |
|
14 | <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'issue_categories', :action => 'edit', :id => category }, :class => 'icon icon-edit' %></small></td> | |
15 |
<td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => category}, |
|
15 | <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => category}, :method => :post, :class => 'icon icon-del' %></small></td> | |
16 | </tr> |
|
16 | </tr> | |
17 | <% end %> |
|
17 | <% end %> | |
18 | <% end %> |
|
18 | <% end %> |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Отбелязване и приключва | |||||
479 | text_issue_added: Публикувана е нова задача с номер %s. |
|
479 | text_issue_added: Публикувана е нова задача с номер %s. | |
480 | text_issue_updated: Задача %s е обновена. |
|
480 | text_issue_updated: Задача %s е обновена. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Мениджър |
|
486 | default_role_manager: Мениджър | |
484 | default_role_developper: Разработчик |
|
487 | default_role_developper: Разработчик |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
479 | text_issue_added: Ticket %s wurde erstellt. |
|
479 | text_issue_added: Ticket %s wurde erstellt. | |
480 | text_issue_updated: Ticket %s wurde aktualisiert. |
|
480 | text_issue_updated: Ticket %s wurde aktualisiert. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Manager |
|
486 | default_role_manager: Manager | |
484 | default_role_developper: Developer |
|
487 | default_role_developper: Developer |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
479 | text_issue_added: Issue %s has been reported. |
|
479 | text_issue_added: Issue %s has been reported. | |
480 | text_issue_updated: Issue %s has been updated. |
|
480 | text_issue_updated: Issue %s has been updated. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Manager |
|
486 | default_role_manager: Manager | |
484 | default_role_developper: Developer |
|
487 | default_role_developper: Developer |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
479 | text_issue_added: Issue %s has been reported. |
|
479 | text_issue_added: Issue %s has been reported. | |
480 | text_issue_updated: Issue %s has been updated. |
|
480 | text_issue_updated: Issue %s has been updated. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Manager |
|
486 | default_role_manager: Manager | |
484 | default_role_developper: Desarrollador |
|
487 | default_role_developper: Desarrollador |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Référencement et résolution des demandes | |||||
479 | text_issue_added: La demande %s a été soumise. |
|
479 | text_issue_added: La demande %s a été soumise. | |
480 | text_issue_updated: La demande %s a été mise à jour. |
|
480 | text_issue_updated: La demande %s a été mise à jour. | |
481 | text_wiki_destroy_confirmation: Etes-vous sûr de vouloir supprimer ce wiki et tout son contenu ? |
|
481 | text_wiki_destroy_confirmation: Etes-vous sûr de vouloir supprimer ce wiki et tout son contenu ? | |
|
482 | text_issue_category_destroy_question: Des demandes (%d) sont affectées à cette catégories. Que voulez-vous faire ? | |||
|
483 | text_issue_category_destroy_assignments: N'affecter les demandes à aucune autre catégorie | |||
|
484 | text_issue_category_reassign_to: Réaffecter les demandes à cette catégorie | |||
482 |
|
485 | |||
483 | default_role_manager: Manager |
|
486 | default_role_manager: Manager | |
484 | default_role_developper: Développeur |
|
487 | default_role_developper: Développeur |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
479 | text_issue_added: "E' stata segnalata l'anomalia %s." |
|
479 | text_issue_added: "E' stata segnalata l'anomalia %s." | |
480 | text_issue_updated: "L'anomalia %s e' stata aggiornata." |
|
480 | text_issue_updated: "L'anomalia %s e' stata aggiornata." | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Manager |
|
486 | default_role_manager: Manager | |
484 | default_role_developper: Sviluppatore |
|
487 | default_role_developper: Sviluppatore |
@@ -480,6 +480,9 text_issues_ref_in_commit_messages: コミットメッセージ内で問題の | |||||
480 | text_issue_added: 問題 %s が報告されました。 |
|
480 | text_issue_added: 問題 %s が報告されました。 | |
481 | text_issue_updated: 問題 %s が更新されました。 |
|
481 | text_issue_updated: 問題 %s が更新されました。 | |
482 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
482 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
483 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
484 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
485 | text_issue_category_reassign_to: Reassing issues to this category | |||
483 |
|
486 | |||
484 | default_role_manager: 管理者 |
|
487 | default_role_manager: 管理者 | |
485 | default_role_developper: 開発者 |
|
488 | default_role_developper: 開発者 |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Opzoeken en aanpassen van issues in commit b | |||||
479 | text_issue_added: Issue %s is gerapporteerd. |
|
479 | text_issue_added: Issue %s is gerapporteerd. | |
480 | text_issue_updated: Issue %s is gewijzigd. |
|
480 | text_issue_updated: Issue %s is gewijzigd. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Manager |
|
486 | default_role_manager: Manager | |
484 | default_role_developper: Ontwikkelaar |
|
487 | default_role_developper: Ontwikkelaar |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
479 | text_issue_added: Tarefa %s foi incluída. |
|
479 | text_issue_added: Tarefa %s foi incluída. | |
480 | text_issue_updated: Tarefa %s foi alterada. |
|
480 | text_issue_updated: Tarefa %s foi alterada. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Analista de Negocio ou Gerente de Projeto |
|
486 | default_role_manager: Analista de Negocio ou Gerente de Projeto | |
484 | default_role_developper: Desenvolvedor |
|
487 | default_role_developper: Desenvolvedor |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referenciando e arrumando tarefas nas mensag | |||||
479 | text_issue_added: Tarefa %s foi incluída. |
|
479 | text_issue_added: Tarefa %s foi incluída. | |
480 | text_issue_updated: Tarefa %s foi alterada. |
|
480 | text_issue_updated: Tarefa %s foi alterada. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Analista de Negócio ou Gerente de Projeto |
|
486 | default_role_manager: Analista de Negócio ou Gerente de Projeto | |
484 | default_role_developper: Desenvolvedor |
|
487 | default_role_developper: Desenvolvedor |
@@ -479,6 +479,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
479 | text_issue_added: Brist %s har rapporterats. |
|
479 | text_issue_added: Brist %s har rapporterats. | |
480 | text_issue_updated: Brist %s har uppdaterats. |
|
480 | text_issue_updated: Brist %s har uppdaterats. | |
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
481 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
482 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
483 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
484 | text_issue_category_reassign_to: Reassing issues to this category | |||
482 |
|
485 | |||
483 | default_role_manager: Förvaltare |
|
486 | default_role_manager: Förvaltare | |
484 | default_role_developper: Utvecklare |
|
487 | default_role_developper: Utvecklare |
@@ -481,6 +481,9 text_issues_ref_in_commit_messages: Referencing and fixing issues in commit mess | |||||
481 | text_issue_added: %s ѱ |
|
481 | text_issue_added: %s ѱ | |
482 | text_issue_updated: %s Ѹ |
|
482 | text_issue_updated: %s Ѹ | |
483 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? |
|
483 | text_wiki_destroy_confirmation: Are you sure you want to delete this wiki and all its content ? | |
|
484 | text_issue_category_destroy_question: Some issues (%d) are assigned to this category. What do you want to do ? | |||
|
485 | text_issue_category_destroy_assignments: Remove category assignments | |||
|
486 | text_issue_category_reassign_to: Reassing issues to this category | |||
484 |
|
487 | |||
485 | default_role_manager: 管理员 |
|
488 | default_role_manager: 管理员 | |
486 | default_role_developper: 开发人员 |
|
489 | default_role_developper: 开发人员 |
General Comments 0
You need to be logged in to leave comments.
Login now