Skip to content

Commit

Permalink
Merge branch 'dialogToCodeStandards' of https://github.com/StevenBlac…
Browse files Browse the repository at this point in the history
…k/jquery-mobile into StevenBlack

Fixed Conflicts:
	js/jquery.mobile.dialog.js
  • Loading branch information
jblas committed May 31, 2011
2 parents 991db0d + ab76ac3 commit a5d3c05
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions js/jquery.mobile.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,58 @@
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* Note: Code is in draft form and is subject to change
*/
(function($, undefined ) {
( function( $, undefined ) {
$.widget( "mobile.dialog", $.mobile.widget, {
options: {
closeBtnText: "Close"
},
_create: function(){
_create: function() {
var self = this,
$el = self.element;

/* class the markup for dialog styling */
this.element
//add ARIA role
.attr("role","dialog")
.addClass('ui-page ui-dialog ui-body-a')
.attr( "role", "dialog" )
.addClass( "ui-page ui-dialog ui-body-a" )
.find( ":jqmData(role=header)" )
.addClass('ui-corner-top ui-overlay-shadow')
.addClass( "ui-corner-top ui-overlay-shadow" )
.prepend( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "rel='back' data-" + $.mobile.ns + "iconpos='notext'>"+ this.options.closeBtnText +"</a>" )
.end()
.find('.ui-content:not([class*="ui-body-"])')
.addClass('ui-body-c')
.find( '.ui-content:not([class*="ui-body-"])' )
.addClass( 'ui-body-c' )
.end()
.find( ".ui-content,:jqmData(role='footer')" )
.last()
.addClass('ui-corner-bottom ui-overlay-shadow');
.addClass( "ui-corner-bottom ui-overlay-shadow" );

/* bind events
- clicks and submits should use the closing transition that the dialog opened with
unless a data-transition is specified on the link/form
- if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally
*/
this.element
.bind( "vclick submit", function(e){
var $targetel;
this.element
.bind( "vclick submit", function( e ) {
var $target;
if( e.type == "vclick" ){
$targetel = $(e.target).closest("a");
$target = $( e.target ).closest( "a" );
}
else{
$targetel = $(e.target).closest("form");
$target = $( e.target ).closest( "form" );
}

if( $targetel.length && !$targetel.jqmData("transition") ){
if( $target.length && !$target.jqmData("transition") ){
var active = $.mobile.urlHistory.getActive() || {};
$targetel
.attr("data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
.attr("data-" + $.mobile.ns + "direction", "reverse");
$target
.attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) )
.attr( "data-" + $.mobile.ns + "direction", "reverse" );
}
});

},

//close method goes back in history
close: function(){
close: function() {
window.history.back();
}
});
})( jQuery );
})( jQuery );

0 comments on commit a5d3c05

Please sign in to comment.