[hg] galaxy 3143: Bug fixes for 'insert history' operation in pa...
details: http://www.bx.psu.edu/hg/galaxy/rev/7aaa791a6283 changeset: 3143:7aaa791a6283 user: jeremy goecks <jeremy.goecks@emory.edu> date: Thu Dec 03 14:39:21 2009 -0500 description: Bug fixes for 'insert history' operation in pages. diffstat: lib/galaxy/web/controllers/history.py | 8 +++++--- templates/page/editor.mako | 28 +++++++++++++++++----------- 2 files changed, 22 insertions(+), 14 deletions(-) diffs (65 lines): diff -r b636ff9d0f05 -r 7aaa791a6283 lib/galaxy/web/controllers/history.py --- a/lib/galaxy/web/controllers/history.py Thu Dec 03 14:16:50 2009 -0500 +++ b/lib/galaxy/web/controllers/history.py Thu Dec 03 14:39:21 2009 -0500 @@ -387,12 +387,14 @@ 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 -r b636ff9d0f05 -r 7aaa791a6283 templates/page/editor.mako --- a/templates/page/editor.mako Thu Dec 03 14:16:50 2009 -0500 +++ b/templates/page/editor.mako Thu Dec 03 14:39:21 2009 -0500 @@ -232,23 +232,29 @@ // Insert link. wym._exec(WYMeditor.CREATE_LINK, sStamp); - if ( $("a[href=" + sStamp + "]", wym._doc.body).length != 0) + 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("<a href='" + href + "'>History '" + history_name + "'</a>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); } - else - { - // 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("<a href='" + href + "'>History '" + history_name + "'</a>"); - }); - } + }); hide_modal();
participants (1)
-
Greg Von Kuster