Revert "U4-5520: Localize datepicker"

This commit is contained in:
Shannon
2014-10-27 17:47:50 +10:00
parent e6eb25b58a
commit 87db6d672a
9 changed files with 1348 additions and 10559 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
/**
* Brazilian translation for bootstrap-datetimepicker
* Cauan Cabral <cauan@radig.com.br>
*/
; (function ($) {
$.fn.datetimepicker.dates['pt-BR'] = {
days: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado", "Domingo"],
daysShort: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb", "Dom"],
daysMin: ["Do", "Se", "Te", "Qu", "Qu", "Se", "Sa", "Do"],
months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"],
monthsShort: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
today: "Hoje"
};
}(jQuery));

View File

@@ -496,9 +496,3 @@ ul.color-picker li a {
.umb-tags .tag i{padding: 2px;}
.umb-tags input{border: none; background: white}
//
// Date/time picker
// --------------------------------------------------
.bootstrap-datetimepicker-widget .btn{padding: 0;}
.bootstrap-datetimepicker-widget .picker-switch .btn{ background: none; border: none;}
.umb-datepicker .input-append .add-on{cursor: pointer;}

View File

@@ -1,18 +1,14 @@
function dateTimePickerController($scope, notificationsService, assetsService, angularHelper, userService, $element) {
//lists the custom language files that we currently support
var customLangs = ["pt-BR"];
//setup the default config
var config = {
pickDate: true,
pickTime: true,
useSeconds: true,
format: "YYYY-MM-DD HH:mm:ss",
icons: {
time: "icon-time",
date: "icon-calendar",
up: "icon-chevron-up",
down: "icon-chevron-down"
}
pick12HourFormat: false,
format: "yyyy-MM-dd hh:mm:ss"
};
//map the user config
@@ -29,7 +25,7 @@ function dateTimePickerController($scope, notificationsService, assetsService, a
angularHelper.safeApply($scope, function() {
// when a date is changed, update the model
if (e.localDate) {
if ($scope.model.config.format == "YYYY-MM-DD HH:mm:ss") {
if ($scope.model.config.format == "yyyy-MM-dd hh:mm:ss") {
$scope.model.value = e.localDate.toIsoDateTimeString();
}
else {
@@ -47,34 +43,34 @@ function dateTimePickerController($scope, notificationsService, assetsService, a
userService.getCurrentUser().then(function (user) {
assetsService.loadCss('lib/datetimepicker/bootstrap-datetimepicker.min.css').then(function() {
var filesToLoad = ["lib/datetimepicker/moment-with-locales.js",
"lib/datetimepicker/bootstrap-datetimepicker.js"];
var filesToLoad = ["lib/datetimepicker/bootstrap-datetimepicker.js"];
$scope.model.config.language = user.locale;
//if we support this custom culture, set it, then we'll need to load in that lang file
if (_.contains(customLangs, user.locale)) {
$scope.model.config.language = user.locale;
filesToLoad.push("lib/datetimepicker/langs/datetimepicker." + user.locale + ".js");
}
assetsService.load(filesToLoad).then(
function () {
//The Datepicker js and css files are available and all components are ready to use.
assetsService.load(filesToLoad).then(
function () {
//The Datepicker js and css files are available and all components are ready to use.
// Get the id of the datepicker button that was clicked
var pickerId = $scope.model.alias;
// Get the id of the datepicker button that was clicked
var pickerId = $scope.model.alias;
// Open the datepicker and add a changeDate eventlistener
$element.find("div:first")
.datetimepicker($scope.model.config)
.on("changeDate", applyDate);
// Open the datepicker and add a changeDate eventlistener
$element.find("div:first")
.datetimepicker($scope.model.config)
.on("changeDate", applyDate);
//manually assign the date to the plugin
$element.find("div:first").datetimepicker("setValue", $scope.model.value ? $scope.model.value : null);
//manually assign the date to the plugin
$element.find("div:first").datetimepicker("setValue", $scope.model.value ? $scope.model.value : null);
//Ensure to remove the event handler when this instance is destroyted
$scope.$on('$destroy', function () {
$element.find("div:first").datetimepicker("destroy");
});
});
//Ensure to remove the event handler when this instance is destroyted
$scope.$on('$destroy', function () {
$element.find("div:first").datetimepicker("destroy");
});
});
});

View File

@@ -5,7 +5,7 @@
ng-required="model.validation.mandatory"
val-server="value" />
<span class="add-on">
<i class="icon-calendar"></i>
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>

View File

@@ -16,7 +16,7 @@ namespace Umbraco.Web.PropertyEditors
{
_defaultPreVals = new Dictionary<string, object>
{
{"format", "YYYY-MM-DD"},
{"format", "yyyy-MM-dd"},
{"pickTime", false}
};
}

View File

@@ -12,7 +12,9 @@ namespace Umbraco.Web.PropertyEditors
{
_defaultPreVals = new Dictionary<string, object>
{
{"format", "YYYY-MM-DD HH:mm:ss"}
//NOTE: This is very important that we do not use .Net format's there, this format
// is the correct format for the JS picker we are using so you cannot capitalize the HH, they need to be 'hh'
{"format", "yyyy-MM-dd hh:mm:ss"}
};
}