Skip to content

Commit 970bf13

Browse files
committed
add search only this trac feature
1 parent 7bded73 commit 970bf13

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGES.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
1.7.8 (unreleased)
22
------------------
33

4-
- Nothing changed yet.
4+
- add 'search only this trac' feature [amleczko]
55

66

77
1.7.7 (2013-05-09)

por/dashboard/skins/main_template.pt

+4-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@
108108
</ul>
109109
<form class="navbar-form pull-left" tal:condition="request.has_permission('search', context)"
110110
action="${request.application_url}/search">
111-
<div class="input-append">
111+
<div class="input-append input-prepend">
112+
<span tal:condition="trac | nothing" class="add-on">
113+
<input type="checkbox" checked="1" class="inputSelect" name="tracs" value="${trac}"> Only this trac:
114+
</span>
112115
<input class="input-large" name="searchable" type="text" value="${request.params.get('searchable')}">
113116
<span class="add-on"><i class="icon-search"></i></span>
114117
</div>

por/dashboard/views.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import itertools
33
import os
4+
import re
45

56
from zope.interface import implements
67
from pyramid.response import Response
@@ -224,7 +225,11 @@ def view_navbar(request):
224225
"""
225226
Navbar is rendered separately, and served to Trac via ajax.
226227
"""
227-
return {}
228+
trac = re.search('/trac/(?P<trac>[a-zA-z0-9\-_]+)',request.environ.get('HTTP_REFERER', ''))
229+
if trac:
230+
return {'trac':trac.group('trac')}
231+
else:
232+
return {}
228233

229234

230235
@view_config(name='change_cr_placement', renderer='json', permission='view_home', request_method='POST')

0 commit comments

Comments
 (0)