Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMMI-2704] Timmi.fixes #538

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions demo/libs/lucca-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4480,7 +4480,7 @@ var lui;
var translateCtrl = ctrls[0];

/** Associations language/code */
var languagesToCodes = { en: 1033, de: 1031, es: 1034, fr: 1036, it: 1040, nl: 2067 };
var languagesToCodes = { en: 1033, de: 1031, es: 1034, fr: 1036, it: 1040, nl: 2067, pt: 2070 };

/** List of all the available languages labels */
var cultures = _.keys(languagesToCodes);
Expand Down Expand Up @@ -5123,13 +5123,13 @@ var lui;
angular.module("lui").run(["$templateCache", function($templateCache) {
$templateCache.put("lui/directives/luidMoment.html",
"<div class='lui hours moment input' ng-class='{disabled: isDisabled}'>" +
" <input type='text' ng-model='hours' ng-change='changeHours()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusHours' ng-focus='focusHours()' ng-blur='blurHours()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false'>" +
" <input type='text' ng-model='hours' ng-change='changeHours()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusHours' ng-focus='focusHours()' ng-blur='blurHours()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false' ng-model-options=\"{updateOn: 'blur'}\">" +
" <i ng-click='incrHours()' ng-show='showButtons && hoursFocused' class='lui mp-button top left north arrow icon' ng-class='{disabled: maxed}'></i>" +
" <i ng-click='decrHours()' ng-show='showButtons && hoursFocused' class='lui mp-button bottom left south arrow icon' ng-class='{disabled: mined}'></i>" +
"</div>" +
"<span class='separator'>:</span>" +
"<div class='lui minutes moment input' ng-class='{disabled: isDisabled}'>" +
" <input type='text' ng-model='mins' ng-change='changeMins()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusMinutes' ng-focus='focusMins()' ng-blur='blurMins()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false'>" +
" <input type='text' ng-model='mins' ng-change='changeMins()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusMinutes' ng-focus='focusMins()' ng-blur='blurMins()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false' ng-model-options=\"{updateOn: 'blur'}\">" +
" <i ng-click='incrMins()' ng-show='showButtons && minsFocused' class='lui mp-button top right north arrow icon' ng-class='{disabled: maxed}'></i>" +
" <i ng-click='decrMins()' ng-show='showButtons && minsFocused' class='lui mp-button bottom right south arrow icon' ng-class='{disabled: mined}'></i>" +
"</div>" +
Expand Down Expand Up @@ -5440,7 +5440,7 @@ var lui;
timespan += "-";
dur = moment.duration(-dur);
}
timespan += (dur.days() > 0 ? Math.floor(dur.asDays()) + '.' : '') + (dur.hours() < 10 ? '0' : '') + dur.hours() + ':' + (dur.minutes() < 10 ? '0' : '') + dur.minutes() + ':00';
timespan += (dur.asDays() > 0 ? Math.floor(dur.asDays()) + '.' : '') + (dur.hours() < 10 ? '0' : '') + dur.hours() + ':' + (dur.minutes() < 10 ? '0' : '') + dur.minutes() + ':00';
return timespan;
}
return dur;
Expand Down Expand Up @@ -5652,7 +5652,21 @@ var lui;
sameYear: 'von start(Do MMMM) bis end(LL)',
sameYearThisYear: 'von start(Do MMMM) bis end(Do MMMM)',
other: 'von start(LL) bis end(LL)'
}
},
'es': {
startOnly: 'del date(dddd LL)',
startOnlyThisYear: 'del date(dddd LL)',
endOnly: 'al date(dddd LL)',
endOnlyThisYear: 'al date(dddd LL)',
date: 'date(LL)',
sameDay: 'el start(dddd LL)',
sameDayThisYear: 'el start(dddd LL)',
sameMonth: 'del start(D) al end(LL)',
sameMonthThisYear: 'del start(D) al end(LL)',
sameYear: 'del start(LL) al end(LL)',
sameYearThisYear: 'del start(LL) al end(LL)',
other: 'del start(LL) al end(LL)'
}
};
function getTrad(trads, locale, key, fallbackKey) {
if (!!trads && !!trads[locale] && !!trads[locale][key]) {
Expand Down Expand Up @@ -5775,7 +5789,8 @@ var lui;
switch(true){
case (Math.floor((days * 10) % 10) === 0 && Math.floor((days * 100) % 10) === 0): return 0;
case (Math.floor((days * 100) % 10) === 0): return 1;
default: return 2;
case (Math.floor((days * 1000) % 10) === 0): return 2;
default: return 3;
}
}

Expand Down Expand Up @@ -5845,11 +5860,16 @@ var lui;
},
];

var d = moment.duration(_duration);

var d, securedDuration = undefined;

if (!!_duration) {
securedDuration = !!_duration.asMilliseconds ? _duration.asMilliseconds() : _duration;
}
d = moment.duration(securedDuration);

if (d.asMilliseconds() === 0) { return ''; }

var values = [Math.abs(d.days()), Math.abs(d.hours()), Math.abs(d.minutes()), Math.abs(d.seconds()), Math.abs(d.milliseconds())];
var values = [Math.floor(Math.abs(d.asDays())), Math.abs(d.hours()), Math.abs(d.minutes()), Math.abs(d.seconds()), Math.abs(d.milliseconds())];
var config = unitConfigs[getConfigIndex(_unit)];
var minimumUnit = Math.max(config.index, getNextNotNull(values, 0));
values[config.index] = Math.abs(d[config.dateConversion]() >= 0 ? Math.floor(d[config.dateConversion]()) : Math.ceil(d[config.dateConversion]()));
Expand Down
38 changes: 29 additions & 9 deletions dist/lucca-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4480,7 +4480,7 @@ var lui;
var translateCtrl = ctrls[0];

/** Associations language/code */
var languagesToCodes = { en: 1033, de: 1031, es: 1034, fr: 1036, it: 1040, nl: 2067 };
var languagesToCodes = { en: 1033, de: 1031, es: 1034, fr: 1036, it: 1040, nl: 2067, pt: 2070 };

/** List of all the available languages labels */
var cultures = _.keys(languagesToCodes);
Expand Down Expand Up @@ -5123,13 +5123,13 @@ var lui;
angular.module("lui").run(["$templateCache", function($templateCache) {
$templateCache.put("lui/directives/luidMoment.html",
"<div class='lui hours moment input' ng-class='{disabled: isDisabled}'>" +
" <input type='text' ng-model='hours' ng-change='changeHours()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusHours' ng-focus='focusHours()' ng-blur='blurHours()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false'>" +
" <input type='text' ng-model='hours' ng-change='changeHours()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusHours' ng-focus='focusHours()' ng-blur='blurHours()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false' ng-model-options=\"{updateOn: 'blur'}\">" +
" <i ng-click='incrHours()' ng-show='showButtons && hoursFocused' class='lui mp-button top left north arrow icon' ng-class='{disabled: maxed}'></i>" +
" <i ng-click='decrHours()' ng-show='showButtons && hoursFocused' class='lui mp-button bottom left south arrow icon' ng-class='{disabled: mined}'></i>" +
"</div>" +
"<span class='separator'>:</span>" +
"<div class='lui minutes moment input' ng-class='{disabled: isDisabled}'>" +
" <input type='text' ng-model='mins' ng-change='changeMins()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusMinutes' ng-focus='focusMins()' ng-blur='blurMins()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false'>" +
" <input type='text' ng-model='mins' ng-change='changeMins()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusMinutes' ng-focus='focusMins()' ng-blur='blurMins()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false' ng-model-options=\"{updateOn: 'blur'}\">" +
" <i ng-click='incrMins()' ng-show='showButtons && minsFocused' class='lui mp-button top right north arrow icon' ng-class='{disabled: maxed}'></i>" +
" <i ng-click='decrMins()' ng-show='showButtons && minsFocused' class='lui mp-button bottom right south arrow icon' ng-class='{disabled: mined}'></i>" +
"</div>" +
Expand Down Expand Up @@ -5440,7 +5440,7 @@ var lui;
timespan += "-";
dur = moment.duration(-dur);
}
timespan += (dur.days() > 0 ? Math.floor(dur.asDays()) + '.' : '') + (dur.hours() < 10 ? '0' : '') + dur.hours() + ':' + (dur.minutes() < 10 ? '0' : '') + dur.minutes() + ':00';
timespan += (dur.asDays() > 0 ? Math.floor(dur.asDays()) + '.' : '') + (dur.hours() < 10 ? '0' : '') + dur.hours() + ':' + (dur.minutes() < 10 ? '0' : '') + dur.minutes() + ':00';
return timespan;
}
return dur;
Expand Down Expand Up @@ -5652,7 +5652,21 @@ var lui;
sameYear: 'von start(Do MMMM) bis end(LL)',
sameYearThisYear: 'von start(Do MMMM) bis end(Do MMMM)',
other: 'von start(LL) bis end(LL)'
}
},
'es': {
startOnly: 'del date(dddd LL)',
startOnlyThisYear: 'del date(dddd LL)',
endOnly: 'al date(dddd LL)',
endOnlyThisYear: 'al date(dddd LL)',
date: 'date(LL)',
sameDay: 'el start(dddd LL)',
sameDayThisYear: 'el start(dddd LL)',
sameMonth: 'del start(D) al end(LL)',
sameMonthThisYear: 'del start(D) al end(LL)',
sameYear: 'del start(LL) al end(LL)',
sameYearThisYear: 'del start(LL) al end(LL)',
other: 'del start(LL) al end(LL)'
}
};
function getTrad(trads, locale, key, fallbackKey) {
if (!!trads && !!trads[locale] && !!trads[locale][key]) {
Expand Down Expand Up @@ -5775,7 +5789,8 @@ var lui;
switch(true){
case (Math.floor((days * 10) % 10) === 0 && Math.floor((days * 100) % 10) === 0): return 0;
case (Math.floor((days * 100) % 10) === 0): return 1;
default: return 2;
case (Math.floor((days * 1000) % 10) === 0): return 2;
default: return 3;
}
}

Expand Down Expand Up @@ -5845,11 +5860,16 @@ var lui;
},
];

var d = moment.duration(_duration);

var d, securedDuration = undefined;

if (!!_duration) {
securedDuration = !!_duration.asMilliseconds ? _duration.asMilliseconds() : _duration;
}
d = moment.duration(securedDuration);

if (d.asMilliseconds() === 0) { return ''; }

var values = [Math.abs(d.days()), Math.abs(d.hours()), Math.abs(d.minutes()), Math.abs(d.seconds()), Math.abs(d.milliseconds())];
var values = [Math.floor(Math.abs(d.asDays())), Math.abs(d.hours()), Math.abs(d.minutes()), Math.abs(d.seconds()), Math.abs(d.milliseconds())];
var config = unitConfigs[getConfigIndex(_unit)];
var minimumUnit = Math.max(config.index, getNextNotNull(values, 0));
values[config.index] = Math.abs(d[config.dateConversion]() >= 0 ? Math.floor(d[config.dateConversion]()) : Math.ceil(d[config.dateConversion]()));
Expand Down
6 changes: 3 additions & 3 deletions dist/lucca-ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/directives/lucca/translations-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
var translateCtrl = ctrls[0];

/** Associations language/code */
var languagesToCodes = { en: 1033, de: 1031, es: 1034, fr: 1036, it: 1040, nl: 2067 };
var languagesToCodes = { en: 1033, de: 1031, es: 1034, fr: 1036, it: 1040, nl: 2067, pt: 2070 };

/** List of all the available languages labels */
var cultures = _.keys(languagesToCodes);
Expand Down
4 changes: 2 additions & 2 deletions js/directives/moment-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,13 +451,13 @@
angular.module("lui").run(["$templateCache", function($templateCache) {
$templateCache.put("lui/directives/luidMoment.html",
"<div class='lui hours moment input' ng-class='{disabled: isDisabled}'>" +
" <input type='text' ng-model='hours' ng-change='changeHours()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusHours' ng-focus='focusHours()' ng-blur='blurHours()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false'>" +
" <input type='text' ng-model='hours' ng-change='changeHours()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusHours' ng-focus='focusHours()' ng-blur='blurHours()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false' ng-model-options=\"{updateOn: 'blur'}\">" +
" <i ng-click='incrHours()' ng-show='showButtons && hoursFocused' class='lui mp-button top left north arrow icon' ng-class='{disabled: maxed}'></i>" +
" <i ng-click='decrHours()' ng-show='showButtons && hoursFocused' class='lui mp-button bottom left south arrow icon' ng-class='{disabled: mined}'></i>" +
"</div>" +
"<span class='separator'>:</span>" +
"<div class='lui minutes moment input' ng-class='{disabled: isDisabled}'>" +
" <input type='text' ng-model='mins' ng-change='changeMins()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusMinutes' ng-focus='focusMins()' ng-blur='blurMins()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false'>" +
" <input type='text' ng-model='mins' ng-change='changeMins()' luid-select-on-click ng-pattern='pattern' luid-focus-on='focusMinutes' ng-focus='focusMins()' ng-blur='blurMins()' ng-disabled='isDisabled' maxLength='2' autocorrect='off' spellcheck='false' ng-model-options=\"{updateOn: 'blur'}\">" +
" <i ng-click='incrMins()' ng-show='showButtons && minsFocused' class='lui mp-button top right north arrow icon' ng-class='{disabled: maxed}'></i>" +
" <i ng-click='decrMins()' ng-show='showButtons && minsFocused' class='lui mp-button bottom right south arrow icon' ng-class='{disabled: mined}'></i>" +
"</div>" +
Expand Down
2 changes: 1 addition & 1 deletion js/directives/timespan-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
timespan += "-";
dur = moment.duration(-dur);
}
timespan += (dur.days() > 0 ? Math.floor(dur.asDays()) + '.' : '') + (dur.hours() < 10 ? '0' : '') + dur.hours() + ':' + (dur.minutes() < 10 ? '0' : '') + dur.minutes() + ':00';
timespan += (dur.asDays() > 0 ? Math.floor(dur.asDays()) + '.' : '') + (dur.hours() < 10 ? '0' : '') + dur.hours() + ':' + (dur.minutes() < 10 ? '0' : '') + dur.minutes() + ':00';
return timespan;
}
return dur;
Expand Down
30 changes: 25 additions & 5 deletions js/filters/timeFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,21 @@
sameYear: 'von start(Do MMMM) bis end(LL)',
sameYearThisYear: 'von start(Do MMMM) bis end(Do MMMM)',
other: 'von start(LL) bis end(LL)'
}
},
'es': {
startOnly: 'del date(dddd LL)',
startOnlyThisYear: 'del date(dddd LL)',
endOnly: 'al date(dddd LL)',
endOnlyThisYear: 'al date(dddd LL)',
date: 'date(LL)',
sameDay: 'el start(dddd LL)',
sameDayThisYear: 'el start(dddd LL)',
sameMonth: 'del start(D) al end(LL)',
sameMonthThisYear: 'del start(D) al end(LL)',
sameYear: 'del start(LL) al end(LL)',
sameYearThisYear: 'del start(LL) al end(LL)',
other: 'del start(LL) al end(LL)'
}
};
function getTrad(trads, locale, key, fallbackKey) {
if (!!trads && !!trads[locale] && !!trads[locale][key]) {
Expand Down Expand Up @@ -180,7 +194,8 @@
switch(true){
case (Math.floor((days * 10) % 10) === 0 && Math.floor((days * 100) % 10) === 0): return 0;
case (Math.floor((days * 100) % 10) === 0): return 1;
default: return 2;
case (Math.floor((days * 1000) % 10) === 0): return 2;
default: return 3;
}
}

Expand Down Expand Up @@ -250,11 +265,16 @@
},
];

var d = moment.duration(_duration);

var d, securedDuration = undefined;

if (!!_duration) {
securedDuration = !!_duration.asMilliseconds ? _duration.asMilliseconds() : _duration;
}
d = moment.duration(securedDuration);

if (d.asMilliseconds() === 0) { return ''; }

var values = [Math.abs(d.days()), Math.abs(d.hours()), Math.abs(d.minutes()), Math.abs(d.seconds()), Math.abs(d.milliseconds())];
var values = [Math.floor(Math.abs(d.asDays())), Math.abs(d.hours()), Math.abs(d.minutes()), Math.abs(d.seconds()), Math.abs(d.milliseconds())];
var config = unitConfigs[getConfigIndex(_unit)];
var minimumUnit = Math.max(config.index, getNextNotNull(values, 0));
values[config.index] = Math.abs(d[config.dateConversion]() >= 0 ? Math.floor(d[config.dateConversion]()) : Math.ceil(d[config.dateConversion]()));
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"normalize.css": "~8.0.0",
"ng-sortable": "1.3.2",
"ui-select": "~0.19.3",
"underscore": "~1.8.3"
"underscore": "~1.8.3",
"typings": "^2.1.0"
},
"devDependencies": {
"angular-mocks": "1.5.x",
Expand Down Expand Up @@ -51,8 +52,7 @@
"phantomjs-prebuilt": "^2.1.4",
"protractor": "=3.1.1",
"remap-istanbul": "^0.5.1",
"tslint": "^3.3.0",
"typings": "^2.1.0"
"tslint": "^3.3.0"
},
"peerDependencies": {
"@cgross/angular-notify": "~2.5.0",
Expand All @@ -75,7 +75,7 @@
"author": "Lucca",
"license": "ISC",
"scripts": {
"install": "typings install",
"postinstall": "typings install",
"start": "grunt",
"test": "grunt test",
"build": "grunt dist"
Expand Down