Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
commit 05e4fa92e8c8333ba2c6258165672b60d762f209 Author: Bohuslav Kabrda bkabrda@redhat.com Date: Fri Feb 1 12:25:56 2013 +0100
Add a view function for fulltext; alter the template a bit to display the search text
coprs_frontend/coprs/static/copr.css | 5 +++++ coprs_frontend/coprs/templates/coprs/show.html | 9 ++++++--- .../coprs/views/coprs_ns/coprs_general.py | 12 ++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/coprs_frontend/coprs/static/copr.css b/coprs_frontend/coprs/static/copr.css index a014c68..c5c6f3b 100644 --- a/coprs_frontend/coprs/static/copr.css +++ b/coprs_frontend/coprs/static/copr.css @@ -137,6 +137,11 @@ div.copr .repos { color: #808080; }
+div.search-results { + font-size: 1.3em; + text-align: center; +} + div.add-copr { background-color: #ececec; padding: 0.5em; diff --git a/coprs_frontend/coprs/templates/coprs/show.html b/coprs_frontend/coprs/templates/coprs/show.html index 0b98ed1..c28ebcc 100644 --- a/coprs_frontend/coprs/templates/coprs/show.html +++ b/coprs_frontend/coprs/templates/coprs/show.html @@ -17,6 +17,9 @@ {% if g.user %} <div class="add-copr">+ <a href={{ url_for('coprs_ns.copr_add') }}>add a new Copr</a></div> {% endif %} + {% if fulltext %} + <div class="search-results">Displaying results for search "{{ fulltext }}"</div> + {% endif %} {% for copr in coprs %} <div class="copr"> <a href="{{ url_for('coprs_ns.copr_detail', username = copr.owner.name, coprname = copr.name) }}">{{ copr.owner.name }}/{{ copr.name }}</a> @@ -30,8 +33,8 @@ {% else %} <p>No coprs...</p> {% endfor %} - <div class="pagination"> - {{ render_pagination(request, paginator) }} - </div> + <div class="pagination"> + {{ render_pagination(request, paginator) }} + </div> </div> {% endblock %} diff --git a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py index 4e5172a..fb00e4c 100644 --- a/coprs_frontend/coprs/views/coprs_ns/coprs_general.py +++ b/coprs_frontend/coprs/views/coprs_ns/coprs_general.py @@ -51,6 +51,18 @@ def coprs_by_allowed(username=None, page=1): coprs = paginator.sliced_query return flask.render_template('coprs/show.html', coprs=coprs, paginator=paginator)
+@coprs_ns.route('/fulltext/', defaults = {'page': 1}) +@coprs_ns.route('/fulltext/int:page/') +def coprs_fulltext_search(page=1): + fulltext = flask.request.args.get('fulltext', '') + query = coprs_logic.CoprsLogic.get_multiple_fulltext(flask.g.user, fulltext) + paginator = helpers.Paginator(query, query.count(), page) + + coprs = paginator.sliced_query + return flask.render_template('coprs/show.html', + coprs=coprs, + paginator=paginator, + fulltext=fulltext)
@coprs_ns.route('/add/') @login_required
copr-devel@lists.fedorahosted.org