-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #756 from fpcorso/dev
6.2.0 Release
- Loading branch information
Showing
31 changed files
with
2,237 additions
and
1,397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,56 @@ | ||
|
||
/** | ||
* Main admin file for functions to be used across many QSM admin pages. | ||
*/ | ||
var QSMAdmin; | ||
(function ($) { | ||
|
||
QSMAdmin = { | ||
selectTab: function( tab ) { | ||
$( '.qsm-tab' ).removeClass( 'nav-tab-active' ); | ||
$( '.qsm-tab-content' ).hide(); | ||
tab.addClass( 'nav-tab-active' ); | ||
tabID = tab.data( 'tab' ); | ||
$( '.tab-' + tabID ).show(); | ||
} | ||
}; | ||
$(function() { | ||
$( '.qsm-tab' ).on( 'click', function( event ) { | ||
event.preventDefault(); | ||
QSMAdmin.selectTab( $( this ) ); | ||
}); | ||
}); | ||
}(jQuery)); | ||
QSMAdmin = { | ||
/** | ||
* Catches an error from a jQuery function (i.e. $.ajax()) | ||
*/ | ||
displayjQueryError: function( jqXHR, textStatus, errorThrown ) { | ||
QSMAdmin.displayAlert( 'Error: ' + errorThrown + '! Please try again.', 'error' ); | ||
}, | ||
/** | ||
* Catches an error from a BackBone function (i.e. model.save()) | ||
*/ | ||
displayError: function( jqXHR, textStatus, errorThrown ) { | ||
QSMAdmin.displayAlert( 'Error: ' + errorThrown.errorThrown + '! Please try again.', 'error' ); | ||
}, | ||
/** | ||
* Displays an alert within the "Quiz Settings" page | ||
* | ||
* @param string message The message of the alert | ||
* @param string type The type of alert. Choose from 'error', 'info', 'success', and 'warning' | ||
*/ | ||
displayAlert: function( message, type ) { | ||
QSMAdmin.clearAlerts(); | ||
var template = wp.template( 'notice' ); | ||
var data = { | ||
message: message, | ||
type: type | ||
}; | ||
$( '.qsm-alerts' ).append( template( data ) ); | ||
}, | ||
clearAlerts: function() { | ||
$( '.qsm-alerts' ).empty(); | ||
}, | ||
selectTab: function( tab ) { | ||
$( '.qsm-tab' ).removeClass( 'nav-tab-active' ); | ||
$( '.qsm-tab-content' ).hide(); | ||
tab.addClass( 'nav-tab-active' ); | ||
tabID = tab.data( 'tab' ); | ||
$( '.tab-' + tabID ).show(); | ||
} | ||
}; | ||
$(function() { | ||
$( '.qsm-tab' ).on( 'click', function( event ) { | ||
event.preventDefault(); | ||
QSMAdmin.selectTab( $( this ) ); | ||
}); | ||
|
||
jQuery("#qmn_check_all").change( function() { | ||
jQuery('.qmn_delete_checkbox').prop( 'checked', jQuery('#qmn_check_all').prop('checked') ); | ||
}); | ||
$( '#qmn_check_all' ).change( function() { | ||
$( '.qmn_delete_checkbox' ).prop( 'checked', jQuery( '#qmn_check_all' ).prop( 'checked' ) ); | ||
}); | ||
}); | ||
}(jQuery)); |
Oops, something went wrong.