relations-filter-e4dcb8-r14285.patch

Adrian Wilkins, 2015-06-09 13:05

Download (4.06 KB)

View differences:

app/models/issue_query.rb
473 473
        op = (operator == "!p" ? 'NOT IN' : 'IN')
474 474
        comp = (operator == "=!p" ? '<>' : '=')
475 475
        "#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.project_id #{comp} #{value.first.to_i})"
476
      when "!|c", "*&o"
477
        op = (operator == "!|c" ? 'NOT IN' : 'IN')
478
        "#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false}))"
476 479
      end
477 480

  
478 481
    if relation_options[:sym] == field && !options[:reverse]
app/models/query.rb
201 201
    "!~"  => :label_not_contains,
202 202
    "=p"  => :label_any_issues_in_project,
203 203
    "=!p" => :label_any_issues_not_in_project,
204
    "!p"  => :label_no_issues_in_project
204
    "!p"  => :label_no_issues_in_project,
205
    "*&o" => :label_any_open_issues,
206
    "!|c" => :label_none_or_closed_issues
205 207
  }
206 208

  
207 209
  class_attribute :operators_by_filter_type
......
216 218
    :text => [  "~", "!~", "!*", "*" ],
217 219
    :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
218 220
    :float => [ "=", ">=", "<=", "><", "!*", "*" ],
219
    :relation => ["=", "=p", "=!p", "!p", "!*", "*"]
221
    :relation => ["=", "=p", "=!p", "!p", "*&o", "!|c", "!*", "*"]
220 222
  }
221 223

  
222 224
  class_attribute :available_columns
......
277 279
          # filter requires one or more values
278 280
          (values_for(field) and !values_for(field).first.blank?) or
279 281
          # filter doesn't require any value
280
          ["o", "c", "!*", "*", "t", "ld", "w", "lw", "l2w", "m", "lm", "y"].include? operator_for(field)
282
          ["o", "c", "!*", "*", "t", "ld", "w", "lw", "l2w", "m", "lm", "y", "*&o", "!|c"].include? operator_for(field)
281 283
    end if filters
282 284
  end
283 285

  
config/locales/en-GB.yml
1065 1065
  permission_view_private_notes: View private notes
1066 1066
  permission_set_notes_private: Set notes as private
1067 1067
  label_no_issues_in_project: no issues in project
1068
  label_any_open_issues: any open issues
1069
  label_none_or_closed_issues: none or closed issues
1068 1070
  label_any: all
1069 1071
  label_last_n_weeks: last %{count} weeks
1070 1072
  setting_cross_project_subtasks: Allow cross-project subtasks
config/locales/en.yml
699 699
  label_any_issues_in_project: any issues in project
700 700
  label_any_issues_not_in_project: any issues not in project
701 701
  label_no_issues_in_project: no issues in project
702
  label_any_open_issues: any open issues
703
  label_none_or_closed_issues: none or closed issues
702 704
  label_day_plural: days
703 705
  label_repository: Repository
704 706
  label_repository_new: New repository
public/javascripts/application.js
274 274
    case "y":
275 275
    case "o":
276 276
    case "c":
277
    case "!|c":
278
    case "*&o":
277 279
      enableValues(field, []);
278 280
      break;
279 281
    case "><":