From 85b6b2047e1817e767050ed9152914f501b069ad Mon Sep 17 00:00:00 2001 From: Jeremy Goecks Date: Thu, 3 Dec 2009 14:39:21 -0500 Subject: [PATCH] Bug fixes for 'insert history' operation in pages. --- lib/galaxy/web/controllers/history.py | 8 +++++--- templates/page/editor.mako | 24 +++++++++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/galaxy/web/controllers/history.py b/lib/galaxy/web/controllers/history.py index b85011a924a..a6e75b56ca9 100644 --- a/lib/galaxy/web/controllers/history.py +++ b/lib/galaxy/web/controllers/history.py @@ -387,12 +387,14 @@ class HistoryController( BaseController ): def set_importable_async( self, trans, id=None, importable=False ): """ Set history's importable attribute. """ history = get_history( trans, id, True ) - - if history: + + # Only set if importable value would change; this prevents a change in the update_time unless attribute really changed. + importable = importable in ['True', 'true', 't']; + if history and history.importable != importable: history.importable = importable trans.sa_session.flush() - return + return result @web.expose def name_autocomplete_data( self, trans, q=None, limit=None, timestamp=None ): diff --git a/templates/page/editor.mako b/templates/page/editor.mako index ff00e956ea2..c07ce76a005 100644 --- a/templates/page/editor.mako +++ b/templates/page/editor.mako @@ -232,23 +232,29 @@ // Insert link. wym._exec(WYMeditor.CREATE_LINK, sStamp); - if ( $("a[href=" + sStamp + "]", wym._doc.body).length != 0) - { - // Link created from selected text; add href and title. - $("a[href=" + sStamp + "]", wym._doc.body) - .attr(WYMeditor.HREF, '${h.url_for( controller='history', action='view' )}' + '?id=' + item_id) - .attr(WYMeditor.TITLE, "History" + item_id); - } - else + var link_text = $("a[href=" + sStamp + "]", wym._doc.body).text(); + if ( + link_text == "" // Firefox. + || + link_text == sStamp // Safari + ) { // User selected no text; create link from scratch and use default text. // Get history name. $.get( '${h.url_for( controller='history', action='get_name_async' )}?id=' + item_id, function( history_name ) { var href = '${h.url_for( controller='history', action='view' )}?id=' + item_id; - wym.insert("History '" + history_name + "'"); + wym.insert("History '" + history_name + "'nbsp;"); }); } + else + { + // Link created from selected text; add href and title. + $("a[href=" + sStamp + "]", wym._doc.body) + .attr(WYMeditor.HREF, '${h.url_for( controller='history', action='view' )}' + '?id=' + item_id) + .attr(WYMeditor.TITLE, "History" + item_id); + } + }); hide_modal();