diff --git a/static/scripts/galaxy.panels.js b/static/scripts/galaxy.panels.js index 7950419294e..b107d010f6a 100644 --- a/static/scripts/galaxy.panels.js +++ b/static/scripts/galaxy.panels.js @@ -165,7 +165,7 @@ function hide_modal() { } ); }; -function show_modal( title, body, buttons, extra_buttons ) { +function show_modal( title, body, buttons, extra_buttons, init_fn ) { if ( title ) { $( ".dialog-box" ).find( ".title" ).html( title ); $( ".dialog-box" ).find( ".unified-panel-header" ).show(); @@ -200,6 +200,9 @@ function show_modal( title, body, buttons, extra_buttons ) { $("#overlay").show(); $(".dialog-box-container").fadeIn() } + if ( init_fn ) { + init_fn(); + } }; function show_in_overlay( options ) { diff --git a/templates/page/editor.mako b/templates/page/editor.mako index 5bacc7ad0f8..0fa18e601f0 100644 --- a/templates/page/editor.mako +++ b/templates/page/editor.mako @@ -126,6 +126,25 @@ var sStamp = wym.uniqueStamp(); var selected = wym.selected(); + // Swap out URL attribute for id/name attribute in link creation to enable anchor creation in page. + function set_link_id() + { + // When "set link id" link clicked, update UI. + $('#set_link_id').click( function() + { + // Set label. + $("#link_attribute_label").text("ID/Name"); + + // Set input elt class, value. + var attribute_input = $(".wym_href"); + attribute_input.addClass("wym_id").removeClass("wym_href"); + attribute_input.val( attribute_input.attr('id') ); + + // Remove link. + $(this).remove(); + }); + } + // LINK DIALOG if ( dialogType == WYMeditor.DIALOG_LINK ) { if(selected) { @@ -134,28 +153,45 @@ jQuery(wym._options.titleSelector).val(jQuery(selected).attr(WYMeditor.TITLE)); jQuery(wym._options.altSelector).val(jQuery(selected).attr(WYMeditor.ALT)); } + // Get current URL, title. + var curURL, curTitle; + if (selected) + { + curURL = $(selected).attr("href"); + if (curURL == undefined) + curURL = ""; + curTitle = $(selected).attr("title"); + if (curTitle == undefined) + curTitle = ""; + } show_modal( - "Link", - "