Re-namespace Gollum Dialogs

This commit is contained in:
Eston Bond
2010-11-12 13:38:32 -08:00
parent 00a934b85d
commit 62c5de1414
@@ -12,10 +12,10 @@
markupCreated: false, markupCreated: false,
attachEvents: function( evtOK ) { attachEvents: function( evtOK ) {
$('#gollum-editor-action-ok').click(function( e ) { $('#gollum-dialog-action-ok').click(function( e ) {
Dialog.eventOK( e, evtOK ); Dialog.eventOK( e, evtOK );
}); });
$('#gollum-editor-action-cancel').click( Dialog.eventCancel ); $('#gollum-dialog-action-cancel').click( Dialog.eventCancel );
}, },
createFieldMarkup: function( fieldArray ) { createFieldMarkup: function( fieldArray ) {
@@ -59,7 +59,7 @@
if ( fieldAttributes.type == 'code' ) { if ( fieldAttributes.type == 'code' ) {
html+= ' class="code"'; html+= ' class="code"';
} }
html += ' id="gollum-editor-dialog-generated-field-' + html += ' id="gollum-dialog-dialog-generated-field-' +
fieldAttributes.id + '">'; fieldAttributes.id + '">';
} }
@@ -68,16 +68,16 @@
createMarkup: function( title, body ) { createMarkup: function( title, body ) {
Dialog.markupCreated = true; Dialog.markupCreated = true;
return '<div id="gollum-editor-dialog">' + return '<div id="gollum-dialog-dialog">' +
'<div id="gollum-editor-dialog-inner">' + '<div id="gollum-dialog-dialog-inner">' +
'<div id="gollum-editor-dialog-bg">' + '<div id="gollum-dialog-dialog-bg">' +
'<div id="gollum-editor-dialog-title"><h4>' + '<div id="gollum-dialog-dialog-title"><h4>' +
title +'</h4></div>' + title +'</h4></div>' +
'<div id="gollum-editor-dialog-body">' + body + '</div>' + '<div id="gollum-dialog-dialog-body">' + body + '</div>' +
'<div id="gollum-editor-dialog-buttons">' + '<div id="gollum-dialog-dialog-buttons">' +
'<a href="#" title="Cancel" id="gollum-editor-action-cancel" ' + '<a href="#" title="Cancel" id="gollum-dialog-action-cancel" ' +
'class="minibutton">Cancel</a>' + 'class="minibutton">Cancel</a>' +
'<a href="#" title="OK" id="gollum-editor-action-ok" '+ '<a href="#" title="OK" id="gollum-dialog-action-ok" '+
'class="minibutton">OK</a>' + 'class="minibutton">OK</a>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
@@ -95,7 +95,7 @@
var results = []; var results = [];
// get the results from each field and build them into the object // get the results from each field and build them into the object
$('#gollum-editor-dialog-body input').each(function() { $('#gollum-dialog-dialog-body input').each(function() {
results[$(this).attr('name')] = $(this).val(); results[$(this).attr('name')] = $(this).val();
}); });
@@ -108,10 +108,10 @@
}, },
hide: function() { hide: function() {
$('#gollum-editor-dialog').animate({ opacity: 0 }, { $('#gollum-dialog-dialog').animate({ opacity: 0 }, {
duration: 200, duration: 200,
complete: function() { complete: function() {
$('#gollum-editor-dialog').removeClass('active'); $('#gollum-dialog-dialog').removeClass('active');
} }
}); });
}, },
@@ -137,7 +137,7 @@
} }
if ( Dialog.markupCreated ) { if ( Dialog.markupCreated ) {
$('#gollum-editor-dialog').remove(); $('#gollum-dialog-dialog').remove();
} }
var $dialog = $( Dialog.createMarkup( title, body ) ); var $dialog = $( Dialog.createMarkup( title, body ) );
$('body').append( $dialog ); $('body').append( $dialog );
@@ -153,12 +153,12 @@
debug('Dialog: No markup to show. Please use init first.') debug('Dialog: No markup to show. Please use init first.')
} else { } else {
debug('Showing dialog'); debug('Showing dialog');
$('#gollum-editor-dialog').animate({ opacity: 0 }, { $('#gollum-dialog-dialog').animate({ opacity: 0 }, {
duration: 1, duration: 1,
complete: function() { complete: function() {
$('#gollum-editor-dialog').addClass('active'); $('#gollum-dialog-dialog').addClass('active');
Dialog.position(); // position this thing Dialog.position(); // position this thing
$('#gollum-editor-dialog').animate({ opacity: 1 }, { $('#gollum-dialog-dialog').animate({ opacity: 1 }, {
duration: 500 duration: 500
}); });
} }
@@ -167,9 +167,9 @@
}, },
position: function() { position: function() {
var dialogHeight = $('#gollum-editor-dialog-inner').height(); var dialogHeight = $('#gollum-dialog-dialog-inner').height();
debug(dialogHeight); debug(dialogHeight);
$('#gollum-editor-dialog-inner') $('#gollum-dialog-dialog-inner')
.css('height', dialogHeight + 'px') .css('height', dialogHeight + 'px')
.css('margin-top', -1 * parseInt( dialogHeight / 2 )); .css('margin-top', -1 * parseInt( dialogHeight / 2 ));
} }