Skip to content

Commit 0e94bad

Browse files
committed
Fixes primefaces#2749 - Align with primefaces#3154
Merge commit '158909b6208290c71e11ea819be3146e0fc134c3' into button-params
2 parents f746f6a + 158909b commit 0e94bad

File tree

7 files changed

+99
-53
lines changed

7 files changed

+99
-53
lines changed

pom.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
</parent>
99

1010
<modelVersion>4.0.0</modelVersion>
11+
1112
<groupId>org.primefaces</groupId>
1213
<artifactId>primefaces</artifactId>
1314
<packaging>jar</packaging>
14-
<version>6.2.RC1</version>
15+
<version>6.2.RC2-SNAPSHOT</version>
16+
1517
<name>primefaces</name>
1618
<url>http://www.primefaces.org</url>
1719

@@ -692,7 +694,7 @@
692694
<extension>
693695
<groupId>org.apache.maven.wagon</groupId>
694696
<artifactId>wagon-ssh</artifactId>
695-
<version>1.0</version>
697+
<version>3.0.0</version>
696698
</extension>
697699
</extensions>
698700
</build>
@@ -806,6 +808,7 @@
806808
<plugin>
807809
<groupId>net.alchim31.maven</groupId>
808810
<artifactId>yuicompressor-maven-plugin</artifactId>
811+
<version>1.4.0</version>
809812
<configuration>
810813
<jswarn>false</jswarn>
811814
<excludes>

src/main/java/org/primefaces/component/panel/PanelRenderer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ protected void encodeScript(FacesContext context, Panel panel) throws IOExceptio
6868
wb.attr("toggleable", true)
6969
.attr("toggleSpeed", panel.getToggleSpeed())
7070
.attr("collapsed", panel.isCollapsed())
71-
.attr("toggleOrientation", panel.getToggleOrientation());
71+
.attr("toggleOrientation", panel.getToggleOrientation())
72+
.attr("toggleOnHeaderClick", panel.isToggleOnHeaderClick());
7273
}
7374

7475
if (panel.isClosable()) {

src/main/java/org/primefaces/renderkit/OutcomeTargetRenderer.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,29 @@ protected boolean isIncludeViewParams(UIOutcomeTarget outcomeTarget, NavigationC
143143
return outcomeTarget.isIncludeViewParams() || navCase.isIncludeViewParams();
144144
}
145145

146+
protected String prependContextPathIfNecessary(FacesContext facesContext, String path) {
147+
if (path.length() > 0 && path.charAt(0) == '/') {
148+
String contextPath = facesContext.getExternalContext().getRequestContextPath();
149+
if (contextPath == null) {
150+
return path;
151+
}
152+
else if (contextPath.length() == 1 && contextPath.charAt(0) == '/') {
153+
// If the context path is root, it is not necessary to append it, otherwise an extra '/' will be set.
154+
return path;
155+
}
156+
else {
157+
return contextPath + path;
158+
}
159+
}
160+
return path;
161+
}
162+
146163
protected String getTargetURL(FacesContext context, UIOutcomeTarget outcomeTarget) {
147164
String url;
165+
148166
String href = outcomeTarget.getHref();
149-
150167
if (href != null) {
151-
url = getHrefURL(href, outcomeTarget.getParams());
168+
url = getHrefURL(prependContextPathIfNecessary(context, href), outcomeTarget.getParams());
152169
}
153170
else {
154171
NavigationCase navCase = findNavigationCase(context, outcomeTarget);

src/main/resources-maven-jsf/ui/panel.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@
118118
<defaultValue>vertical</defaultValue>
119119
<description>Defines the orientation of the toggle animation, valid values are "vertical" and "horizontal".</description>
120120
</attribute>
121+
<attribute>
122+
<name>toggleOnHeaderClick</name>
123+
<required>false</required>
124+
<type>java.lang.Boolean</type>
125+
<defaultValue>false</defaultValue>
126+
<description>Defines if the panel is toggable by clicking on the panel header. Default is false.</description>
127+
</attribute>
121128
</attributes>
122129
<resources>
123130
<resource>

src/main/resources/META-INF/resources/primefaces/datatable/datatable.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
display: none;
325325
}
326326

327-
.ui-datatable-reflow .ui-datatable-data td[role="gridcell"] {
327+
.ui-datatable-reflow .ui-datatable-data td[role="gridcell"]:not(.ui-helper-hidden) {
328328
text-align: left;
329329
display: block;
330330
border: 0px none;

src/main/resources/META-INF/resources/primefaces/mobile/jquery-mobile.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,8 +3333,10 @@ var dataPropertyName = "virtualMouseBindings",
33333333
touchTargetPropertyName = "virtualTouchID",
33343334
virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ),
33353335
touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ),
3336+
generalProps = ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
3337+
"metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
33363338
mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [],
3337-
mouseEventProps = $.event.props.concat( mouseHookProps ),
3339+
mouseEventProps = generalProps.concat( mouseHookProps ),
33383340
activeDocHandlers = {},
33393341
resetTimerID = 0,
33403342
startX = 0,
@@ -3372,7 +3374,7 @@ function createVirtualEvent( event, eventType ) {
33723374
event.type = eventType;
33733375

33743376
oe = event.originalEvent;
3375-
props = $.event.props;
3377+
props = generalProps;
33763378

33773379
// addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280
33783380
// https://github.com/jquery/jquery-mobile/issues/3280
@@ -6173,7 +6175,7 @@ $.widget( "mobile.page", {
61736175
if ( document.readyState === "complete" ) {
61746176
pageIsFullyLoaded();
61756177
} else {
6176-
$.mobile.window.load( pageIsFullyLoaded );
6178+
$.mobile.window.on('load', pageIsFullyLoaded );
61776179
}
61786180

61796181
$.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } );
@@ -15430,7 +15432,7 @@ $.widget( "ui.tabs", {
1543015432
// window load event
1543115433
// hide iOS browser chrome on load if hideUrlBar is true this is as fall back incase we were too early before
1543215434
if ( $.mobile.hideUrlBar ) {
15433-
$window.load( $.mobile.silentScroll );
15435+
$window.on('load', $.mobile.silentScroll );
1543415436
}
1543515437

1543615438
if ( !$.support.cssPointerEvents ) {

src/main/resources/META-INF/resources/primefaces/panel/panel.js

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,39 @@
22
* PrimeFaces Panel Widget
33
*/
44
PrimeFaces.widget.Panel = PrimeFaces.widget.BaseWidget.extend({
5-
5+
66
init: function(cfg) {
77
this._super(cfg);
88
this.header = this.jq.children('div.ui-panel-titlebar');
99
this.title = this.header.children('span.ui-panel-title');
1010
this.content = $(this.jqId + '_content');
11-
11+
1212
this.bindEvents();
1313
},
14-
14+
1515
bindEvents: function() {
16+
var $this = this;
17+
1618
if(this.cfg.toggleable) {
1719
this.bindToggler();
20+
21+
if(this.cfg.toggleOnHeaderClick) {
22+
this.header.on('click', function() {
23+
$this.toggle();
24+
});
25+
}
1826
}
1927

2028
if(this.cfg.closable) {
2129
this.bindCloser();
2230
}
23-
31+
2432
if(this.cfg.hasMenu) {
2533
$(this.jqId + '_menu').on('click.panel', function(e) {
2634
e.preventDefault();
2735
});
2836
}
29-
37+
3038
//visuals for action items
3139
this.header.find('.ui-panel-titlebar-icon').on('mouseover.panel',function() {
3240
$(this).addClass('ui-state-hover');
@@ -37,9 +45,11 @@ PrimeFaces.widget.Panel = PrimeFaces.widget.BaseWidget.extend({
3745
if(!href || href == '#') {
3846
e.preventDefault();
3947
}
48+
49+
return false;
4050
});
4151
},
42-
52+
4353
toggle: function() {
4454
if(this.cfg.collapsed) {
4555
this.expand();
@@ -49,94 +59,94 @@ PrimeFaces.widget.Panel = PrimeFaces.widget.BaseWidget.extend({
4959
this.collapse();
5060
}
5161
},
52-
62+
5363
expand: function() {
5464
this.toggleState(false, 'ui-icon-plusthick', 'ui-icon-minusthick');
55-
65+
5666
if(this.cfg.toggleOrientation === 'vertical')
5767
this.slideDown();
5868
else if(this.cfg.toggleOrientation === 'horizontal')
59-
this.slideRight();
69+
this.slideRight();
6070
},
61-
71+
6272
collapse: function() {
6373
this.toggleState(true, 'ui-icon-minusthick', 'ui-icon-plusthick');
64-
74+
6575
if(this.cfg.toggleOrientation === 'vertical')
6676
this.slideUp();
6777
else if(this.cfg.toggleOrientation === 'horizontal')
6878
this.slideLeft();
6979
},
70-
71-
slideUp: function() {
80+
81+
slideUp: function() {
7282
this.content.slideUp(this.cfg.toggleSpeed, 'easeInOutCirc');
7383
},
74-
75-
slideDown: function() {
84+
85+
slideDown: function() {
7686
this.content.slideDown(this.cfg.toggleSpeed, 'easeInOutCirc');
7787
},
78-
88+
7989
slideLeft: function() {
80-
var _self = this;
81-
90+
var $this = this;
91+
8292
this.originalWidth = this.jq.width();
83-
93+
8494
this.title.hide();
8595
this.toggler.hide();
8696
this.content.hide();
8797

8898
this.jq.animate({
8999
width: '42px'
90100
}, this.cfg.toggleSpeed, 'easeInOutCirc', function() {
91-
_self.toggler.show();
92-
_self.jq.addClass('ui-panel-collapsed-h');
101+
$this.toggler.show();
102+
$this.jq.addClass('ui-panel-collapsed-h');
93103
});
94104
},
95-
105+
96106
slideRight: function() {
97-
var _self = this,
107+
var $this = this,
98108
expandWidth = this.originalWidth||'100%';
99-
109+
100110
this.toggler.hide();
101-
111+
102112
this.jq.animate({
103113
width: expandWidth
104114
}, this.cfg.toggleSpeed, 'easeInOutCirc', function() {
105-
_self.jq.removeClass('ui-panel-collapsed-h');
106-
_self.title.show();
107-
_self.toggler.show();
108-
109-
_self.content.css({
115+
$this.jq.removeClass('ui-panel-collapsed-h');
116+
$this.title.show();
117+
$this.toggler.show();
118+
119+
$this.content.css({
110120
'visibility': 'visible'
111121
,'display': 'block'
112122
,'height': 'auto'
113123
});
114124
});
115125
},
116-
126+
117127
toggleState: function(collapsed, removeIcon, addIcon) {
118128
this.toggler.children('span.ui-icon').removeClass(removeIcon).addClass(addIcon);
119129
this.cfg.collapsed = collapsed;
120130
this.toggleStateHolder.val(collapsed);
121-
131+
122132
this.fireToggleEvent();
123133
},
124-
134+
125135
fireToggleEvent: function() {
126136
if(this.cfg.behaviors) {
127137
var toggleBehavior = this.cfg.behaviors['toggle'];
128-
138+
129139
if(toggleBehavior) {
130140
toggleBehavior.call(this);
131141
}
132142
}
133143
},
134-
144+
135145
close: function() {
136146
if(this.visibleStateHolder) {
137147
this.visibleStateHolder.val(false);
138148
}
139-
149+
140150
var $this = this;
141151
this.jq.fadeOut(this.cfg.closeSpeed,
142152
function(e) {
@@ -149,7 +159,7 @@ PrimeFaces.widget.Panel = PrimeFaces.widget.BaseWidget.extend({
149159
}
150160
);
151161
},
152-
162+
153163
show: function() {
154164
var $this = this;
155165
$(this.jqId).fadeIn(this.cfg.closeSpeed, function() {
@@ -158,25 +168,31 @@ PrimeFaces.widget.Panel = PrimeFaces.widget.BaseWidget.extend({
158168

159169
this.visibleStateHolder.val(true);
160170
},
161-
171+
162172
bindToggler: function() {
163-
var _self = this;
164-
173+
var $this = this;
174+
165175
this.toggler = $(this.jqId + '_toggler');
166176
this.toggleStateHolder = $(this.jqId + '_collapsed');
167177

168-
this.toggler.click(function() {_self.toggle();});
178+
this.toggler.click(function() {
179+
$this.toggle();
180+
181+
return false;
182+
});
169183
},
170-
184+
171185
bindCloser: function() {
172186
var $this = this;
173-
187+
174188
this.closer = $(this.jqId + '_closer');
175189
this.visibleStateHolder = $(this.jqId + "_visible");
176190

177191
this.closer.click(function(e) {
178192
$this.close();
179193
e.preventDefault();
194+
195+
return false;
180196
});
181197
}
182198

0 commit comments

Comments
 (0)