You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/05/20 21:05:44 UTC
svn commit: r1744798 - in /myfaces/tobago/trunk:
tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/80-editable/
tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/stan...
Author: lofwyr
Date: Fri May 20 21:05:44 2016
New Revision: 1744798
URL: http://svn.apache.org/viewvc?rev=1744798&view=rev
Log:
TOBAGO-1483: Let tc:date use a Bootstrap component as picker
* fix position in sheet
[developed by hnoeth]
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/80-editable/
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js?rev=1744798&r1=1744797&r2=1744798&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js Fri May 20 21:05:44 2016
@@ -38,7 +38,8 @@ Tobago.DateTime.init = function (element
today: 'fa fa-calendar-check-o',
clear: 'fa fa-trash',
close: 'fa fa-times'
- }
+ },
+ widgetParent: '.tobago-page'
};
var i18n = date.data("tobago-date-time-i18n");
@@ -70,6 +71,33 @@ Tobago.DateTime.init = function (element
}
date.parent().datetimepicker(options);
+
+ /*
+ XXX need for fixing wrong positioning of bootstrap datepicker.
+ See https://github.com/Eonasdan/bootstrap-datetimepicker/issues/790 for more information.
+ */
+ date.parent().on('dp.show', function () {
+ var datepicker = jQuery('.bootstrap-datetimepicker-widget');
+ var $div = jQuery(this);
+ if (datepicker.hasClass('bottom')) {
+ var top = $div.offset().top + $div.outerHeight() - jQuery("body").offset().top;
+ var left = $div.offset().left;
+ datepicker.css({
+ 'top': top + 'px',
+ 'bottom': 'auto',
+ 'left': left + 'px'
+ });
+ }
+ else if (datepicker.hasClass('top')) {
+ var top = $div.offset().top - datepicker.outerHeight() - jQuery("body").offset().top;
+ var left = $div.offset().left;
+ datepicker.css({
+ 'top': top + 'px',
+ 'bottom': 'auto',
+ 'left': left + 'px'
+ });
+ }
+ });
});
};
@@ -90,35 +118,66 @@ Tobago.DateTime.analyzePattern = functio
pattern = "";
}
- pattern = pattern.replace(/y/g, "Y");
- pattern = pattern.replace(/\bY\b/g, "YYYY");
- pattern = pattern.replace(/\bYYY\b/g, "YY");
- pattern = pattern.replace(/YYYYY(Y)+/g, "YYYYY");
-
- pattern = pattern.replace(/MMMM(M)+/g, "MMMM");
-
- pattern = pattern.replace(/\bw\b/g, "W");
- pattern = pattern.replace(/ww(w)+/g, "WW");
-
- pattern = pattern.replace(/DDD(D)*/g, "DDDD");
- pattern = pattern.replace(/\bD{1,2}\b/g, "DDD");
-
- pattern = pattern.replace(/dd(d)*/g, "DD");
- pattern = pattern.replace(/\bd\b/g, "D");
-
- pattern = pattern.replace(/\bE{1,3}\b/g, "dd");
- pattern = pattern.replace(/EEEE(E)*/g, "dddd");
-
- pattern = pattern.replace(/u(u)*/g, "E");
- pattern = pattern.replace(/a(a)*/g, "A");
- pattern = pattern.replace(/HH(H)*/g, "HH");
- pattern = pattern.replace(/kk(k)*/g, "kk");
- pattern = pattern.replace(/hh(h)*/g, "hh");
- pattern = pattern.replace(/mm(m)*/g, "mm");
- pattern = pattern.replace(/ss(s)*/g, "ss");
- pattern = pattern.replace(/SSS(S)*/g, "SSS");
+ if (pattern.search("y") > -1) {
+ pattern = pattern.replace(/y/g, "Y");
+ }
+ if (pattern.search("Y") > -1) {
+ pattern = pattern.replace(/\bY\b/g, "YYYY");
+ pattern = pattern.replace(/\bYYY\b/g, "YY");
+ pattern = pattern.replace(/YYYYYY+/g, "YYYYY");
+ }
+
+ if (pattern.search("MMMMM") > -1) {
+ pattern = pattern.replace(/MMMMM+/g, "MMMM");
+ }
+
+ if (pattern.search("w") > -1) {
+ pattern = pattern.replace(/\bw\b/g, "W");
+ pattern = pattern.replace(/www+/g, "WW");
+ }
+
+ if (pattern.search("D") > -1) {
+ pattern = pattern.replace(/DDD+/g, "DDDD");
+ pattern = pattern.replace(/\bD{1,2}\b/g, "DDD");
+ }
+
+ if (pattern.search("d") > -1) {
+ pattern = pattern.replace(/dd+/g, "DD");
+ pattern = pattern.replace(/\bd\b/g, "D");
+ }
+
+ if (pattern.search("E") > -1) {
+ pattern = pattern.replace(/\bE{1,3}\b/g, "dd");
+ pattern = pattern.replace(/EEEE+/g, "dddd");
+ }
- pattern = pattern.replace(/ZZ(Z)*/g, "ZZ");
+ if (pattern.search("u") > -1) {
+ pattern = pattern.replace(/u+/g, "E");
+ }
+ if (pattern.search("a") > -1) {
+ pattern = pattern.replace(/a+/g, "A");
+ }
+ if (pattern.search("HHH") > -1) {
+ pattern = pattern.replace(/HHH+/g, "HH");
+ }
+ if (pattern.search("kkk") > -1) {
+ pattern = pattern.replace(/kkk+/g, "kk");
+ }
+ if (pattern.search("hhh") > -1) {
+ pattern = pattern.replace(/hhh+/g, "hh");
+ }
+ if (pattern.search("mmm") > -1) {
+ pattern = pattern.replace(/mmm+/g, "mm");
+ }
+ if (pattern.search("sss") > -1) {
+ pattern = pattern.replace(/sss+/g, "ss");
+ }
+ if (pattern.search("SSSS") > -1) {
+ pattern = pattern.replace(/SSSS+/g, "SSS");
+ }
+ if (pattern.search("ZZZ") > -1) {
+ pattern = pattern.replace(/ZZZ+/g, "ZZ");
+ }
return pattern;
};
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css?rev=1744798&r1=1744797&r2=1744798&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/tobago.css Fri May 20 21:05:44 2016
@@ -51,6 +51,14 @@ needed for popups
z-index: 2000 !important;
}
+/*
+XXX need for fixing wrong positioning of bootstrap datepicker.
+See https://github.com/Eonasdan/bootstrap-datetimepicker/issues/790 for more information.
+*/
+body {
+ position: relative;
+}
+
/* file -------------------------------------------------------------- */
.tobago-file {