[Groonga-commit] nroonga/norema [master] Extract urlForSearch helpter

Back to archive index

Yoji SHIDARA null+****@clear*****
Tue Aug 21 14:57:29 JST 2012


Yoji SHIDARA	2012-08-21 14:57:29 +0900 (Tue, 21 Aug 2012)

  New Revision: 0af35f4b779b82dc268dc5f5d82e6963d9912b74
  https://github.com/nroonga/norema/commit/0af35f4b779b82dc268dc5f5d82e6963d9912b74

  Log:
    Extract urlForSearch helpter

  Modified files:
    lib/server.js
    views/search.jade

  Modified: lib/server.js (+5 -1)
===================================================================
--- lib/server.js    2012-08-21 14:27:16 +0900 (2418990)
+++ lib/server.js    2012-08-21 14:57:29 +0900 (1e55ee4)
@@ -64,6 +64,10 @@ function titleToId(title) {
     .replace(/^_|_$/g, '');
 }
 
+function urlForSearch(options) {
+  return "/search?"+querystring.stringify(options);
+}
+
 // routings
 app.get('/', function(request, response){
   return response.render('index.jade', {query: ''});
@@ -79,7 +83,7 @@ app.get('/search', function(request, response, next) {
     }
 
     var locals = {
-      querystring: querystring,
+      urlForSearch: urlForSearch,
       titleToId: titleToId,
       query: query,
       records: results.hits.hit,

  Modified: views/search.jade (+1 -1)
===================================================================
--- views/search.jade    2012-08-21 14:27:16 +0900 (38c1129)
+++ views/search.jade    2012-08-21 14:57:29 +0900 (752865b)
@@ -24,7 +24,7 @@ block content
             p.path
               each title, pathIndex in record.data.path
                 span
-                  a(href="/search?"+querystring.stringify({query: title}))
+                  a(href=urlForSearch({query: title}))
                     = title
                 if pathIndex != record.data.path.length - 1
                   span  » 
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index