Project

General

Profile

Feature #10412 » grouped_version_filter_trunk_r15418.patch

Takenori TAKAKI, 2016-05-19 08:36

View differences:

app/models/issue_query.rb
subprojects = project.descendants.visible.to_a
principals += Principal.member_of(subprojects).visible
end
versions = project.shared_versions.to_a
versions = Version::VERSION_STATUSES.collect {|s| project.shared_versions.where(:status => s).sort.to_a}.flatten
categories = project.issue_categories.to_a
issue_custom_fields = project.all_issue_custom_fields
else
if all_projects.any?
principals += Principal.member_of(all_projects).visible
end
versions = Version.visible.where(:sharing => 'system').to_a
versions = Version::VERSION_STATUSES.collect {|s| Version.visible.where(:sharing => 'system').where(:status => s).sort.to_a}.flatten
issue_custom_fields = IssueCustomField.where(:is_for_all => true)
end
principals.uniq!
......
add_available_filter "fixed_version_id",
:type => :list_optional,
:values => versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] }
:values => versions.collect{|s| [l("version_status_#{s.status}"), "#{s.project.name} - #{s.name}", s.id.to_s] }
add_available_filter "category_id",
:type => :list_optional,
public/javascripts/application.js
var filterValue = filterValues[i];
var option = $('<option>');
if ($.isArray(filterValue)) {
option.val(filterValue[1]).text(filterValue[0]);
if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
if (filterValue.length == 3) {
option = select.find('optgroup[label=\''+filterValue[0]+'\']');
if (!option.length) {option = $('<optgroup label="'+filterValue[0]+'">');}
var grouped_option = $('<option>');
grouped_option.val(filterValue[2]).text(filterValue[1]);
if ($.inArray(filterValue[2], values) > -1) {grouped_option.attr('selected', true);}
option.append(grouped_option);
} else {
option.val(filterValue[1]).text(filterValue[0]);
if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
}
} else {
option.val(filterValue).text(filterValue);
if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);}
(2-2/3)