mirror of
https://github.com/wassname/angular-timezone-selector.git
synced 2026-07-10 01:21:12 +08:00
Trying to rename again...
This commit is contained in:
Vendored
+23
-36
@@ -1,5 +1,5 @@
|
||||
/*global angular, _, moment, $*/
|
||||
angular.module('angular-timezone-select', [])
|
||||
angular.module('angular-timezone-selector', [])
|
||||
.constant('_', _)
|
||||
.constant('moment', moment)
|
||||
.factory('timezones', ['_', 'moment', function (_, moment) {
|
||||
@@ -33,7 +33,7 @@ angular.module('angular-timezone-select', [])
|
||||
.directive('timezoneSelect', ['_', 'timezones', 'zoneToCC', 'CCToCountryName', function (_, timezones, zoneToCC, CCToCountryName) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<input>',
|
||||
template: '<select></select>',
|
||||
replace: true,
|
||||
link: function (scope, elem, attrs) {
|
||||
var data = []
|
||||
@@ -67,41 +67,28 @@ angular.module('angular-timezone-select', [])
|
||||
data.push(zonesForCountry)
|
||||
})
|
||||
|
||||
elem.select2({
|
||||
data: data,
|
||||
theme: 'classic',
|
||||
formatSelection: function (selection) {
|
||||
return selection.id
|
||||
},
|
||||
formatResult: function (result) {
|
||||
if (!result.id) {
|
||||
return result.text
|
||||
}
|
||||
return '<strong>' + result.name + '</strong> <small>' + result.offset + '</small>'
|
||||
},
|
||||
matcher: function (params, data) {
|
||||
console.log(params)
|
||||
console.log(data)
|
||||
// If there are no search terms, return all of the data
|
||||
if ($.trim(params.term) === '') {
|
||||
return data;
|
||||
}
|
||||
|
||||
// `params.term` should be the term that is used for searching
|
||||
// `data.text` is the text that is displayed for the data object
|
||||
if (data.text.indexOf(params.term) > -1) {
|
||||
var modifiedData = $.extend({}, data, true);
|
||||
modifiedData.text += ' (matched)';
|
||||
|
||||
// You can return modified objects from here
|
||||
// This includes matching the `children` how you want in nested data sets
|
||||
return modifiedData;
|
||||
}
|
||||
|
||||
// Return `null` if the term should not be displayed
|
||||
return null;
|
||||
}
|
||||
_.forEach(data, function (group) {
|
||||
var $optgroup = $('<optgroup label="' + group.text + '">')
|
||||
group.children.forEach(function (option) {
|
||||
$optgroup.append('<option name="' + option.id + '">' +
|
||||
option.name + '</option>')
|
||||
})
|
||||
elem.append($optgroup)
|
||||
})
|
||||
|
||||
// elem.select2({
|
||||
// data: data,
|
||||
// theme: 'classic',
|
||||
// formatSelection: function (selection) {
|
||||
// return selection.id
|
||||
// },
|
||||
// formatResult: function (result) {
|
||||
// if (!result.id) {
|
||||
// return result.text
|
||||
// }
|
||||
// return '<strong>' + result.name + '</strong> <small>' + result.offset + '</small>'
|
||||
// },
|
||||
// })
|
||||
}
|
||||
}
|
||||
}])
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
"Ashok Fernandez <ashok@mish.guru>"
|
||||
],
|
||||
"description": "Timezone selector for Angular JS",
|
||||
"main": "dist/angular-timezone-selector.min.js",
|
||||
"main": "dist/angular-timezone-selector.js",
|
||||
"keywords": [
|
||||
"timezone",
|
||||
"select"
|
||||
|
||||
Vendored
+23
-36
@@ -1,5 +1,5 @@
|
||||
/*global angular, _, moment, $*/
|
||||
angular.module('angular-timezone-select', [])
|
||||
angular.module('angular-timezone-selector', [])
|
||||
.constant('_', _)
|
||||
.constant('moment', moment)
|
||||
.factory('timezones', ['_', 'moment', function (_, moment) {
|
||||
@@ -33,7 +33,7 @@ angular.module('angular-timezone-select', [])
|
||||
.directive('timezoneSelect', ['_', 'timezones', 'zoneToCC', 'CCToCountryName', function (_, timezones, zoneToCC, CCToCountryName) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '<input>',
|
||||
template: '<select></select>',
|
||||
replace: true,
|
||||
link: function (scope, elem, attrs) {
|
||||
var data = []
|
||||
@@ -67,41 +67,28 @@ angular.module('angular-timezone-select', [])
|
||||
data.push(zonesForCountry)
|
||||
})
|
||||
|
||||
elem.select2({
|
||||
data: data,
|
||||
theme: 'classic',
|
||||
formatSelection: function (selection) {
|
||||
return selection.id
|
||||
},
|
||||
formatResult: function (result) {
|
||||
if (!result.id) {
|
||||
return result.text
|
||||
}
|
||||
return '<strong>' + result.name + '</strong> <small>' + result.offset + '</small>'
|
||||
},
|
||||
matcher: function (params, data) {
|
||||
console.log(params)
|
||||
console.log(data)
|
||||
// If there are no search terms, return all of the data
|
||||
if ($.trim(params.term) === '') {
|
||||
return data;
|
||||
}
|
||||
|
||||
// `params.term` should be the term that is used for searching
|
||||
// `data.text` is the text that is displayed for the data object
|
||||
if (data.text.indexOf(params.term) > -1) {
|
||||
var modifiedData = $.extend({}, data, true);
|
||||
modifiedData.text += ' (matched)';
|
||||
|
||||
// You can return modified objects from here
|
||||
// This includes matching the `children` how you want in nested data sets
|
||||
return modifiedData;
|
||||
}
|
||||
|
||||
// Return `null` if the term should not be displayed
|
||||
return null;
|
||||
}
|
||||
_.forEach(data, function (group) {
|
||||
var $optgroup = $('<optgroup label="' + group.text + '">')
|
||||
group.children.forEach(function (option) {
|
||||
$optgroup.append('<option name="' + option.id + '">' +
|
||||
option.name + '</option>')
|
||||
})
|
||||
elem.append($optgroup)
|
||||
})
|
||||
|
||||
// elem.select2({
|
||||
// data: data,
|
||||
// theme: 'classic',
|
||||
// formatSelection: function (selection) {
|
||||
// return selection.id
|
||||
// },
|
||||
// formatResult: function (result) {
|
||||
// if (!result.id) {
|
||||
// return result.text
|
||||
// }
|
||||
// return '<strong>' + result.name + '</strong> <small>' + result.offset + '</small>'
|
||||
// },
|
||||
// })
|
||||
}
|
||||
}
|
||||
}])
|
||||
|
||||
Vendored
-107
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -2,7 +2,7 @@
|
||||
"name": "angular-timezone-selector",
|
||||
"version": "1.0.1",
|
||||
"description": "AngularJS timezone select",
|
||||
"main": "dist/angular-timezone-selector.js",
|
||||
"main": "dist/angular-timezone-selector.min.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
@@ -20,7 +20,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mishguruorg/angular-country-selector/issues"
|
||||
},
|
||||
"homepage": "https://github.com/alexcheng1982/angular-timezone-select",
|
||||
"homepage": "https://github.com/mishguruorg/angular-timezone-selector",
|
||||
"devDependencies": {
|
||||
"lodash": "latest",
|
||||
"uglify-js": "latest",
|
||||
|
||||
Reference in New Issue
Block a user