summaryrefslogtreecommitdiffstats
path: root/web/js
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>2012-08-10 21:36:10 +0000
committerAsbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>2012-08-10 21:36:10 +0000
commit0c95738640de4ca13029d02f6fefbfa7bf788066 (patch)
treef4c7e82093f0f41f6256b59acfe1603bedd9394b /web/js
parent802a86a276784601e0a952611bfcfb823831608f (diff)
downloadlabitrack-0c95738640de4ca13029d02f6fefbfa7bf788066.tar.gz
labitrack-0c95738640de4ca13029d02f6fefbfa7bf788066.tar.xz
labitrack-0c95738640de4ca13029d02f6fefbfa7bf788066.zip
go to view if only one search result
Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.biz>
Diffstat (limited to 'web/js')
-rw-r--r--web/js/labitrack.d/55-search.coffee4
1 files changed, 4 insertions, 0 deletions
diff --git a/web/js/labitrack.d/55-search.coffee b/web/js/labitrack.d/55-search.coffee
index 38569af..b0814f2 100644
--- a/web/js/labitrack.d/55-search.coffee
+++ b/web/js/labitrack.d/55-search.coffee
@@ -48,6 +48,10 @@ search = Backbone.View.extend {
pgcnt = Math.ceil(meta.count / 10)
pages = λ.pagination '/search/'+q, page, pgcnt
+ if meta.count is 1
+ url = '/view/' + @collection.at(0).id
+ return Backbone.history.navigate(url, true)
+
data = {
rows: @collection.toJSON(),
pages