Bug fixes for 'insert history' operation in pages.

This commit is contained in:
Jeremy Goecks
2009-12-03 14:39:21 -05:00
parent cf643df67d
commit 85b6b2047e
2 changed files with 20 additions and 12 deletions
+5 -3
View File
@@ -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 ):
+15 -9
View File
@@ -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("<a href='" + href + "'>History '" + history_name + "'</a>");
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);
}
});
hide_modal();