1
0
mirror of synced 2025-02-03 21:59:24 +03:00

Linted select2/selection/*

This commit is contained in:
Kevin Brown 2014-09-21 15:49:16 -04:00
parent 898db2e74a
commit f0e3968989
2 changed files with 22 additions and 22 deletions

View File

@ -20,34 +20,34 @@ define([
this.$selection = $selection; this.$selection = $selection;
return $selection; return $selection;
} };
MultipleSelection.prototype.bind = function (container, $container) { MultipleSelection.prototype.bind = function (container, $container) {
var self = this; var self = this;
this.$selection.on('click', function (evt) { this.$selection.on('click', function (evt) {
self.trigger("toggle", { self.trigger('toggle', {
originalEvent: evt originalEvent: evt
}); });
}); });
container.on("selection:update", function (params) { container.on('selection:update', function (params) {
self.update(params.data); self.update(params.data);
}); });
} };
MultipleSelection.prototype.clear = function () { MultipleSelection.prototype.clear = function () {
this.$selection.find(".rendered-selection").empty(); this.$selection.find('.rendered-selection').empty();
} };
MultipleSelection.prototype.display = function (data) { MultipleSelection.prototype.display = function (data) {
return data.text; return data.text;
} };
MultipleSelection.prototype.update = function (data) { MultipleSelection.prototype.update = function (data) {
this.clear(); this.clear();
if (data.length == 0) { if (data.length === 0) {
return; return;
} }
@ -61,13 +61,13 @@ define([
var $selection = $('<ul class="choice"></ul>'); var $selection = $('<ul class="choice"></ul>');
$selection.text(formatted); $selection.text(formatted);
$selection.data("data", data); $selection.data('data', data);
$selections.push($selection); $selections.push($selection);
} }
this.$selection.find(".rendered-selection").append($selections); this.$selection.find('.rendered-selection').append($selections);
} };
return MultipleSelection; return MultipleSelection;
}); });

View File

@ -20,7 +20,7 @@ define([
this.$selection = $selection; this.$selection = $selection;
return $selection; return $selection;
} };
SingleSelection.prototype.bind = function (container, $container) { SingleSelection.prototype.bind = function (container, $container) {
var self = this; var self = this;
@ -31,26 +31,26 @@ define([
return; return;
} }
self.trigger("toggle", { self.trigger('toggle', {
originalEvent: evt originalEvent: evt
}); });
}); });
container.on("selection:update", function (params) { container.on('selection:update', function (params) {
self.update(params.data); self.update(params.data);
}) });
} };
SingleSelection.prototype.clear = function () { SingleSelection.prototype.clear = function () {
this.$selection.find(".rendered-selection").empty(); this.$selection.find('.rendered-selection').empty();
} };
SingleSelection.prototype.display = function (data) { SingleSelection.prototype.display = function (data) {
return data.text; return data.text;
} };
SingleSelection.prototype.update = function (data) { SingleSelection.prototype.update = function (data) {
if (data.length == 0) { if (data.length === 0) {
this.clear(); this.clear();
return; return;
} }
@ -59,8 +59,8 @@ define([
var formatted = this.display(selection); var formatted = this.display(selection);
this.$selection.find(".rendered-selection").html(formatted); this.$selection.find('.rendered-selection').html(formatted);
} };
return SingleSelection; return SingleSelection;
}); });