_form.rhtml

Modification of issue form - Matthew Connerton, 2010-01-12 03:51

Download (3.35 KB)

 
1
<% if @issue.new_record? %>
2
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
3
<%= observe_field :issue_tracker_id, :url => { :action => :new },
4
                                     :update => :content,
5
                                     :with => "Form.serialize('issue-form')" %>
6
<hr />
7
<% end %>
8

    
9
<div id="issue_descr_fields" <%= 'style="display:none"' unless @issue.new_record? || @issue.errors.any? %>>
10
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
11
<p><%= f.text_area :description,
12
                   :cols => 60,
13
                   :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min),
14
                   :accesskey => accesskey(:edit),
15
                   :class => 'wiki-edit' %></p>
16
</div>
17

    
18
<% role = User.current.role_for_project(@project) %>
19
  <% if role.name != "Client" %>
20
    <div class="splitcontentleft">
21
    <% if @issue.new_record? || @allowed_statuses.any? %>
22
    <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p>
23
    <% else %>
24
    <p><label><%= l(:field_status) %></label> <%= @issue.status.name %></p>
25
    <% end %>
26

    
27
    <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
28
    <p><%= f.select :assigned_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>
29
    <% unless @project.issue_categories.empty? %>
30
    <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %>
31
    <%= prompt_to_remote(l(:label_issue_category_new),
32
                         l(:label_issue_category_new), 'category[name]', 
33
                         {:controller => 'projects', :action => 'add_issue_category', :id => @project},
34
                         :class => 'small', :tabindex => 199) if authorize_for('projects', 'add_issue_category') %></p>
35
    <% end %>
36
    <%= content_tag('p', f.select(:fixed_version_id, 
37
                                  (@project.versions.sort.collect {|v| [v.name, v.id]}),
38
                                  { :include_blank => true })) unless @project.versions.empty? %>
39
    </div>
40

    
41
    <div class="splitcontentright">
42
    <p><%= f.text_field :start_date, :size => 10 %><%= calendar_for('issue_start_date') %></p>
43
    <p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('issue_due_date') %></p>
44
    <p><%= f.text_field :estimated_hours, :size => 3 %> <%= l(:field_hours) %></p>
45
    <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
46
    </div>
47
  <% end %>
48
    
49
<div style="clear:both;"> </div>
50
<%= render :partial => 'form_custom_fields' %>
51

    
52
<% if @issue.new_record? %>
53
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
54
<% end %>
55

    
56
<% if @issue.new_record? && User.current.allowed_to?(:add_issue_watchers, @project) -%>
57
<p><label><%= l(:label_issue_watchers) %></label>
58
<% @issue.project.users.sort.each do |user| -%>
59
<label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>
60
<% end -%>
61
</p>
62
<% end %>
63

    
64
<%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %>
65

    
66
<%= wikitoolbar_for 'issue_description' %>
67
<p>
68

    
69
</p>