##// END OF EJS Templates
Option for long text custom fields to be displayed under the description field (#21705)....
Jean-Philippe Lang -
r15869:b40d66f39fa8
parent child
Show More
@@ -239,8 +239,8 module IssuesHelper
239 r.to_html
239 r.to_html
240 end
240 end
241
241
242 def render_custom_fields_rows(issue)
242 def render_half_width_custom_fields_rows(issue)
243 values = issue.visible_custom_field_values
243 values = issue.visible_custom_field_values.reject {|value| value.custom_field.full_width_layout?}
244 return if values.empty?
244 return if values.empty?
245 half = (values.size / 2.0).ceil
245 half = (values.size / 2.0).ceil
246 issue_fields_rows do |rows|
246 issue_fields_rows do |rows|
@@ -252,6 +252,26 module IssuesHelper
252 end
252 end
253 end
253 end
254
254
255 def render_full_width_custom_fields_rows(issue)
256 values = issue.visible_custom_field_values.select {|value| value.custom_field.full_width_layout?}
257 return if values.empty?
258
259 s = ''
260 values.each_with_index do |value, i|
261 if value.custom_field.text_formatting == 'full'
262 attr_value = content_tag('div', show_value(value), class: 'wiki')
263 else
264 attr_value = show_value(value)
265 end
266 content =
267 content_tag('hr') +
268 content_tag('p', content_tag('strong', custom_field_name_tag(value.custom_field) )) +
269 content_tag('div', attr_value, class: 'value')
270 s << content_tag('div', content, class: "cf_#{value.custom_field.id} attribute")
271 end
272 s.html_safe
273 end
274
255 # Returns the path for updating the issue form
275 # Returns the path for updating the issue form
256 # with project as the current project
276 # with project as the current project
257 def update_issue_form_path(project, issue)
277 def update_issue_form_path(project, issue)
@@ -89,7 +89,8 class CustomField < ActiveRecord::Base
89 'edit_tag_style',
89 'edit_tag_style',
90 'user_role',
90 'user_role',
91 'version_status',
91 'version_status',
92 'extensions_allowed'
92 'extensions_allowed',
93 'full_width_layout'
93
94
94 def format
95 def format
95 @format ||= Redmine::FieldFormat.find(field_format)
96 @format ||= Redmine::FieldFormat.find(field_format)
@@ -186,6 +187,10 class CustomField < ActiveRecord::Base
186 format.totalable_supported
187 format.totalable_supported
187 end
188 end
188
189
190 def full_width_layout?
191 full_width_layout == '1'
192 end
193
189 # Returns a ORDER BY clause that can used to sort customized
194 # Returns a ORDER BY clause that can used to sort customized
190 # objects by their value of the custom field.
195 # objects by their value of the custom field.
191 # Returns nil if the custom field can not be used for sorting.
196 # Returns nil if the custom field can not be used for sorting.
@@ -1,3 +1,6
1 <%= render :partial => 'custom_fields/formats/regexp', :locals => {:f => f, :custom_field => custom_field} %>
1 <%= render :partial => 'custom_fields/formats/regexp', :locals => {:f => f, :custom_field => custom_field} %>
2 <p><%= f.check_box :text_formatting, {:label => :setting_text_formatting}, 'full', '' %></p>
2 <p><%= f.check_box :text_formatting, {:label => :setting_text_formatting}, 'full', '' %></p>
3 <% if @custom_field.class.name == "IssueCustomField" %>
4 <p><%= f.check_box :full_width_layout %></p>
5 <% end %>
3 <p><%= f.text_area(:default_value, :rows => 5) %></p>
6 <p><%= f.text_area(:default_value, :rows => 5) %></p>
@@ -1,4 +1,7
1 <% custom_field_values = @issue.editable_custom_field_values %>
1 <% custom_field_values = @issue.editable_custom_field_values %>
2 <% custom_field_values_full_width = custom_field_values.select { |value| value.custom_field.full_width_layout? } %>
3 <% custom_field_values -= custom_field_values_full_width %>
4
2 <% if custom_field_values.present? %>
5 <% if custom_field_values.present? %>
3 <div class="splitcontent">
6 <div class="splitcontent">
4 <div class="splitcontentleft">
7 <div class="splitcontentleft">
@@ -14,3 +17,7
14 </div>
17 </div>
15 </div>
18 </div>
16 <% end %>
19 <% end %>
20
21 <% custom_field_values_full_width.each do |value| %>
22 <p><%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %></p>
23 <% end %>
@@ -66,7 +66,7
66 end
66 end
67 end
67 end
68 end %>
68 end %>
69 <%= render_custom_fields_rows(@issue) %>
69 <%= render_half_width_custom_fields_rows(@issue) %>
70 <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
70 <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
71 </div>
71 </div>
72
72
@@ -87,6 +87,8 end %>
87 <%= link_to_attachments @issue, :thumbnails => true %>
87 <%= link_to_attachments @issue, :thumbnails => true %>
88 <% end -%>
88 <% end -%>
89
89
90 <%= render_full_width_custom_fields_rows(@issue) %>
91
90 <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
92 <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
91
93
92 <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
94 <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
@@ -372,6 +372,7 en:
372 field_textarea_font: Font used for text areas
372 field_textarea_font: Font used for text areas
373 field_updated_by: Updated by
373 field_updated_by: Updated by
374 field_last_updated_by: Last updated by
374 field_last_updated_by: Last updated by
375 field_full_width_layout: Full width layout
375
376
376 setting_app_title: Application title
377 setting_app_title: Application title
377 setting_app_subtitle: Application subtitle
378 setting_app_subtitle: Application subtitle
@@ -384,6 +384,7 fr:
384 field_textarea_font: Police utilisΓ©e pour les champs texte
384 field_textarea_font: Police utilisΓ©e pour les champs texte
385 field_updated_by: Mise Γ  jour par
385 field_updated_by: Mise Γ  jour par
386 field_last_updated_by: Dernière mise à jour par
386 field_last_updated_by: Dernière mise à jour par
387 field_full_width_layout: Afficher sur toute la largeur
387
388
388 setting_app_title: Titre de l'application
389 setting_app_title: Titre de l'application
389 setting_app_subtitle: Sous-titre de l'application
390 setting_app_subtitle: Sous-titre de l'application
@@ -108,7 +108,7 module Redmine
108 CustomField.store_accessor :format_store, *args
108 CustomField.store_accessor :format_store, *args
109 end
109 end
110
110
111 field_attributes :url_pattern
111 field_attributes :url_pattern, :full_width_layout
112
112
113 def name
113 def name
114 self.class.format_name
114 self.class.format_name
@@ -463,8 +463,8 div.issue div.subject h3 {margin: 0; margin-bottom: 0.1em;}
463 div.issue span.private, div.journal span.private { position:relative; bottom: 2px; text-transform: uppercase; background: #d22; color: #fff; font-weight:bold; padding: 0px 2px 0px 2px; font-size: 60%; margin-right: 2px; border-radius: 2px;}
463 div.issue span.private, div.journal span.private { position:relative; bottom: 2px; text-transform: uppercase; background: #d22; color: #fff; font-weight:bold; padding: 0px 2px 0px 2px; font-size: 60%; margin-right: 2px; border-radius: 2px;}
464 div.issue .next-prev-links {color:#999;}
464 div.issue .next-prev-links {color:#999;}
465 div.issue .attributes {margin-top: 2em;}
465 div.issue .attributes {margin-top: 2em;}
466 div.issue .attribute {padding-left:180px; clear:left; min-height: 1.8em;}
466 div.issue .attributes .attribute {padding-left:180px; clear:left; min-height: 1.8em;}
467 div.issue .attribute .label {width: 170px; margin-left:-180px; font-weight:bold; float:left; overflow:hidden; text-overflow: ellipsis;}
467 div.issue .attributes .attribute .label {width: 170px; margin-left:-180px; font-weight:bold; float:left; overflow:hidden; text-overflow: ellipsis;}
468 div.issue .attribute .value {overflow:hidden; text-overflow: ellipsis;}
468 div.issue .attribute .value {overflow:hidden; text-overflow: ellipsis;}
469 div.issue.overdue .due-date .value { color: #c22; }
469 div.issue.overdue .due-date .value { color: #c22; }
470
470
@@ -126,6 +126,20 class CustomFieldsControllerTest < Redmine::ControllerTest
126 assert_select '[name=?]', 'custom_field[default_value]', 0
126 assert_select '[name=?]', 'custom_field[default_value]', 0
127 end
127 end
128
128
129 def test_setting_full_width_layout_shoul_be_present_only_for_long_text_issue_custom_field
130 get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'text'}
131 assert_response :success
132 assert_select '[name=?]', 'custom_field[full_width_layout]'
133
134 get :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}
135 assert_response :success
136 assert_select '[name=?]', 'custom_field[full_width_layout]', 0
137
138 get :new, :type => 'TimeEntryCustomField', :custom_field => {:field_format => 'text'}
139 assert_response :success
140 assert_select '[name=?]', 'custom_field[full_width_layout]', 0
141 end
142
129 def test_new_js
143 def test_new_js
130 xhr :get, :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js'
144 xhr :get, :new, :type => 'IssueCustomField', :custom_field => {:field_format => 'list'}, :format => 'js'
131 assert_response :success
145 assert_response :success
@@ -561,8 +561,8 class IssuesControllerTest < Redmine::ControllerTest
561 str_big5 = "\xa4@\xa4\xeb".force_encoding('Big5')
561 str_big5 = "\xa4@\xa4\xeb".force_encoding('Big5')
562 issue = Issue.generate!(:subject => str_utf8)
562 issue = Issue.generate!(:subject => str_utf8)
563
563
564 get :index, :project_id => 1,
564 get :index, :project_id => 1,
565 :f => ['subject'],
565 :f => ['subject'],
566 :op => '=', :values => [str_utf8],
566 :op => '=', :values => [str_utf8],
567 :format => 'csv'
567 :format => 'csv'
568 assert_equal 'text/csv; header=present', @response.content_type
568 assert_equal 'text/csv; header=present', @response.content_type
@@ -580,8 +580,8 class IssuesControllerTest < Redmine::ControllerTest
580 str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85".force_encoding('UTF-8')
580 str_utf8 = "\xe4\xbb\xa5\xe5\x86\x85".force_encoding('UTF-8')
581 issue = Issue.generate!(:subject => str_utf8)
581 issue = Issue.generate!(:subject => str_utf8)
582
582
583 get :index, :project_id => 1,
583 get :index, :project_id => 1,
584 :f => ['subject'],
584 :f => ['subject'],
585 :op => '=', :values => [str_utf8],
585 :op => '=', :values => [str_utf8],
586 :c => ['status', 'subject'],
586 :c => ['status', 'subject'],
587 :format => 'csv',
587 :format => 'csv',
@@ -603,8 +603,8 class IssuesControllerTest < Redmine::ControllerTest
603 str1 = "test_index_csv_tw"
603 str1 = "test_index_csv_tw"
604 issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
604 issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
605
605
606 get :index, :project_id => 1,
606 get :index, :project_id => 1,
607 :f => ['subject'],
607 :f => ['subject'],
608 :op => '=', :values => [str1],
608 :op => '=', :values => [str1],
609 :c => ['estimated_hours', 'subject'],
609 :c => ['estimated_hours', 'subject'],
610 :format => 'csv',
610 :format => 'csv',
@@ -620,8 +620,8 class IssuesControllerTest < Redmine::ControllerTest
620 str1 = "test_index_csv_fr"
620 str1 = "test_index_csv_fr"
621 issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
621 issue = Issue.generate!(:subject => str1, :estimated_hours => '1234.5')
622
622
623 get :index, :project_id => 1,
623 get :index, :project_id => 1,
624 :f => ['subject'],
624 :f => ['subject'],
625 :op => '=', :values => [str1],
625 :op => '=', :values => [str1],
626 :c => ['estimated_hours', 'subject'],
626 :c => ['estimated_hours', 'subject'],
627 :format => 'csv',
627 :format => 'csv',
@@ -696,34 +696,34 class IssuesControllerTest < Redmine::ControllerTest
696 assert_response :success
696 assert_response :success
697 end
697 end
698 end
698 end
699
699
700 def test_index_sort_by_assigned_to
700 def test_index_sort_by_assigned_to
701 get :index, :sort => 'assigned_to'
701 get :index, :sort => 'assigned_to'
702 assert_response :success
702 assert_response :success
703
703
704 assignees = issues_in_list.map(&:assigned_to).compact
704 assignees = issues_in_list.map(&:assigned_to).compact
705 assert_equal assignees.sort, assignees
705 assert_equal assignees.sort, assignees
706 assert_select 'table.issues.sort-by-assigned-to.sort-asc'
706 assert_select 'table.issues.sort-by-assigned-to.sort-asc'
707 end
707 end
708
708
709 def test_index_sort_by_assigned_to_desc
709 def test_index_sort_by_assigned_to_desc
710 get :index, :sort => 'assigned_to:desc'
710 get :index, :sort => 'assigned_to:desc'
711 assert_response :success
711 assert_response :success
712
712
713 assignees = issues_in_list.map(&:assigned_to).compact
713 assignees = issues_in_list.map(&:assigned_to).compact
714 assert_equal assignees.sort.reverse, assignees
714 assert_equal assignees.sort.reverse, assignees
715 assert_select 'table.issues.sort-by-assigned-to.sort-desc'
715 assert_select 'table.issues.sort-by-assigned-to.sort-desc'
716 end
716 end
717
717
718 def test_index_group_by_assigned_to
718 def test_index_group_by_assigned_to
719 get :index, :group_by => 'assigned_to', :sort => 'priority'
719 get :index, :group_by => 'assigned_to', :sort => 'priority'
720 assert_response :success
720 assert_response :success
721 end
721 end
722
722
723 def test_index_sort_by_author
723 def test_index_sort_by_author
724 get :index, :sort => 'author', :c => ['author']
724 get :index, :sort => 'author', :c => ['author']
725 assert_response :success
725 assert_response :success
726
726
727 authors = issues_in_list.map(&:author)
727 authors = issues_in_list.map(&:author)
728 assert_equal authors.sort, authors
728 assert_equal authors.sort, authors
729 end
729 end
@@ -731,30 +731,30 class IssuesControllerTest < Redmine::ControllerTest
731 def test_index_sort_by_author_desc
731 def test_index_sort_by_author_desc
732 get :index, :sort => 'author:desc'
732 get :index, :sort => 'author:desc'
733 assert_response :success
733 assert_response :success
734
734
735 authors = issues_in_list.map(&:author)
735 authors = issues_in_list.map(&:author)
736 assert_equal authors.sort.reverse, authors
736 assert_equal authors.sort.reverse, authors
737 end
737 end
738
738
739 def test_index_group_by_author
739 def test_index_group_by_author
740 get :index, :group_by => 'author', :sort => 'priority'
740 get :index, :group_by => 'author', :sort => 'priority'
741 assert_response :success
741 assert_response :success
742 end
742 end
743
743
744 def test_index_sort_by_spent_hours
744 def test_index_sort_by_spent_hours
745 get :index, :sort => 'spent_hours:desc'
745 get :index, :sort => 'spent_hours:desc'
746 assert_response :success
746 assert_response :success
747 hours = issues_in_list.map(&:spent_hours)
747 hours = issues_in_list.map(&:spent_hours)
748 assert_equal hours.sort.reverse, hours
748 assert_equal hours.sort.reverse, hours
749 end
749 end
750
750
751 def test_index_sort_by_total_spent_hours
751 def test_index_sort_by_total_spent_hours
752 get :index, :sort => 'total_spent_hours:desc'
752 get :index, :sort => 'total_spent_hours:desc'
753 assert_response :success
753 assert_response :success
754 hours = issues_in_list.map(&:total_spent_hours)
754 hours = issues_in_list.map(&:total_spent_hours)
755 assert_equal hours.sort.reverse, hours
755 assert_equal hours.sort.reverse, hours
756 end
756 end
757
757
758 def test_index_sort_by_total_estimated_hours
758 def test_index_sort_by_total_estimated_hours
759 get :index, :sort => 'total_estimated_hours:desc'
759 get :index, :sort => 'total_estimated_hours:desc'
760 assert_response :success
760 assert_response :success
@@ -1093,7 +1093,7 class IssuesControllerTest < Redmine::ControllerTest
1093 def test_index_should_not_include_new_issue_tab_for_project_without_trackers
1093 def test_index_should_not_include_new_issue_tab_for_project_without_trackers
1094 with_settings :new_item_menu_tab => '1' do
1094 with_settings :new_item_menu_tab => '1' do
1095 Project.find(1).trackers.clear
1095 Project.find(1).trackers.clear
1096
1096
1097 @request.session[:user_id] = 2
1097 @request.session[:user_id] = 2
1098 get :index, :project_id => 1
1098 get :index, :project_id => 1
1099 assert_select '#main-menu a.new-issue', 0
1099 assert_select '#main-menu a.new-issue', 0
@@ -1105,7 +1105,7 class IssuesControllerTest < Redmine::ControllerTest
1105 role = Role.find(1)
1105 role = Role.find(1)
1106 role.remove_permission! :add_issues
1106 role.remove_permission! :add_issues
1107 role.add_permission! :copy_issues
1107 role.add_permission! :copy_issues
1108
1108
1109 @request.session[:user_id] = 2
1109 @request.session[:user_id] = 2
1110 get :index, :project_id => 1
1110 get :index, :project_id => 1
1111 assert_select '#main-menu a.new-issue', 0
1111 assert_select '#main-menu a.new-issue', 0
@@ -1381,7 +1381,7 class IssuesControllerTest < Redmine::ControllerTest
1381
1381
1382 def test_show_should_display_prev_next_links_with_query_and_sort_on_association
1382 def test_show_should_display_prev_next_links_with_query_and_sort_on_association
1383 @request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => nil}
1383 @request.session[:issue_query] = {:filters => {'status_id' => {:values => [''], :operator => 'o'}}, :project_id => nil}
1384
1384
1385 %w(project tracker status priority author assigned_to category fixed_version).each do |assoc_sort|
1385 %w(project tracker status priority author assigned_to category fixed_version).each do |assoc_sort|
1386 @request.session['issues_index_sort'] = assoc_sort
1386 @request.session['issues_index_sort'] = assoc_sort
1387
1387
@@ -1575,6 +1575,25 class IssuesControllerTest < Redmine::ControllerTest
1575 assert_select ".cf_1 .value", :text => 'MySQL, Oracle'
1575 assert_select ".cf_1 .value", :text => 'MySQL, Oracle'
1576 end
1576 end
1577
1577
1578 def test_show_with_full_width_layout_custom_field_should_show_field_under_description
1579 field = IssueCustomField.create!(:name => 'Long text', :field_format => 'text', :full_width_layout => '1',
1580 :tracker_ids => [1], :is_for_all => true)
1581 issue = Issue.find(1)
1582 issue.custom_field_values = {field.id => 'This is a long text'}
1583 issue.save!
1584
1585 get :show, :id => 1
1586 assert_response :success
1587
1588 # long text custom field should not be render in the attributes div
1589 assert_select "div.attributes div.attribute.cf_#{field.id} p strong", 0, :text => 'Long text'
1590 assert_select "div.attributes div.attribute.cf_#{field.id} div.value", 0, :text => 'This is a long text'
1591
1592 # long text custom field should be render under description field
1593 assert_select "div.description ~ div.attribute.cf_#{field.id} p strong", :text => 'Long text'
1594 assert_select "div.description ~ div.attribute.cf_#{field.id} div.value", :text => 'This is a long text'
1595 end
1596
1578 def test_show_with_multi_user_custom_field
1597 def test_show_with_multi_user_custom_field
1579 field = IssueCustomField.create!(:name => 'Multi user', :field_format => 'user', :multiple => true,
1598 field = IssueCustomField.create!(:name => 'Multi user', :field_format => 'user', :multiple => true,
1580 :tracker_ids => [1], :is_for_all => true)
1599 :tracker_ids => [1], :is_for_all => true)
@@ -1628,7 +1647,7 class IssuesControllerTest < Redmine::ControllerTest
1628 end
1647 end
1629
1648
1630 def test_show_export_to_pdf
1649 def test_show_export_to_pdf
1631 issue = Issue.find(3)
1650 issue = Issue.find(3)
1632 assert issue.relations.select{|r| r.other_issue(issue).visible?}.present?
1651 assert issue.relations.select{|r| r.other_issue(issue).visible?}.present?
1633 get :show, :id => 3, :format => 'pdf'
1652 get :show, :id => 3, :format => 'pdf'
1634 assert_response :success
1653 assert_response :success
@@ -2076,7 +2095,7 class IssuesControllerTest < Redmine::ControllerTest
2076 get :new, :project_id => 'invalid'
2095 get :new, :project_id => 'invalid'
2077 assert_response 404
2096 assert_response 404
2078 end
2097 end
2079
2098
2080 def test_new_with_parent_id_should_only_propose_valid_trackers
2099 def test_new_with_parent_id_should_only_propose_valid_trackers
2081 @request.session[:user_id] = 2
2100 @request.session[:user_id] = 2
2082 t = Tracker.find(3)
2101 t = Tracker.find(3)
@@ -2625,7 +2644,7 class IssuesControllerTest < Redmine::ControllerTest
2625 :custom_field_values => {'2' => 'Value for field 2'}}
2644 :custom_field_values => {'2' => 'Value for field 2'}}
2626 end
2645 end
2627 assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
2646 assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
2628
2647
2629 assert_equal 1, ActionMailer::Base.deliveries.size
2648 assert_equal 1, ActionMailer::Base.deliveries.size
2630 end
2649 end
2631 end
2650 end
@@ -2899,7 +2918,7 class IssuesControllerTest < Redmine::ControllerTest
2899 assert_select 'option[value="1"][selected=selected]', :text => 'eCookbook'
2918 assert_select 'option[value="1"][selected=selected]', :text => 'eCookbook'
2900 assert_select 'option[value="2"]:not([selected])', :text => 'OnlineStore'
2919 assert_select 'option[value="2"]:not([selected])', :text => 'OnlineStore'
2901 end
2920 end
2902 assert_select 'input[name=?][value=?]', 'issue[subject]', orig.subject
2921 assert_select 'input[name=?][value=?]', 'issue[subject]', orig.subject
2903 assert_select 'input[name=copy_from][value="1"]'
2922 assert_select 'input[name=copy_from][value="1"]'
2904 end
2923 end
2905 end
2924 end
@@ -3194,7 +3213,7 class IssuesControllerTest < Redmine::ControllerTest
3194 def test_get_edit_should_display_the_time_entry_form_with_log_time_permission
3213 def test_get_edit_should_display_the_time_entry_form_with_log_time_permission
3195 @request.session[:user_id] = 2
3214 @request.session[:user_id] = 2
3196 Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
3215 Role.find_by_name('Manager').update_attribute :permissions, [:view_issues, :edit_issues, :log_time]
3197
3216
3198 get :edit, :id => 1
3217 get :edit, :id => 1
3199 assert_select 'input[name=?]', 'time_entry[hours]'
3218 assert_select 'input[name=?]', 'time_entry[hours]'
3200 end
3219 end
@@ -3202,7 +3221,7 class IssuesControllerTest < Redmine::ControllerTest
3202 def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission
3221 def test_get_edit_should_not_display_the_time_entry_form_without_log_time_permission
3203 @request.session[:user_id] = 2
3222 @request.session[:user_id] = 2
3204 Role.find_by_name('Manager').remove_permission! :log_time
3223 Role.find_by_name('Manager').remove_permission! :log_time
3205
3224
3206 get :edit, :id => 1
3225 get :edit, :id => 1
3207 assert_select 'input[name=?]', 'time_entry[hours]', 0
3226 assert_select 'input[name=?]', 'time_entry[hours]', 0
3208 end
3227 end
@@ -3847,7 +3866,7 class IssuesControllerTest < Redmine::ControllerTest
3847 assert_response :redirect
3866 assert_response :redirect
3848 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue.id
3867 assert_redirected_to :controller => 'issues', :action => 'show', :id => issue.id
3849 end
3868 end
3850
3869
3851 def test_put_update_should_redirect_with_previous_and_next_issue_ids_params
3870 def test_put_update_should_redirect_with_previous_and_next_issue_ids_params
3852 @request.session[:user_id] = 2
3871 @request.session[:user_id] = 2
3853
3872
@@ -3901,17 +3920,17 class IssuesControllerTest < Redmine::ControllerTest
3901
3920
3902 assert_select 'select[name=?]', 'issue[project_id]'
3921 assert_select 'select[name=?]', 'issue[project_id]'
3903 assert_select 'input[name=?]', 'issue[parent_issue_id]'
3922 assert_select 'input[name=?]', 'issue[parent_issue_id]'
3904
3923
3905 # Project specific custom field, date type
3924 # Project specific custom field, date type
3906 field = CustomField.find(9)
3925 field = CustomField.find(9)
3907 assert !field.is_for_all?
3926 assert !field.is_for_all?
3908 assert_equal 'date', field.field_format
3927 assert_equal 'date', field.field_format
3909 assert_select 'input[name=?]', 'issue[custom_field_values][9]'
3928 assert_select 'input[name=?]', 'issue[custom_field_values][9]'
3910
3929
3911 # System wide custom field
3930 # System wide custom field
3912 assert CustomField.find(1).is_for_all?
3931 assert CustomField.find(1).is_for_all?
3913 assert_select 'select[name=?]', 'issue[custom_field_values][1]'
3932 assert_select 'select[name=?]', 'issue[custom_field_values][1]'
3914
3933
3915 # Be sure we don't display inactive IssuePriorities
3934 # Be sure we don't display inactive IssuePriorities
3916 assert ! IssuePriority.find(15).active?
3935 assert ! IssuePriority.find(15).active?
3917 assert_select 'select[name=?]', 'issue[priority_id]' do
3936 assert_select 'select[name=?]', 'issue[priority_id]' do
@@ -4115,7 +4134,7 class IssuesControllerTest < Redmine::ControllerTest
4115 :issue => {:priority_id => '',
4134 :issue => {:priority_id => '',
4116 :assigned_to_id => group.id,
4135 :assigned_to_id => group.id,
4117 :custom_field_values => {'2' => ''}}
4136 :custom_field_values => {'2' => ''}}
4118
4137
4119 assert_response 302
4138 assert_response 302
4120 assert_equal [group, group], Issue.where(:id => [1, 2]).collect {|i| i.assigned_to}
4139 assert_equal [group, group], Issue.where(:id => [1, 2]).collect {|i| i.assigned_to}
4121 end
4140 end
@@ -4421,7 +4440,7 class IssuesControllerTest < Redmine::ControllerTest
4421 assert_select 'option[value="2"]'
4440 assert_select 'option[value="2"]'
4422 end
4441 end
4423 end
4442 end
4424
4443
4425 def test_bulk_copy_to_another_project
4444 def test_bulk_copy_to_another_project
4426 @request.session[:user_id] = 2
4445 @request.session[:user_id] = 2
4427 assert_difference 'Issue.count', 2 do
4446 assert_difference 'Issue.count', 2 do
@@ -4474,7 +4493,7 class IssuesControllerTest < Redmine::ControllerTest
4474 :assigned_to_id => 2)
4493 :assigned_to_id => 2)
4475 ]
4494 ]
4476 assert_difference 'Issue.count', issues.size do
4495 assert_difference 'Issue.count', issues.size do
4477 post :bulk_update, :ids => issues.map(&:id), :copy => '1',
4496 post :bulk_update, :ids => issues.map(&:id), :copy => '1',
4478 :issue => {
4497 :issue => {
4479 :project_id => '', :tracker_id => '', :assigned_to_id => '',
4498 :project_id => '', :tracker_id => '', :assigned_to_id => '',
4480 :status_id => '', :start_date => '', :due_date => ''
4499 :status_id => '', :start_date => '', :due_date => ''
@@ -4506,7 +4525,7 class IssuesControllerTest < Redmine::ControllerTest
4506 @request.session[:user_id] = 2
4525 @request.session[:user_id] = 2
4507 assert_difference 'Issue.count', 2 do
4526 assert_difference 'Issue.count', 2 do
4508 assert_no_difference 'Project.find(1).issues.count' do
4527 assert_no_difference 'Project.find(1).issues.count' do
4509 post :bulk_update, :ids => [1, 2], :copy => '1',
4528 post :bulk_update, :ids => [1, 2], :copy => '1',
4510 :issue => {
4529 :issue => {
4511 :project_id => '2', :tracker_id => '', :assigned_to_id => '2',
4530 :project_id => '2', :tracker_id => '', :assigned_to_id => '2',
4512 :status_id => '1', :start_date => '2009-12-01', :due_date => '2009-12-31'
4531 :status_id => '1', :start_date => '2009-12-01', :due_date => '2009-12-31'
General Comments 0
You need to be logged in to leave comments. Login now