Inline help engine complete; beginnings of Markdown inline help

This commit is contained in:
Eston Bond
2010-11-17 00:55:08 -08:00
parent c993099c9c
commit 4a990330dc
2 changed files with 21 additions and 15 deletions
@@ -508,10 +508,6 @@
$_SELECTOR: null, $_SELECTOR: null,
changeFormat: function( newFormat ) {
},
evtChangeFormat: function( e ) { evtChangeFormat: function( e ) {
var newMarkup = $(this).val(); var newMarkup = $(this).val();
LanguageDefinition.setActiveLanguage( newMarkup ); LanguageDefinition.setActiveLanguage( newMarkup );
@@ -552,6 +548,9 @@
} }
$('#function-help').unbind('click'); $('#function-help').unbind('click');
$('#function-help').click( Help.evtHelpButtonClick ); $('#function-help').click( Help.evtHelpButtonClick );
// generate help menus
Help.generateHelpMenuFor( name );
} }
} else { } else {
if ( $('#function-help').length ) { if ( $('#function-help').length ) {
@@ -594,26 +593,29 @@
} }
// generate parent submenu on first run // generate parent submenu on first run
Help.generateSubMenu( helpData[0] ); Help.generateSubMenu( helpData[0], 0 );
$($('#gollum-editor-help-list li a').get(0)).click();
}, },
generateSubMenu: function( subData ) { generateSubMenu: function( subData, index ) {
$('#gollum-editor-help-list').html(''); $('#gollum-editor-help-list').html('');
$('#gollum-editor-help-content').html(''); $('#gollum-editor-help-content').html('');
for ( var i=0; i < subData.content.length; i++ ) { for ( var i=0; i < subData.content.length; i++ ) {
if ( typeof subData.content[i] != 'object' ) break; if ( typeof subData.content[i] != 'object' ) break;
var $subLi = $('<li><a href="#" rel="' + i + ':' + j + '">' + var $subLi = $('<li><a href="#" rel="' + index + ':' + i + '">' +
helpData[i].content[j].menuName + '</a></li>'); subData.content[i].menuName + '</a></li>');
$('#gollum-editor-help-list').append( $subLi ); $('#gollum-editor-help-list').append( $subLi );
$subLi.children('a').click( Help.evtSubMenuClick ); $subLi.children('a').click( Help.evtSubMenuClick );
} }
}, },
showHelp: function( index1, index2 ) { showHelpFor: function( index1, index2 ) {
var html = Help._HELP[_ACTIVE_HELP_LANG][index1].content[index2].data; var html =
Help._HELP[Help._ACTIVE_HELP_LANG][index1].content[index2].data;
$('#gollum-editor-help-content').html(html); $('#gollum-editor-help-content').html(html);
}, },
@@ -647,6 +649,7 @@
} }
$('#function-help').unbind('click'); $('#function-help').unbind('click');
$('#function-help').click( Help.evtHelpButtonClick ); $('#function-help').click( Help.evtHelpButtonClick );
Help.generateHelpMenuFor( name );
} }
} }
}, },
@@ -675,19 +678,22 @@
}, },
evtParentMenuClick: function( e ) { evtParentMenuClick: function( e ) {
e.preventDefault();
// short circuit if we've selected this already // short circuit if we've selected this already
if ( $(this).hasClass('selected') ) return; if ( $(this).hasClass('selected') ) return;
// populate from help data for this // populate from help data for this
var helpIndex = $(this).attr('rel'); var helpIndex = $(this).attr('rel');
var subData = Help._HELP[Help._ACTIVE_HELP][helpIndex]; var subData = Help._HELP[Help._ACTIVE_HELP_LANG][helpIndex];
$('#gollum-editor-help-content li a').removeClass('selected'); $('#gollum-editor-help-parent li a').removeClass('selected');
$(this).addClass('selected'); $(this).addClass('selected');
Help.generateSubMenu( subData ); Help.generateSubMenu( subData, helpIndex );
$($('#gollum-editor-help-list li a').get(0)).click();
}, },
evtSubMenuClick: function( e ) { evtSubMenuClick: function( e ) {
e.preventDefault();
if ( $(this).hasClass('selected') ) return; if ( $(this).hasClass('selected') ) return;
// split index rel data // split index rel data
@@ -147,7 +147,7 @@ var MarkDownHelp = [
menuName: 'Links and Images', menuName: 'Links and Images',
content: [ content: [
{ {
menuName: 'Links and Images', menuName: 'Links',
data: '<p>Links and Images go here</p>' data: '<p>Links and Images go here</p>'
} }
] ]