Added a 'Assignable' boolean on Role model.

If unchecked, issues can not be assigned to users having this role.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@649 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-08-16 17:47:41 +00:00
parent 4cedecad4d
commit 446889b3f0
18 changed files with 36 additions and 3 deletions

View File

@ -59,6 +59,11 @@ class Issue < ActiveRecord::Base
if start_date && soonest_start && start_date < soonest_start
errors.add :start_date, :activerecord_error_invalid
end
# validate assignment
if assigned_to && !assignable_users.include?(assigned_to)
errors.add :assigned_to_id, :activerecord_error_invalid
end
end
def before_create
@ -105,6 +110,11 @@ class Issue < ActiveRecord::Base
@current_journal
end
# Users the issue can be assigned to
def assignable_users
project.members.select {|m| m.role.assignable?}.collect {|m| m.user}
end
def spent_hours
@spent_hours ||= time_entries.sum(:hours) || 0
end

View File

@ -10,7 +10,7 @@
<div class="box">
<div class="splitcontentleft">
<p><label><%=l(:label_issue_status_new)%></label> <%= @new_status.name %></p>
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
<p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
<p><%= f.select :fixed_version_id, (@project.versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true } %></p>
</div>

View File

@ -7,7 +7,7 @@
<div class="splitcontentleft">
<p><label><%=l(:field_status)%></label> <%= @issue.status.name %></p>
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
<p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
<%= prompt_to_remote(l(:label_issue_category_new),
l(:label_issue_category_new), 'category[name]',

View File

@ -9,7 +9,7 @@
<div class="splitcontentleft">
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p>
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
<p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
<%= prompt_to_remote(l(:label_issue_category_new),
l(:label_issue_category_new), 'category[name]',

View File

@ -2,6 +2,8 @@
<div class="box">
<!--[form:role]-->
<p><%= f.text_field :name, :required => true %></p>
<p><%= f.check_box :assignable %></p>
<div class="clear"></div>
<h3><%=l(:label_permissions)%></h3>
<% permissions = @permissions.group_by {|p| p.group_id } %>

View File

@ -0,0 +1,9 @@
class AddRolesAssignable < ActiveRecord::Migration
def self.up
add_column :roles, :assignable, :boolean, :default => true
end
def self.down
remove_column :roles, :assignable
end
end

View File

@ -155,6 +155,7 @@ field_identifier: Идентификатор
field_is_filter: Използва се за филтър
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Заглавие
setting_app_subtitle: Описание

View File

@ -155,6 +155,7 @@ field_identifier: Identifier
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Applikation Titel
setting_app_subtitle: Applikation Untertitel

View File

@ -155,6 +155,7 @@ field_identifier: Identifier
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Application title
setting_app_subtitle: Application subtitle

View File

@ -155,6 +155,7 @@ field_identifier: Identifier
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Título del aplicación
setting_app_subtitle: Subtítulo del aplicación

View File

@ -155,6 +155,7 @@ field_identifier: Identifiant
field_is_filter: Utilisé comme filtre
field_issue_to_id: Demande liée
field_delay: Retard
field_assignable: Demandes assignables à ce rôle
setting_app_title: Titre de l'application
setting_app_subtitle: Sous-titre de l'application

View File

@ -155,6 +155,7 @@ field_identifier: Identifier
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Titolo applicazione
setting_app_subtitle: Sottotitolo applicazione

View File

@ -156,6 +156,7 @@ field_identifier: 識別子
field_is_filter: フィルタとして使う
field_issue_to_id: 関連する問題
field_delay: 遅延
field_assignable: Issues can be assigned to this role
setting_app_title: アプリケーションのタイトル
setting_app_subtitle: アプリケーションのサブタイトル

View File

@ -155,6 +155,7 @@ field_identifier: Identificatiecode
field_is_filter: Gebruikt als een filter
field_issue_to_id: Gerelateerd issue
field_delay: Vertraging
field_assignable: Issues can be assigned to this role
setting_app_title: Applicatie titel
setting_app_subtitle: Applicatie ondertitel

View File

@ -155,6 +155,7 @@ field_identifier: Identificador
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Titulo da aplicacao
setting_app_subtitle: Sub-titulo da aplicacao

View File

@ -155,6 +155,7 @@ field_identifier: Identificador
field_is_filter: Usado como filtro
field_issue_to_id: Tarefa relacionada
field_delay: Atraso
field_assignable: Issues can be assigned to this role
setting_app_title: Título da aplicação
setting_app_subtitle: Sub-título da aplicação

View File

@ -155,6 +155,7 @@ field_identifier: Identifierare
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: Applikationstitel
setting_app_subtitle: Applicationsunderrubrik

View File

@ -158,6 +158,7 @@ field_identifier: Identifier
field_is_filter: Used as a filter
field_issue_to_id: Related issue
field_delay: Delay
field_assignable: Issues can be assigned to this role
setting_app_title: 应用程序标题
setting_app_subtitle: 应用程序子标题