diff --git a/controller/Notebooks.py b/controller/Notebooks.py index 2f977d1..4ab407f 100644 --- a/controller/Notebooks.py +++ b/controller/Notebooks.py @@ -151,6 +151,18 @@ class Notebooks( object ): notebook = result[ u"notebook" ] + # if this is a forum thread notebook, redirect to the forum thread page + forum_tags = [ tag for tag in notebook.tags if tag.name == u"forum" ] + if forum_tags: + forum_name = forum_tags[ 0 ].value + redirect = u"/forums/%s/%s" % ( forum_name, notebook_id ) + if note_id: + redirect += u"?note_id=%s" % note_id + + return dict( + redirect = redirect, + ) + if notebook.name != u"Luminotes": result[ "recent_notes" ] = self.__database.select_many( Note, notebook.sql_load_notes( start = 0, count = 10 ) ) diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 96d4cd7..4247719 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -1849,6 +1849,11 @@ Wiki.prototype.display_search_results = function ( result ) { if ( this.search_results_editor ) this.search_results_editor.shutdown(); + if ( /^\/forums/.test( window.location.pathname ) ) + var notebook_word = "discussion"; + else + var notebook_word = "notebook"; + var list = createDOM( "span", {} ); var other_notebooks_section = false; @@ -1879,9 +1884,9 @@ Wiki.prototype.display_search_results = function ( result ) { if ( !other_notebooks_section ) { other_notebooks_section = true; if ( i == 0 ) - appendChildNodes( list, createDOM( "p", {}, "No matching notes in this notebook." ) ); + appendChildNodes( list, createDOM( "p", {}, "No matching notes in this " + notebook_word + "." ) ); - appendChildNodes( list, createDOM( "hr" ), createDOM( "h4", {}, "other notebooks" ) ); + appendChildNodes( list, createDOM( "hr" ), createDOM( "h4", {}, "other " + notebook_word + "s" ) ); } }