Project

General

Profile

Require assigned_to field for tickets set default assignee

Added by Daniel N almost 14 years ago

Hi, I want the "Assigned to" field required for every ticket. Browsing source:trunk/app/views/issues/_attributes.rhtml I found that other fields like priority_id hava a parameter like {:required => true}. Is it okay to make a chnage like this to make assigned_to_id a "required" field?

<p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true, {:required => true} %></p>

As far as I understand :include_blank => true includes the "default" blank entry. Keeping this and making the field required makes no sense, does it? How do I set a another entry as default?

Does this break anything? Is there another way of making this field "required"? Thanks!


Replies (4)

RE: Require assigned_to field for tickets set default assignee - Added by Felix Schäfer almost 14 years ago

IIRC the :required parameter in the view only adds the red star to the label, and keeping the blank would be a good idea in this case, as having a default person is the same as not requiring an assignee, but instead of "issues assigned to no one", you will have loads of "issues assigned to the default user". As far as requiring an assignee, you could delve in the issue model and make the assignee mandatory by adding a corresponding validation, but I'd enjoin you to get some basic understanding of the rails inner workings before doing that.

RE: Require assigned_to field for tickets set default assignee - Added by Daniel N almost 14 years ago

Felix, thanks a lot for the helping information. Well, I thought of something quick n dirty to solve my problems - but you are totally right, changing this needs rework the workflow before diving into redmines core.

RE: Require assigned_to field for tickets set default assignee - Added by Julien Breux over 12 years ago

Require "assigned" field

Version: 1.2.1.devel

View modification(s)

Line 11 - File /app/views/issues/_attributes.rhtml

<p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => true %></p>

Model modification(s)

Line 56 - File /app/models/issues.rb

validates_presence_of :subject, :priority, :project, :tracker, :author, :status, :assigned_to_id

    (1-4/4)