Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created May 13, 2015 19:31
Show Gist options
  • Save beckettkev/d09a154a478c17ff232b to your computer and use it in GitHub Desktop.
Save beckettkev/d09a154a478c17ff232b to your computer and use it in GitHub Desktop.
( function ( my, $ ) {
//Implements the modal logic on the create article button
my.CreateArticleButton = function ( ) {
var _src = 'MyCompany.MyProject.CreateArticleButton';
//if the button is pressed we load the article creation modal
var _dialog = function ( ) {
console.log ( _src + '.dialog initiating modal window' )
var _options = {
tite : 'Create News Item',
url : _spPageContextInfo.siteServerRelativeUrl + '/Style Library/MyProject/Modal/createarticle.aspx?IsDlg=1',
​ allowMaximize : false,
dialogReturnValueCallback : _close
};
SP.SOD.execute ( 'sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', _options );
console.log ( _src + '.dialog loading modal window' );
};
var _close = function ( ) {
console.log ( _src + '.close modal window' );
};​
( function ( ) {
//auto execute code for click event
console.log ( _src + ' initiating modal script' );
_dialog ( );
})( );
};
//DO OTHER STUFF…
} ) ( MyCompany.MyProject = MyCompany.MyProject || { }, jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment