<commit_before>/*globals $, _, uiElement, eventize, lcsMerge, COMMCAREHQ */

var SortRow = function (field, type, direction) {
  this.field = ko.observable(field);
  this.type = ko.observable(type);
  this.direction = ko.observable(direction);

  this.type.subscribe(function () {
    window.saveButton.fire('change');
  });
  this.direction.subscribe(function () {
    window.saveButton.fire('change');
  });
};

var SortRows = function () {
  var self = this;
  self.sortRows = ko.observableArray([]);

  self.addSortRow = function (field, type, direction) {
    self.sortRows.push(new SortRow(field, type, direction));
  };

  self.removeSortRow = function (row) {
    self.sortRows.remove(row);
    window.saveButton.fire('change');
  };

  self.rowCount = ko.computed(function () {
    return self.sortRows().length;
  });

};

// http://www.knockmeout.net/2011/05/dragging-dropping-and-sorting-with.html
// connect items with observableArrays
ko.bindingHandlers.sortableList = {
  init: function(element, valueAccessor) {
    var list = valueAccessor();
    $(element).sortable({
      handle: '.grip',
      cursor: 'move',
      update: function(event, ui) {
        //retrieve our actual data item
        var item = ko.dataFor(ui.item.get(0));
        //figure out its new position
        var position = ko.utils.arrayIndexOf(ui.item.parent().children(), ui.item[0]);
        //remove the item and add it back in the right spot
        if (position >= 0) {
          list.remove(item);
          list.splice(position, 0, item);
        }
        ui.item.remove();
      }
    });
  }
};

sortRows = new SortRows
ko.applyBindings(sortRows, $('#detail-screen-config-body').get(0));

var DetailScreenConfig = (function () {
    "use strict";
    var DetailScreenConfig, Screen, Column;

    function formatEnum(obj, lang, langs) {
        var key,
            translated_pairs = {},
            actual_pairs = {},
            translatedValue,
            actualValue,
            i;
        for (key in obj) {<commit_msg>Dragging sort properties should enable save button<commit_after>/*globals $, _, uiElement, eventize, lcsMerge, COMMCAREHQ */

var SortRow = function (field, type, direction) {
  this.field = ko.observable(field);
  this.type = ko.observable(type);
  this.direction = ko.observable(direction);

  this.type.subscribe(function () {
    window.saveButton.fire('change');
  });
  this.direction.subscribe(function () {
    window.saveButton.fire('change');
  });
};

var SortRows = function () {
  var self = this;
  self.sortRows = ko.observableArray([]);

  self.addSortRow = function (field, type, direction) {
    self.sortRows.push(new SortRow(field, type, direction));
  };

  self.removeSortRow = function (row) {
    self.sortRows.remove(row);
    window.saveButton.fire('change');
  };

  self.rowCount = ko.computed(function () {
    return self.sortRows().length;
  });

};

// http://www.knockmeout.net/2011/05/dragging-dropping-and-sorting-with.html
// connect items with observableArrays
ko.bindingHandlers.sortableList = {
  init: function(element, valueAccessor) {
    var list = valueAccessor();
    $(element).sortable({
      handle: '.grip',
      cursor: 'move',
      update: function(event, ui) {
        //retrieve our actual data item
        var item = ko.dataFor(ui.item.get(0));
        //figure out its new position
        var position = ko.utils.arrayIndexOf(ui.item.parent().children(), ui.item[0]);
        //remove the item and add it back in the right spot
        if (position >= 0) {
          list.remove(item);
          list.splice(position, 0, item);
        }
        ui.item.remove();
        window.saveButton.fire('change');
      }
    });
  }
};

sortRows = new SortRows
ko.applyBindings(sortRows, $('#detail-screen-config-body').get(0));

var DetailScreenConfig = (function () {
    "use strict";
    var DetailScreenConfig, Screen, Column;

    function formatEnum(obj, lang, langs) {
        var key,
            translated_pairs = {},
            actual_pairs = {},
            translatedValue,
            actualValue,
            i;
        for (key in obj) {
{'fraction_non_alphanumeric': 0.1457577955039884, 'fraction_numerical': 0.005317863185883491, 'mean_word_length': 2.7755474452554743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2405410', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1266, 'n_words': 271}