Templating for selections
This commit is contained in:
parent
98fb41b442
commit
8b7924fc72
11
dist/js/select2.amd.full.js
vendored
11
dist/js/select2.amd.full.js
vendored
@ -711,7 +711,9 @@ define('select2/selection/single',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.display = function (data) {
|
SingleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.selectionContainer = function () {
|
SingleSelection.prototype.selectionContainer = function () {
|
||||||
@ -788,7 +790,9 @@ define('select2/selection/multiple',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.display = function (data) {
|
MultipleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.selectionContainer = function () {
|
MultipleSelection.prototype.selectionContainer = function () {
|
||||||
@ -1625,6 +1629,9 @@ define('select2/defaults',[
|
|||||||
language: ['select2/i18n/en'],
|
language: ['select2/i18n/en'],
|
||||||
templateResult: function (result) {
|
templateResult: function (result) {
|
||||||
return result.text;
|
return result.text;
|
||||||
|
},
|
||||||
|
templateSelection: function (selection) {
|
||||||
|
return selection.text;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
11
dist/js/select2.amd.js
vendored
11
dist/js/select2.amd.js
vendored
@ -711,7 +711,9 @@ define('select2/selection/single',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.display = function (data) {
|
SingleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.selectionContainer = function () {
|
SingleSelection.prototype.selectionContainer = function () {
|
||||||
@ -788,7 +790,9 @@ define('select2/selection/multiple',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.display = function (data) {
|
MultipleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.selectionContainer = function () {
|
MultipleSelection.prototype.selectionContainer = function () {
|
||||||
@ -1625,6 +1629,9 @@ define('select2/defaults',[
|
|||||||
language: ['select2/i18n/en'],
|
language: ['select2/i18n/en'],
|
||||||
templateResult: function (result) {
|
templateResult: function (result) {
|
||||||
return result.text;
|
return result.text;
|
||||||
|
},
|
||||||
|
templateSelection: function (selection) {
|
||||||
|
return selection.text;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
11
dist/js/select2.full.js
vendored
11
dist/js/select2.full.js
vendored
@ -10246,7 +10246,9 @@ define('select2/selection/single',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.display = function (data) {
|
SingleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.selectionContainer = function () {
|
SingleSelection.prototype.selectionContainer = function () {
|
||||||
@ -10323,7 +10325,9 @@ define('select2/selection/multiple',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.display = function (data) {
|
MultipleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.selectionContainer = function () {
|
MultipleSelection.prototype.selectionContainer = function () {
|
||||||
@ -11160,6 +11164,9 @@ define('select2/defaults',[
|
|||||||
language: ['select2/i18n/en'],
|
language: ['select2/i18n/en'],
|
||||||
templateResult: function (result) {
|
templateResult: function (result) {
|
||||||
return result.text;
|
return result.text;
|
||||||
|
},
|
||||||
|
templateSelection: function (selection) {
|
||||||
|
return selection.text;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
4
dist/js/select2.full.min.js
vendored
4
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
11
dist/js/select2.js
vendored
11
dist/js/select2.js
vendored
@ -1139,7 +1139,9 @@ define('select2/selection/single',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.display = function (data) {
|
SingleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.selectionContainer = function () {
|
SingleSelection.prototype.selectionContainer = function () {
|
||||||
@ -1216,7 +1218,9 @@ define('select2/selection/multiple',[
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.display = function (data) {
|
MultipleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.selectionContainer = function () {
|
MultipleSelection.prototype.selectionContainer = function () {
|
||||||
@ -2053,6 +2057,9 @@ define('select2/defaults',[
|
|||||||
language: ['select2/i18n/en'],
|
language: ['select2/i18n/en'],
|
||||||
templateResult: function (result) {
|
templateResult: function (result) {
|
||||||
return result.text;
|
return result.text;
|
||||||
|
},
|
||||||
|
templateSelection: function (selection) {
|
||||||
|
return selection.text;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
2
dist/js/select2.min.js
vendored
2
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
@ -465,13 +465,15 @@ $.fn.select2.amd.require(["select2/core", "select2/utils"], function (Select2, U
|
|||||||
},
|
},
|
||||||
templateResult: function (repo) {
|
templateResult: function (repo) {
|
||||||
var markup = '<div class="row">' +
|
var markup = '<div class="row">' +
|
||||||
'<div class="col-sm-1"><img src="' + repo.owner.avatar_url + '" style="max-width: 100%" /></div>' +
|
'<div class="col-sm-1">' +
|
||||||
'<div class="col-sm-11">' +
|
'<img src="' + repo.owner.avatar_url + '" style="max-width: 100%" />' +
|
||||||
'<div class="row">' +
|
'</div>' +
|
||||||
'<div class="col-sm-6">' + repo.full_name + '</div>' +
|
'<div class="col-sm-11">' +
|
||||||
'<div class="col-sm-3"><i class="fa fa-code-fork"></i> ' + repo.forks_count + '</div>' +
|
'<div class="row">' +
|
||||||
'<div class="col-sm-3"><i class="fa fa-star"></i> ' + repo.stargazers_count + '</div>' +
|
'<div class="col-sm-6">' + repo.full_name + '</div>' +
|
||||||
'</div>';
|
'<div class="col-sm-3"><i class="fa fa-code-fork"></i> ' + repo.forks_count + '</div>' +
|
||||||
|
'<div class="col-sm-3"><i class="fa fa-star"></i> ' + repo.stargazers_count + '</div>' +
|
||||||
|
'</div>';
|
||||||
|
|
||||||
if (repo.description) {
|
if (repo.description) {
|
||||||
markup += '<div>' + repo.description + '</div>';
|
markup += '<div>' + repo.description + '</div>';
|
||||||
|
3
src/js/select2/defaults.js
vendored
3
src/js/select2/defaults.js
vendored
@ -116,6 +116,9 @@ define([
|
|||||||
language: ['select2/i18n/en'],
|
language: ['select2/i18n/en'],
|
||||||
templateResult: function (result) {
|
templateResult: function (result) {
|
||||||
return result.text;
|
return result.text;
|
||||||
|
},
|
||||||
|
templateSelection: function (selection) {
|
||||||
|
return selection.text;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
4
src/js/select2/selection/multiple.js
vendored
4
src/js/select2/selection/multiple.js
vendored
@ -52,7 +52,9 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.display = function (data) {
|
MultipleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
MultipleSelection.prototype.selectionContainer = function () {
|
MultipleSelection.prototype.selectionContainer = function () {
|
||||||
|
4
src/js/select2/selection/single.js
vendored
4
src/js/select2/selection/single.js
vendored
@ -90,7 +90,9 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.display = function (data) {
|
SingleSelection.prototype.display = function (data) {
|
||||||
return data.text;
|
var template = this.options.get('templateSelection');
|
||||||
|
|
||||||
|
return template(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
SingleSelection.prototype.selectionContainer = function () {
|
SingleSelection.prototype.selectionContainer = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user