var $ = django.jQuery;
$(function() {
  $('input:checkbox.publish-checkbox').change(function() {
    if ($(this).is(':checked')) {
      var url = $(this).attr('data-publish');
    } else {
      var url = $(this).attr('data-unpublish');
    }
    $.get(url, function(data) {
      if (data.success) {
        $('.published-icon').find('img').toggle();
      }
    });
  });
});

(function(){
  var $ = django.jQuery;
  $(function() {
    $('input:checkbox.publish-checkbox').change(function() {
      var elem = $(this);
      if (elem.is(':checked')) {
        var url = elem.attr('data-publish');
      } else {
        var url = elem.attr('data-unpublish');
      }
      $.get(url, function(data) {
        if (data.success) {
          elem.parent().find('.published-icon img').toggle();
        }
      });
    });
  });
})();

Fix scoping of dollar symbol and only change icon of selected item on publish/unpublish
Fix scoping of dollar symbol and only change icon of selected item on publish/unpublish
