From 0c95738640de4ca13029d02f6fefbfa7bf788066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= Date: Fri, 10 Aug 2012 21:36:10 +0000 Subject: go to view if only one search result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Asbjørn Sloth Tønnesen --- web/js/labitrack.d/55-search.coffee | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'web/js/labitrack.d') 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 -- cgit v1.2.1