witten
/
luminotes
Archived
1
0
Fork 0

For forum threads, redirect from /notebooks/... URLs to corresponding /forums/... URLs.

This commit is contained in:
Dan Helfman 2008-10-31 15:55:08 -07:00
parent 6708675fec
commit 23bff4d6b2
2 changed files with 19 additions and 2 deletions

View File

@ -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 ) )

View File

@ -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" ) );
}
}