Project

General

Profile

Patch #32523 » 32523-note-2.patch

Go MAEDA, 2024-09-05 12:21

View differences:

app/assets/javascripts/application.js
164 164
  if (!filterOptions) return;
165 165
  var operators = operatorByType[filterOptions['type']];
166 166
  var filterValues = filterOptions['values'];
167
  var i, select;
167
  var select;
168 168
  var tr = $('<div class="filter">').attr('id', 'tr_'+fieldId).html(
169 169
    '<div class="field"><input checked="checked" id="cb_'+fieldId+'" name="f[]" value="'+field+'" type="checkbox"><label for="cb_'+fieldId+'"> '+filterOptions['name']+'</label></div>' +
......
174 174
  filterTable.append(tr);
175 175
  select = tr.find('.operator select');
176
  for (i = 0; i < operators.length; i++) {
177
    var option = $('<option>').val(operators[i]).text(operatorLabels[operators[i]]);
178
    if (operators[i] == operator) { option.prop('selected', true); }
176
  operators.forEach(function(op) {
177
    var option = $('<option>').val(op).text(operatorLabels[op]);
178
    if (op == operator) { option.prop('selected', true); }
179 179
    select.append(option);
180
  }
180
  });
181 181
  select.change(function(){ toggleOperator(field); });
182 182
  switch (filterOptions['type']) {
......
194 194
    );
195 195
    select = tr.find('.values select');
196 196
    if (values.length > 1) { select.attr('multiple', true); }
197
    for (i = 0; i < filterValues.length; i++) {
197
    filterValues.forEach(function(filterValue) {
198 198
      var filterValue = filterValues[i];
199 199
      var option = $('<option>');
200 200
      if ($.isArray(filterValue)) {
......
210 210
        if ($.inArray(filterValue, values) > -1) {option.prop('selected', true);}
211 211
      }
212 212
      select.append(option);
213
    }
213
    });
214 214
    break;
215 215
  case "date":
216 216
  case "date_past":
......
238 238
    );
239 239
    $('#values_'+fieldId).val(values[0]);
240 240
    select = tr.find('.values select');
241
    for (i = 0; i < filterValues.length; i++) {
241
    filterValues.forEach(function(filterValue) {
242 242
      var filterValue = filterValues[i];
243 243
      var option = $('<option>');
244 244
      option.val(filterValue[1]).text(filterValue[0]);
245 245
      if (values[0] == filterValue[1]) { option.prop('selected', true); }
246 246
      select.append(option);
247
    }
247
    });
248 248
    break;
249 249
  case "integer":
250 250
  case "float":
(4-4/5)