-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from visionappscz/feature/localize-loaders
Feature/localize loaders, fixes #41
- Loading branch information
Showing
9 changed files
with
149 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
"jQuery": false, | ||
"$": false, | ||
"QUnit": false, | ||
"sinon": false | ||
"sinon": false, | ||
"moment": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,43 @@ | ||
;(function ($, window) { | ||
;(function ($, moment, window) { | ||
'use strict'; | ||
|
||
// CKEDITOR-LOADER DATA-API | ||
// ======================== | ||
var DatetimePickerLoader = function ($element) { | ||
this.$element = $element; | ||
}; | ||
|
||
(function ($, window) { | ||
// We have to use $(winodow).load() as $(document).ready() can not be triggered manually | ||
// and thus it would make it impossible to test this part of the code. | ||
$(window).load(function () { | ||
var initComponentFn = function (confObj, confValue) { | ||
if (confValue) { | ||
$.extend(confObj, confValue); | ||
} | ||
DatetimePickerLoader.prototype.filterLocale = function (locale) { | ||
return moment.locale(locale); | ||
}; | ||
|
||
$(this).datetimepicker(confObj); | ||
DatetimePickerLoader.prototype.init = function (confObj) { | ||
confObj.locale = this.filterLocale(confObj.locale); | ||
this.$element.datetimepicker(confObj); | ||
}; | ||
|
||
// We have to use $(winodow).load() as $(document).ready() can not be triggered manually | ||
// and thus it would make it impossible to test this part of the code. | ||
$(window).load(function () { | ||
var initComponentFn = function (inlineConf) { | ||
var datetimePickerLoader = new DatetimePickerLoader($(this)); | ||
var conf = { | ||
allowInputToggle: true, | ||
sideBySide: true, | ||
locale: $('html').attr('lang'), | ||
}; | ||
|
||
$('[data-onload-datetimepicker]').each(function () { | ||
initComponentFn.call(this, { allowInputToggle: true, sideBySide: true }, $(this).data( | ||
'onload-datetimepicker' | ||
)); | ||
}); | ||
if (inlineConf) { | ||
$.extend(conf, inlineConf); | ||
} | ||
|
||
datetimePickerLoader.init(conf); | ||
}; | ||
|
||
// CKEDITOR-LOADER DATA-API | ||
// ======================== | ||
|
||
$('[data-onload-datetimepicker]').each(function () { | ||
initComponentFn.call(this, $(this).data('onload-datetimepicker')); | ||
}); | ||
}($, window)); | ||
}); | ||
|
||
}(jQuery, window)); | ||
}(jQuery, moment, window)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters