Commit c2cfcc2a by benjaoming

A few search related things... adding search bar (doesnt work yet)

parent 56d8e574
...@@ -350,4 +350,5 @@ class PermissionsForm(PluginSettingsFormMixin, forms.ModelForm): ...@@ -350,4 +350,5 @@ class PermissionsForm(PluginSettingsFormMixin, forms.ModelForm):
class DirFilterForm(forms.Form): class DirFilterForm(forms.Form):
query = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'Filter...')})) query = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'Filter...'),
'class': 'search-query'}))
...@@ -62,6 +62,8 @@ ...@@ -62,6 +62,8 @@
color: #CCC; color: #CCC;
} }
.directory-toolbar .filter-clear { margin-right: 10px; position: relative; top: 5px; }
.accordion-heading h3 {margin: 0;} .accordion-heading h3 {margin: 0;}
.breadcrumb .icon-bar { .breadcrumb .icon-bar {
...@@ -74,6 +76,9 @@ ...@@ -74,6 +76,9 @@
margin-top: 3px; margin-top: 3px;
} }
.breadcrumb .icon-bar:first-child{margin-top: 0;} .breadcrumb .icon-bar:first-child{margin-top: 0;}
#navbar_wiki_search input.search-query {width: 80px;}
</style> </style>
<script src="{{ STATIC_URL }}wiki/js/jquery.min.js"></script> <script src="{{ STATIC_URL }}wiki/js/jquery.min.js"></script>
...@@ -103,6 +108,10 @@ ...@@ -103,6 +108,10 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
</a> </a>
<a class="brand" href="{% url 'wiki:root' %}">django-wiki</a> <a class="brand" href="{% url 'wiki:root' %}">django-wiki</a>
<form class="navbar-search pull-right" id="navbar_wiki_search" method="GET" action="asdsd">
<span class="icon-search"></span>
<input type="text" class="search-query" placeholder="{% trans "Search..." %}" />
</form>
<div class="pull-right"> <div class="pull-right">
{% if user.is_authenticated %} {% if user.is_authenticated %}
<ul class="nav"> <ul class="nav">
......
...@@ -6,32 +6,35 @@ ...@@ -6,32 +6,35 @@
{% block wiki_contents_tab %} {% block wiki_contents_tab %}
<form class="form-search"> {% url 'wiki:dir' urlpath.path as self_url %}
<form class="form-search directory-toolbar">
<div class="well well-small"> <div class="well well-small">
<div class="btn-group pull-left"> <div class="btn-group pull-left">
{% if urlpath.parent %} {% if urlpath.parent %}
<a href="{% url 'wiki:dir' path=urlpath.parent.path %}" class="btn"> <a href="{% url 'wiki:dir' path=urlpath.parent.path %}" class="btn">
<span class="icon-arrow-up"></span> <span class="icon-arrow-up"></span>
{% trans "Go up one level" %} {% trans "Up one level" %}
</a> </a>
{% endif %} {% endif %}
<a href="{% url 'wiki:create' path=urlpath.path %}" class="btn"> <a href="{% url 'wiki:create' path=urlpath.path %}" class="btn">
<span class="icon-plus"></span> <span class="icon-plus"></span>
{% trans "Add article in this level" %} {% trans "Add article" %}
</a> </a>
</div> </div>
<div class="pull-right"> <div class="pull-right">
{{ filter_form.query }} {{ filter_form.query }}
<button class="btn">
<span class="icon-search"></span>
</button>
</div> </div>
{% if filter_query %}
<div class="pull-right filter-clear">
<a href="{{ self_url }}">({% trans "clear" %})</a>
</div>
{% endif %}
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</form> </form>
{% url 'wiki:get' urlpath.path as self_url %}
<p> <p>
{% with paginator.object_list.count as cnt %} {% with paginator.object_list.count as cnt %}
{% blocktrans with urlpath.path as path and cnt|pluralize:_("article,articles") as articles_plur and cnt|pluralize:_("is,are") as articles_plur_verb %} {% blocktrans with urlpath.path as path and cnt|pluralize:_("article,articles") as articles_plur and cnt|pluralize:_("is,are") as articles_plur_verb %}
...@@ -40,10 +43,6 @@ ...@@ -40,10 +43,6 @@
{% endwith %} {% endwith %}
</p> </p>
{% if filter_query %}
<p>{% trans "Filtering by" %} <strong>{{ filter_query }}</strong> (<a href="{{ self_url }}">{% trans "clear" %}</a>).</p>
{% endif %}
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>{% trans "Title" %}</th> <th>{% trans "Title" %}</th>
......
...@@ -400,7 +400,7 @@ class History(ListView, ArticleMixin): ...@@ -400,7 +400,7 @@ class History(ListView, ArticleMixin):
return super(History, self).dispatch(request, article, *args, **kwargs) return super(History, self).dispatch(request, article, *args, **kwargs)
class Dir(ListView, ArticleMixin, FormView): class Dir(ListView, ArticleMixin):
template_name="wiki/dir.html" template_name="wiki/dir.html"
allow_empty = True allow_empty = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment