var $ = require('jquery');

function PulsarSortableComponent(html) {

    this.$html = html;

};

PulsarSortableComponent.prototype.init = function () {

    var component = this;

    this.initTables();
};

PulsarSortableComponent.prototype.initTables = function () {

    var component = this;

    this.$html.find('.table.is-sortable tbody').sortable({
        placeholder: 'is-sorting',
        helper: component.fixHelper,
        opacity: 0.9,
        create: function(e, ui) {
            component.addOrder();
        },
        start: function(e, ui) {
            $(ui.helper).addClass('is-dragging');
        },
        update: function(e, ui) {
            var $item = $(ui.item);

            $item.addClass('has-success fade', function() {
                setTimeout(function() {
                    $item.removeClass('has-success fade');
                }, 2500);
            });

            component.updateOrder();

        }
    }).disableSelection();
};

PulsarSortableComponent.prototype.fixHelper = function(e, ui) {

    ui.children().each(function() {
        $(this).width($(this).width());
    });

    return ui;
};

PulsarSortableComponent.prototype.addOrder = function(e, ui) {

    var component = this;

    component.$html.find('.table.is-sortable tr > td:first-of-type').each(function(i) {
        var $this = $(this),
            label = $(this).text();

        i++;

        $this.html('<span class="sortable__count js-sortable-count">' + i + '</span> ' + label);
    });
};

PulsarSortableComponent.prototype.updateOrder = function(e, ui) {

    this.$html.find('.table.is-sortable .js-sortable-count').each(function(i) {
        var $this = $(this),
            label = $(this).text();

        i++;

        $this.text(i);
    });
};

module.exports = PulsarSortableComponent;

@@ -1,12 +1,27 @@
+'use strict';%0A%0A
 var $ = requ
@@ -166,35 +166,8 @@
  %7B%0A%0A
-    var component = this;%0A%0A
     
@@ -181,24 +181,25 @@
 itTables();%0A
+%0A
 %7D;%0A%0APulsarSo
@@ -1004,37 +1004,32 @@
 lper = function(
-e, ui
 ) %7B%0A%0A    ui.chil
@@ -1167,37 +1167,32 @@
 rder = function(
-e, ui
 ) %7B%0A%0A    var com
@@ -1537,29 +1537,24 @@
  = function(
-e, ui
 ) %7B%0A%0A    thi
@@ -1629,73 +1629,8 @@
 i) %7B
-%0A        var $this = $(this),%0A            label = $(this).text();
 %0A%0A  
@@ -1650,20 +1650,22 @@
        $
+(
 this
+)
 .text(i)

Fix linting issues