Index: app/helpers/issues_helper.rb =================================================================== --- app/helpers/issues_helper.rb (révision 14015) +++ app/helpers/issues_helper.rb (copie de travail) @@ -19,7 +19,6 @@ module IssuesHelper include ApplicationHelper - include Redmine::Export::PDF::IssuesPdfHelper def issue_list(issues, &block) ancestors = [] @@ -32,24 +31,6 @@ end end - def grouped_issue_list(issues, query, issue_count_by_group, &block) - previous_group, first = false, true - issue_list(issues) do |issue, level| - group_name = group_count = nil - if query.grouped? && ((group = query.group_by_column.value(issue)) != previous_group || first) - if group.blank? && group != false - group_name = "(#{l(:label_blank_value)})" - else - group_name = column_content(query.group_by_column, issue) - end - group_name ||= "" - group_count = issue_count_by_group[group] - end - yield issue, level, group_name, group_count - previous_group, first = group, false - end - end - # Renders a HTML/CSS tooltip # # To use, a trigger div is needed. This is a div with the class of "tooltip" @@ -82,7 +63,7 @@ def render_issue_subject_with_tree(issue) s = '' - ancestors = issue.root? ? [] : issue.ancestors.visible.to_a + ancestors = issue.root? ? [] : issue.ancestors.visible.all ancestors.each do |ancestor| s << '
' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id))) end @@ -103,7 +84,7 @@ css << " idnt idnt-#{level}" if level > 0 s << content_tag('tr', content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') + - content_tag('td', link_to_issue(child, :project => (issue.project_id != child.project_id)), :class => 'subject', :style => 'width: 50%') + + content_tag('td', link_to_issue(child, :truncate => 60, :project => (issue.project_id != child.project_id)), :class => 'subject') + content_tag('td', h(child.status)) + content_tag('td', link_to_user(child.assigned_to)) + content_tag('td', progress_bar(child.done_ratio, :width => '80px')), @@ -181,74 +162,83 @@ def render_custom_fields_rows(issue) values = issue.visible_custom_field_values return if values.empty? + + #Don't take long text fields + non_longtext_values = [] + values.compact.each do |value| + if !(value.custom_field.format.is_a?(Redmine::FieldFormat::TextFormat)) then + non_longtext_values << value + end + end + ordered_values = [] - half = (values.size / 2.0).ceil + half = (non_longtext_values.size / 2.0).ceil half.times do |i| - ordered_values << values[i] - ordered_values << values[i + half] + ordered_values << non_longtext_values[i] + ordered_values << non_longtext_values[i + half] end s = "\n" n = 0 ordered_values.compact.each do |value| css = "cf_#{value.custom_field.id}" s << "\n\n" if n > 0 && (n % 2) == 0 - s << "\t#{ h(value.custom_field.name) }:#{ h(show_value(value)) }\n" + s << "\t#{ h(value.custom_field.name) }:#{ h(show_value(value)) }\n" n += 1 end s << "\n" s.html_safe end - # Returns the path for updating the issue form - # with project as the current project - def update_issue_form_path(project, issue) - options = {:format => 'js'} - if issue.new_record? - if project - new_project_issue_path(project, options) - else - new_issue_path(options) - end - else - edit_issue_path(issue, options) + def render_custom_fields_long_text_rows(issue) + values = issue.visible_custom_field_values + return if values.empty? + + #Only take long text fields + longtext_values = [] + values.compact.each do |value| + if value.custom_field.format.is_a?(Redmine::FieldFormat::TextFormat) then + longtext_values << value + end + end + + s = "\n\n" + longtext_values.compact.each do |value| + css = "cf_#{value.custom_field.id}" + s << "\n\n\n" + s << "\n\t#{ h(value.custom_field.name) }:\n\n" + s << "\n\t#{ h(show_value(value)) }\n\n" + s << "\n\n\n" end + s << "\n\n" + s.html_safe end - # Returns the number of descendants for an array of issues - def issues_descendant_count(issues) - ids = issues.reject(&:leaf?).map {|issue| issue.descendants.ids}.flatten.uniq - ids -= issues.map(&:id) - ids.size - end def issues_destroy_confirmation_message(issues) issues = [issues] unless issues.is_a?(Array) message = l(:text_issues_destroy_confirmation) - - descendant_count = issues_descendant_count(issues) + descendant_count = issues.inject(0) {|memo, i| memo += (i.right - i.left - 1)/2} if descendant_count > 0 - message << "\n" + l(:text_issues_destroy_descendants_confirmation, :count => descendant_count) + tom_fields_long_text_rowseach do |issue| + next if issue.root? + issues.each do |other_issue| + descendant_count -= 1 if issue.is_descendant_of?(other_issue) + end + end + if descendant_count > 0 + message << "\n" + l(:text_issues_destroy_descendants_confirmation, :count => descendant_count) + end end message end - # Returns an array of users that are proposed as watchers - # on the new issue form - def users_for_new_issue_watchers(issue) - users = issue.watcher_users - if issue.project.users.count <= 20 - users = (users + issue.project.users.sort).uniq - end - users - end - def sidebar_queries unless @sidebar_queries @sidebar_queries = IssueQuery.visible. order("#{Query.table_name}.name ASC"). # Project specific queries and global queries where(@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id]). - to_a + all end @sidebar_queries end @@ -337,8 +327,6 @@ # Returns the textual representation of a single journal detail def show_detail(detail, no_html=false, options={}) multiple = false - show_diff = false - case detail.property when 'attr' field = detail.prop_key.to_s.gsub(/\_id$/, "") @@ -365,21 +353,14 @@ when 'is_private' value = l(detail.value == "0" ? :general_text_No : :general_text_Yes) unless detail.value.blank? old_value = l(detail.old_value == "0" ? :general_text_No : :general_text_Yes) unless detail.old_value.blank? - - when 'description' - show_diff = true end when 'cf' custom_field = detail.custom_field if custom_field + multiple = custom_field.multiple? label = custom_field.name - if custom_field.format.class.change_as_diff - show_diff = true - else - multiple = custom_field.multiple? - value = format_value(detail.value, custom_field) if detail.value - old_value = format_value(detail.old_value, custom_field) if detail.old_value - end + value = format_value(detail.value, custom_field) if detail.value + old_value = format_value(detail.old_value, custom_field) if detail.old_value end when 'attachment' label = l(:label_attachment) @@ -409,8 +390,7 @@ if detail.old_value && detail.value.blank? && detail.property != 'relation' old_value = content_tag("del", old_value) end - if detail.property == 'attachment' && value.present? && - atta = detail.journal.journalized.attachments.detect {|a| a.id == detail.prop_key.to_i} + if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key) # Link to the attachment if it has not been removed value = link_to_attachment(atta, :download => true, :only_path => options[:only_path]) if options[:only_path] != false && atta.is_text? @@ -425,7 +405,7 @@ end end - if show_diff + if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) unless no_html diff_link = link_to 'diff', @@ -458,18 +438,14 @@ unless id.present? return nil end - @detail_value_name_by_reflection ||= Hash.new do |hash, key| - association = Issue.reflect_on_association(key.first.to_sym) - name = nil - if association - record = association.klass.find_by_id(key.last) - if record - name = record.name.force_encoding('UTF-8') - end + association = Issue.reflect_on_association(field.to_sym) + if association + record = association.class_name.constantize.find_by_id(id) + if record + record.name.force_encoding('UTF-8') if record.name.respond_to?(:force_encoding) + return record.name end - hash[key] = name end - @detail_value_name_by_reflection[[field, id]] end # Renders issue children recursively Index: app/views/issues/show.html.erb =================================================================== --- app/views/issues/show.html.erb (révision 14015) +++ app/views/issues/show.html.erb (copie de travail) @@ -8,16 +8,14 @@ <%= link_to_if @prev_issue_id, "\xc2\xab #{l(:label_previous)}", (@prev_issue_id ? issue_path(@prev_issue_id) : nil), - :title => "##{@prev_issue_id}", - :accesskey => accesskey(:previous) %> | + :title => "##{@prev_issue_id}" %> | <% if @issue_position && @issue_count %> <%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %> | <% end %> <%= link_to_if @next_issue_id, "#{l(:label_next)} \xc2\xbb", (@next_issue_id ? issue_path(@next_issue_id) : nil), - :title => "##{@next_issue_id}", - :accesskey => accesskey(:next) %> + :title => "##{@next_issue_id}" %>
<% end %> @@ -82,7 +80,13 @@
<%= textilizable @issue, :description, :attachments => @issue.attachments %>
+ + + +<%= render_custom_fields_long_text_rows(@issue) %> +
+ <% end %> <%= link_to_attachments @issue, :thumbnails => true %> <% end -%>