Sha256: 68b4025700e40a7cc767c3a2ac2e504d34e4e7e84b0bc60696de9c9275798c27

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

// Remove list items.
$('body').delegate(".remove", "click", function() {
    var list = $(this).attr('list');

    //retrieve the context
    var context = ko.contextFor(this);
    var parentArray = context.$parent[list];

    //remove the data (context.$data) from the appropriate array on its parent (context.$parent)
    parentArray.remove(context.$data);
 
    return false;
});

// Add list items.
$('body').delegate(".insert", "click", function() {
    var list = $(this).attr('list');

    //retrieve the context
    var context = ko.contextFor(this);

    var newItem = prompt("Enter new entry for " + list + ': ');

    if (newItem != '' && newItem != null) {
      context.$data[list].push(newItem);
    };
 
    return false;
});

//function save() {
//  $(). ko.toJSON(DotRubyViewModel);
//}

function save() {
  //var json = ko.toJSON(dotrubyInstance);
  var json = JSON.stringify( ko.toJS(dotrubyInstance), null, 2 );
  $('#lastSavedJson').val(json);
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
indexer-0.3.0 lib/indexer/webui/assets/dotruby_binding.js
indexer-0.2.0 lib/indexer/webui/assets/dotruby_binding.js