@@ -283,6 +283,7 class Issue < ActiveRecord::Base | |||||
283 | 'assigned_to_id', |
|
283 | 'assigned_to_id', | |
284 | 'fixed_version_id', |
|
284 | 'fixed_version_id', | |
285 | 'done_ratio', |
|
285 | 'done_ratio', | |
|
286 | 'lock_version', | |||
286 | :if => lambda {|issue, user| issue.new_statuses_allowed_to(user).any? } |
|
287 | :if => lambda {|issue, user| issue.new_statuses_allowed_to(user).any? } | |
287 |
|
288 | |||
288 | safe_attributes 'watcher_user_ids', |
|
289 | safe_attributes 'watcher_user_ids', |
@@ -1,15 +1,21 | |||||
1 | <% labelled_fields_for :issue, @issue do |f| %> |
|
1 | <% labelled_fields_for :issue, @issue do |f| %> | |
2 |
|
2 | |||
3 | <div class="splitcontentleft"> |
|
3 | <div class="splitcontentleft"> | |
4 | <% if @issue.new_record? || @allowed_statuses.any? %> |
|
4 | <% if @issue.safe_attribute? 'status_id' %> | |
5 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> |
|
5 | <p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %></p> | |
6 | <% else %> |
|
6 | <% else %> | |
7 | <p><label><%= l(:field_status) %></label> <%= h(@issue.status.name) %></p> |
|
7 | <p><label><%= l(:field_status) %></label> <%= h(@issue.status.name) %></p> | |
8 | <% end %> |
|
8 | <% end %> | |
9 |
|
9 | |||
|
10 | <% if @issue.safe_attribute? 'priority_id' %> | |||
10 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p> |
|
11 | <p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), {:required => true}, :disabled => !@issue.leaf? %></p> | |
|
12 | <% end %> | |||
|
13 | ||||
|
14 | <% if @issue.safe_attribute? 'assigned_to_id' %> | |||
11 | <p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true %></p> |
|
15 | <p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true %></p> | |
12 | <% unless @project.issue_categories.empty? %> |
|
16 | <% end %> | |
|
17 | ||||
|
18 | <% if @issue.safe_attribute?('category_id') && @project.issue_categories.any? %> | |||
13 | <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> |
|
19 | <p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> | |
14 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), |
|
20 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), | |
15 | l(:label_issue_category_new), |
|
21 | l(:label_issue_category_new), | |
@@ -18,7 +24,8 | |||||
18 | :title => l(:label_issue_category_new), |
|
24 | :title => l(:label_issue_category_new), | |
19 | :tabindex => 199) if authorize_for('issue_categories', 'new') %></p> |
|
25 | :tabindex => 199) if authorize_for('issue_categories', 'new') %></p> | |
20 | <% end %> |
|
26 | <% end %> | |
21 | <% unless @issue.assignable_versions.empty? %> |
|
27 | ||
|
28 | <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %> | |||
22 | <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %> |
|
29 | <p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %> | |
23 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), |
|
30 | <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), | |
24 | l(:label_version_new), |
|
31 | l(:label_version_new), | |
@@ -36,15 +43,27 | |||||
36 | <div id="parent_issue_candidates" class="autocomplete"></div> |
|
43 | <div id="parent_issue_candidates" class="autocomplete"></div> | |
37 | <%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %> |
|
44 | <%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project) }')" %> | |
38 | <% end %> |
|
45 | <% end %> | |
|
46 | ||||
|
47 | <% if @issue.safe_attribute? 'start_date' %> | |||
39 | <p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p> |
|
48 | <p><%= f.text_field :start_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_start_date') if @issue.leaf? %></p> | |
|
49 | <% end %> | |||
|
50 | ||||
|
51 | <% if @issue.safe_attribute? 'due_date' %> | |||
40 | <p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p> |
|
52 | <p><%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf? %><%= calendar_for('issue_due_date') if @issue.leaf? %></p> | |
|
53 | <% end %> | |||
|
54 | ||||
|
55 | <% if @issue.safe_attribute? 'estimated_hours' %> | |||
41 | <p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf? %> <%= l(:field_hours) %></p> |
|
56 | <p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf? %> <%= l(:field_hours) %></p> | |
42 | <% if @issue.leaf? && Issue.use_field_for_done_ratio? %> |
|
57 | <% end %> | |
|
58 | ||||
|
59 | <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %> | |||
43 | <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p> |
|
60 | <p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p> | |
44 | <% end %> |
|
61 | <% end %> | |
45 | </div> |
|
62 | </div> | |
46 |
|
63 | |||
47 | <div style="clear:both;"> </div> |
|
64 | <div style="clear:both;"> </div> | |
|
65 | <% if @issue.safe_attribute? 'custom_field_values' %> | |||
48 | <%= render :partial => 'issues/form_custom_fields' %> |
|
66 | <%= render :partial => 'issues/form_custom_fields' %> | |
|
67 | <% end %> | |||
49 |
|
68 | |||
50 | <% end %> |
|
69 | <% end %> |
@@ -3,7 +3,7 | |||||
3 | <div class="box"> |
|
3 | <div class="box"> | |
4 | <% if @edit_allowed || !@allowed_statuses.empty? %> |
|
4 | <% if @edit_allowed || !@allowed_statuses.empty? %> | |
5 | <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend> |
|
5 | <fieldset class="tabular"><legend><%= l(:label_change_properties) %></legend> | |
6 |
<%= render :partial => |
|
6 | <%= render :partial => 'form', :locals => {:f => f} %> | |
7 | </fieldset> |
|
7 | </fieldset> | |
8 | <% end %> |
|
8 | <% end %> | |
9 | <% if User.current.allowed_to?(:log_time, @project) %> |
|
9 | <% if User.current.allowed_to?(:log_time, @project) %> |
@@ -5,12 +5,19 | |||||
5 | <label class="inline" for="issue_is_private" id="issue_is_private_label"><%= f.check_box :is_private, :no_label => true %> <%= l(:field_is_private) %></label> |
|
5 | <label class="inline" for="issue_is_private" id="issue_is_private_label"><%= f.check_box :is_private, :no_label => true %> <%= l(:field_is_private) %></label> | |
6 | </p> |
|
6 | </p> | |
7 | <% end %> |
|
7 | <% end %> | |
|
8 | ||||
|
9 | <% if @issue.safe_attribute? 'tracker_id' %> | |||
8 | <p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p> |
|
10 | <p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p> | |
9 | <%= observe_field :issue_tracker_id, :url => project_issue_form_path(@project, :id => @issue), |
|
11 | <%= observe_field :issue_tracker_id, :url => project_issue_form_path(@project, :id => @issue), | |
10 | :update => :attributes, |
|
12 | :update => :attributes, | |
11 | :with => "Form.serialize('issue-form')" %> |
|
13 | :with => "Form.serialize('issue-form')" %> | |
|
14 | <% end %> | |||
12 |
|
15 | |||
|
16 | <% if @issue.safe_attribute? 'subject' %> | |||
13 | <p><%= f.text_field :subject, :size => 80, :required => true %></p> |
|
17 | <p><%= f.text_field :subject, :size => 80, :required => true %></p> | |
|
18 | <% end %> | |||
|
19 | ||||
|
20 | <% if @issue.safe_attribute? 'description' %> | |||
14 | <p> |
|
21 | <p> | |
15 | <label><%= l(:field_description) %></label> |
|
22 | <label><%= l(:field_description) %></label> | |
16 | <%= link_to_function image_tag('edit.png'), |
|
23 | <%= link_to_function image_tag('edit.png'), | |
@@ -24,11 +31,11 | |||||
24 | :no_label => true %> |
|
31 | :no_label => true %> | |
25 | <% end %> |
|
32 | <% end %> | |
26 | </p> |
|
33 | </p> | |
|
34 | <%= wikitoolbar_for 'issue_description' %> | |||
|
35 | <% end %> | |||
27 |
|
36 | |||
28 | <div id="attributes" class="attributes"> |
|
37 | <div id="attributes" class="attributes"> | |
29 | <%= render :partial => 'issues/attributes' %> |
|
38 | <%= render :partial => 'issues/attributes' %> | |
30 | </div> |
|
39 | </div> | |
31 |
|
40 | |||
32 | <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %> |
|
41 | <%= call_hook(:view_issues_form_details_bottom, { :issue => @issue, :form => f }) %> | |
33 |
|
||||
34 | <%= wikitoolbar_for 'issue_description' %> |
|
@@ -714,6 +714,93 class IssuesControllerTest < ActionController::TestCase | |||||
714 | :content => /Notes/ } } |
|
714 | :content => /Notes/ } } | |
715 | end |
|
715 | end | |
716 |
|
716 | |||
|
717 | def test_show_should_display_update_form | |||
|
718 | @request.session[:user_id] = 2 | |||
|
719 | get :show, :id => 1 | |||
|
720 | assert_response :success | |||
|
721 | ||||
|
722 | assert_tag 'form', :attributes => {:id => 'issue-form'} | |||
|
723 | assert_tag 'input', :attributes => {:name => 'issue[is_private]'} | |||
|
724 | assert_tag 'select', :attributes => {:name => 'issue[tracker_id]'} | |||
|
725 | assert_tag 'input', :attributes => {:name => 'issue[subject]'} | |||
|
726 | assert_tag 'textarea', :attributes => {:name => 'issue[description]'} | |||
|
727 | assert_tag 'select', :attributes => {:name => 'issue[status_id]'} | |||
|
728 | assert_tag 'select', :attributes => {:name => 'issue[priority_id]'} | |||
|
729 | assert_tag 'select', :attributes => {:name => 'issue[assigned_to_id]'} | |||
|
730 | assert_tag 'select', :attributes => {:name => 'issue[category_id]'} | |||
|
731 | assert_tag 'select', :attributes => {:name => 'issue[fixed_version_id]'} | |||
|
732 | assert_tag 'input', :attributes => {:name => 'issue[parent_issue_id]'} | |||
|
733 | assert_tag 'input', :attributes => {:name => 'issue[start_date]'} | |||
|
734 | assert_tag 'input', :attributes => {:name => 'issue[due_date]'} | |||
|
735 | assert_tag 'select', :attributes => {:name => 'issue[done_ratio]'} | |||
|
736 | assert_tag 'input', :attributes => { :name => 'issue[custom_field_values][2]' } | |||
|
737 | assert_no_tag 'input', :attributes => {:name => 'issue[watcher_user_ids][]'} | |||
|
738 | assert_tag 'textarea', :attributes => {:name => 'notes'} | |||
|
739 | end | |||
|
740 | ||||
|
741 | def test_show_should_display_update_form_with_minimal_permissions | |||
|
742 | Role.find(1).update_attribute :permissions, [:view_issues, :add_issue_notes] | |||
|
743 | Workflow.delete_all :role_id => 1 | |||
|
744 | ||||
|
745 | @request.session[:user_id] = 2 | |||
|
746 | get :show, :id => 1 | |||
|
747 | assert_response :success | |||
|
748 | ||||
|
749 | assert_tag 'form', :attributes => {:id => 'issue-form'} | |||
|
750 | assert_no_tag 'input', :attributes => {:name => 'issue[is_private]'} | |||
|
751 | assert_no_tag 'select', :attributes => {:name => 'issue[tracker_id]'} | |||
|
752 | assert_no_tag 'input', :attributes => {:name => 'issue[subject]'} | |||
|
753 | assert_no_tag 'textarea', :attributes => {:name => 'issue[description]'} | |||
|
754 | assert_no_tag 'select', :attributes => {:name => 'issue[status_id]'} | |||
|
755 | assert_no_tag 'select', :attributes => {:name => 'issue[priority_id]'} | |||
|
756 | assert_no_tag 'select', :attributes => {:name => 'issue[assigned_to_id]'} | |||
|
757 | assert_no_tag 'select', :attributes => {:name => 'issue[category_id]'} | |||
|
758 | assert_no_tag 'select', :attributes => {:name => 'issue[fixed_version_id]'} | |||
|
759 | assert_no_tag 'input', :attributes => {:name => 'issue[parent_issue_id]'} | |||
|
760 | assert_no_tag 'input', :attributes => {:name => 'issue[start_date]'} | |||
|
761 | assert_no_tag 'input', :attributes => {:name => 'issue[due_date]'} | |||
|
762 | assert_no_tag 'select', :attributes => {:name => 'issue[done_ratio]'} | |||
|
763 | assert_no_tag 'input', :attributes => { :name => 'issue[custom_field_values][2]' } | |||
|
764 | assert_no_tag 'input', :attributes => {:name => 'issue[watcher_user_ids][]'} | |||
|
765 | assert_tag 'textarea', :attributes => {:name => 'notes'} | |||
|
766 | end | |||
|
767 | ||||
|
768 | def test_show_should_display_update_form_with_workflow_permissions | |||
|
769 | Role.find(1).update_attribute :permissions, [:view_issues, :add_issue_notes] | |||
|
770 | ||||
|
771 | @request.session[:user_id] = 2 | |||
|
772 | get :show, :id => 1 | |||
|
773 | assert_response :success | |||
|
774 | ||||
|
775 | assert_tag 'form', :attributes => {:id => 'issue-form'} | |||
|
776 | assert_no_tag 'input', :attributes => {:name => 'issue[is_private]'} | |||
|
777 | assert_no_tag 'select', :attributes => {:name => 'issue[tracker_id]'} | |||
|
778 | assert_no_tag 'input', :attributes => {:name => 'issue[subject]'} | |||
|
779 | assert_no_tag 'textarea', :attributes => {:name => 'issue[description]'} | |||
|
780 | assert_tag 'select', :attributes => {:name => 'issue[status_id]'} | |||
|
781 | assert_no_tag 'select', :attributes => {:name => 'issue[priority_id]'} | |||
|
782 | assert_tag 'select', :attributes => {:name => 'issue[assigned_to_id]'} | |||
|
783 | assert_no_tag 'select', :attributes => {:name => 'issue[category_id]'} | |||
|
784 | assert_tag 'select', :attributes => {:name => 'issue[fixed_version_id]'} | |||
|
785 | assert_no_tag 'input', :attributes => {:name => 'issue[parent_issue_id]'} | |||
|
786 | assert_no_tag 'input', :attributes => {:name => 'issue[start_date]'} | |||
|
787 | assert_no_tag 'input', :attributes => {:name => 'issue[due_date]'} | |||
|
788 | assert_tag 'select', :attributes => {:name => 'issue[done_ratio]'} | |||
|
789 | assert_no_tag 'input', :attributes => { :name => 'issue[custom_field_values][2]' } | |||
|
790 | assert_no_tag 'input', :attributes => {:name => 'issue[watcher_user_ids][]'} | |||
|
791 | assert_tag 'textarea', :attributes => {:name => 'notes'} | |||
|
792 | end | |||
|
793 | ||||
|
794 | def test_show_should_not_display_update_form_without_permissions | |||
|
795 | Role.find(1).update_attribute :permissions, [:view_issues] | |||
|
796 | ||||
|
797 | @request.session[:user_id] = 2 | |||
|
798 | get :show, :id => 1 | |||
|
799 | assert_response :success | |||
|
800 | ||||
|
801 | assert_no_tag 'form', :attributes => {:id => 'issue-form'} | |||
|
802 | end | |||
|
803 | ||||
717 | def test_update_form_should_not_display_inactive_enumerations |
|
804 | def test_update_form_should_not_display_inactive_enumerations | |
718 | @request.session[:user_id] = 2 |
|
805 | @request.session[:user_id] = 2 | |
719 | get :show, :id => 1 |
|
806 | get :show, :id => 1 | |
@@ -855,8 +942,21 class IssuesControllerTest < ActionController::TestCase | |||||
855 | assert_response :success |
|
942 | assert_response :success | |
856 | assert_template 'new' |
|
943 | assert_template 'new' | |
857 |
|
944 | |||
858 |
assert_tag |
|
945 | assert_tag 'input', :attributes => {:name => 'issue[is_private]'} | |
859 | :value => 'Default string' } |
|
946 | assert_tag 'select', :attributes => {:name => 'issue[tracker_id]'} | |
|
947 | assert_tag 'input', :attributes => {:name => 'issue[subject]'} | |||
|
948 | assert_tag 'textarea', :attributes => {:name => 'issue[description]'} | |||
|
949 | assert_tag 'select', :attributes => {:name => 'issue[status_id]'} | |||
|
950 | assert_tag 'select', :attributes => {:name => 'issue[priority_id]'} | |||
|
951 | assert_tag 'select', :attributes => {:name => 'issue[assigned_to_id]'} | |||
|
952 | assert_tag 'select', :attributes => {:name => 'issue[category_id]'} | |||
|
953 | assert_tag 'select', :attributes => {:name => 'issue[fixed_version_id]'} | |||
|
954 | assert_tag 'input', :attributes => {:name => 'issue[parent_issue_id]'} | |||
|
955 | assert_tag 'input', :attributes => {:name => 'issue[start_date]'} | |||
|
956 | assert_tag 'input', :attributes => {:name => 'issue[due_date]'} | |||
|
957 | assert_tag 'select', :attributes => {:name => 'issue[done_ratio]'} | |||
|
958 | assert_tag 'input', :attributes => { :name => 'issue[custom_field_values][2]', :value => 'Default string' } | |||
|
959 | assert_tag 'input', :attributes => {:name => 'issue[watcher_user_ids][]'} | |||
860 |
|
960 | |||
861 | # Be sure we don't display inactive IssuePriorities |
|
961 | # Be sure we don't display inactive IssuePriorities | |
862 | assert ! IssuePriority.find(15).active? |
|
962 | assert ! IssuePriority.find(15).active? | |
@@ -864,6 +964,32 class IssuesControllerTest < ActionController::TestCase | |||||
864 | :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } |
|
964 | :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } | |
865 | end |
|
965 | end | |
866 |
|
966 | |||
|
967 | def test_get_new_with_minimal_permissions | |||
|
968 | Role.find(1).update_attribute :permissions, [:add_issues] | |||
|
969 | Workflow.delete_all :role_id => 1 | |||
|
970 | ||||
|
971 | @request.session[:user_id] = 2 | |||
|
972 | get :new, :project_id => 1, :tracker_id => 1 | |||
|
973 | assert_response :success | |||
|
974 | assert_template 'new' | |||
|
975 | ||||
|
976 | assert_no_tag 'input', :attributes => {:name => 'issue[is_private]'} | |||
|
977 | assert_tag 'select', :attributes => {:name => 'issue[tracker_id]'} | |||
|
978 | assert_tag 'input', :attributes => {:name => 'issue[subject]'} | |||
|
979 | assert_tag 'textarea', :attributes => {:name => 'issue[description]'} | |||
|
980 | assert_tag 'select', :attributes => {:name => 'issue[status_id]'} | |||
|
981 | assert_tag 'select', :attributes => {:name => 'issue[priority_id]'} | |||
|
982 | assert_tag 'select', :attributes => {:name => 'issue[assigned_to_id]'} | |||
|
983 | assert_tag 'select', :attributes => {:name => 'issue[category_id]'} | |||
|
984 | assert_tag 'select', :attributes => {:name => 'issue[fixed_version_id]'} | |||
|
985 | assert_no_tag 'input', :attributes => {:name => 'issue[parent_issue_id]'} | |||
|
986 | assert_tag 'input', :attributes => {:name => 'issue[start_date]'} | |||
|
987 | assert_tag 'input', :attributes => {:name => 'issue[due_date]'} | |||
|
988 | assert_tag 'select', :attributes => {:name => 'issue[done_ratio]'} | |||
|
989 | assert_tag 'input', :attributes => { :name => 'issue[custom_field_values][2]', :value => 'Default string' } | |||
|
990 | assert_no_tag 'input', :attributes => {:name => 'issue[watcher_user_ids][]'} | |||
|
991 | end | |||
|
992 | ||||
867 | def test_get_new_without_default_start_date_is_creation_date |
|
993 | def test_get_new_without_default_start_date_is_creation_date | |
868 | Setting.default_issue_start_date_to_creation_date = 0 |
|
994 | Setting.default_issue_start_date_to_creation_date = 0 | |
869 |
|
995 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now