grouped_version_filter_trunk_r15418.patch

Takenori TAKAKI, 2016-05-19 08:36

Download (2.68 KB)

View differences:

app/models/issue_query.rb
140 140
        subprojects = project.descendants.visible.to_a
141 141
        principals += Principal.member_of(subprojects).visible
142 142
      end
143
      versions = project.shared_versions.to_a
143
      versions = Version::VERSION_STATUSES.collect {|s| project.shared_versions.where(:status => s).sort.to_a}.flatten
144 144
      categories = project.issue_categories.to_a
145 145
      issue_custom_fields = project.all_issue_custom_fields
146 146
    else
147 147
      if all_projects.any?
148 148
        principals += Principal.member_of(all_projects).visible
149 149
      end
150
      versions = Version.visible.where(:sharing => 'system').to_a
150
      versions = Version::VERSION_STATUSES.collect {|s| Version.visible.where(:sharing => 'system').where(:status => s).sort.to_a}.flatten
151 151
      issue_custom_fields = IssueCustomField.where(:is_for_all => true)
152 152
    end
153 153
    principals.uniq!
......
201 201

  
202 202
    add_available_filter "fixed_version_id",
203 203
      :type => :list_optional,
204
      :values => versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] }
204
      :values => versions.collect{|s| [l("version_status_#{s.status}"), "#{s.project.name} - #{s.name}", s.id.to_s] }
205 205

  
206 206
    add_available_filter "category_id",
207 207
      :type => :list_optional,
public/javascripts/application.js
173 173
      var filterValue = filterValues[i];
174 174
      var option = $('<option>');
175 175
      if ($.isArray(filterValue)) {
176
        option.val(filterValue[1]).text(filterValue[0]);
177
        if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
176
        if (filterValue.length == 3) {
177
          option = select.find('optgroup[label=\''+filterValue[0]+'\']');
178
          if (!option.length) {option = $('<optgroup label="'+filterValue[0]+'">');}
179
          var grouped_option = $('<option>');
180
          grouped_option.val(filterValue[2]).text(filterValue[1]);
181
          if ($.inArray(filterValue[2], values) > -1) {grouped_option.attr('selected', true);}
182
          option.append(grouped_option);
183
        } else {
184
          option.val(filterValue[1]).text(filterValue[0]);
185
          if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
186
        }
178 187
      } else {
179 188
        option.val(filterValue).text(filterValue);
180 189
        if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);}