Commit 8050a7c1c184064527727b96974b4115b249ea1f

Authored by Matheus Fernandes
1 parent 47e53072
Exists in search_block

Refactoring search page (filters)

Depdends #90 to continue

Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com>
Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
colab/search/templates/search/includes/search_filters.html
@@ -91,89 +91,97 @@ @@ -91,89 +91,97 @@
91 <br /><br /><hr /> 91 <br /><br /><hr />
92 {% endif %} 92 {% endif %}
93 93
94 -<h4>{% trans "Sort by" %}</h4>  
95 -<ul class="unstyled-list">  
96 - {% for option, dict_order in order_data.items %}  
97 - <li>  
98 - <span class="glyphicon glyphicon-chevron-right"></span>  
99 - <a href="{% append_to_get order=option p=1 %}">  
100 - {% ifequal request.GET.order option %}  
101 - <strong>{{ dict_order.name }}</strong>  
102 - {% else %}  
103 - {{ dict_order.name }}  
104 - {% endifequal %}  
105 - </a>  
106 - </li>  
107 - {% endfor %}  
108 -</ul> 94 +<div class="row">
  95 +
  96 + <div class="col-md-3">
  97 + <h4>{% trans "Sort by" %}</h4>
  98 + <ul class="unstyled-list">
  99 + {% for option, dict_order in order_data.items %}
  100 + <li>
  101 + <span class="glyphicon glyphicon-chevron-right"></span>
  102 + <a href="{% append_to_get order=option p=1 %}">
  103 + {% ifequal request.GET.order option %}
  104 + <strong>{{ dict_order.name }}</strong>
  105 + {% else %}
  106 + {{ dict_order.name }}
  107 + {% endifequal %}
  108 + </a>
  109 + </li>
  110 + {% endfor %}
  111 + </ul>
  112 + </div>
109 113
110 {% if not request.GET.type %} 114 {% if not request.GET.type %}
111 - <h4>{% trans "Types" %}</h4> 115 + <div class="col-md-6">
  116 + <h4>{% trans "Types" %}</h4>
112 117
113 - <ul class="unstyled-list"> 118 + <ul class="unstyled-list">
114 119
115 - <li>  
116 - <span class="glyphicon glyphicon-envelope"></span>  
117 - <a href="{% append_to_get type='thread' %}">{% trans "Discussion" %}</a>  
118 - </li>  
119 - </ul> 120 + <li>
  121 + <span class="glyphicon glyphicon-envelope"></span>
  122 + <a href="{% append_to_get type='thread' %}">{% trans "Discussion" %}</a>
  123 + </li>
  124 + </ul>
  125 + </div>
120 {% endif %} 126 {% endif %}
121 -<hr />  
122 127
123 -<!-- Desktop since and date filters -->  
124 -<form role="form" class="hidden-sm hidden-xs">  
125 - {% for name, value in request.GET.items %}  
126 - {% if value and not name == "since" and not name == "until" %}  
127 - <input type="hidden" name="{{ name }}" value="{{ value }}" />  
128 - {% endif %}  
129 - {% endfor %} 128 + <div class="col-md-3">
  129 + <!-- Desktop since and date filters -->
  130 + <form role="form" class="hidden-sm hidden-xs">
  131 + {% for name, value in request.GET.items %}
  132 + {% if value and not name == "since" and not name == "until" %}
  133 + <input type="hidden" name="{{ name }}" value="{{ value }}" />
  134 + {% endif %}
  135 + {% endfor %}
130 136
131 - <div class="form-group">  
132 - <label for="since">{% trans "Since" %}</label>  
133 - <div class="input-group date" id="datepicker_since">  
134 - <input type="text" class="form-control" placeholder="{% trans "Since" %}" name="since" value="{{ request.GET.since }}" />  
135 - <span class="input-group-addon">  
136 - <span class="glyphicon glyphicon-calendar"></span>  
137 - </span>  
138 - </div>  
139 - </div>  
140 - <div class="form-group">  
141 - <label for="until">{% trans "Until" %}</label>  
142 - <div class="input-group date" id="datepicker_until">  
143 - <input type="text" class="form-control" placeholder="{% trans "Until" %}" name="until" value="{{ request.GET.until }}" />  
144 - <span class="input-group-addon">  
145 - <span class="glyphicon glyphicon-calendar"></span>  
146 - </span>  
147 - </div>  
148 - </div> 137 + <div class="form-group">
  138 + <label for="since">{% trans "Since" %}</label>
  139 + <div class="input-group date" id="datepicker_since">
  140 + <input type="text" class="form-control" placeholder="{% trans "Since" %}" name="since" value="{{ request.GET.since }}" />
  141 + <span class="input-group-addon">
  142 + <span class="glyphicon glyphicon-calendar"></span>
  143 + </span>
  144 + </div>
  145 + </div>
  146 + <div class="form-group">
  147 + <label for="until">{% trans "Until" %}</label>
  148 + <div class="input-group date" id="datepicker_until">
  149 + <input type="text" class="form-control" placeholder="{% trans "Until" %}" name="until" value="{{ request.GET.until }}" />
  150 + <span class="input-group-addon">
  151 + <span class="glyphicon glyphicon-calendar"></span>
  152 + </span>
  153 + </div>
  154 + </div>
149 155
150 - <p class="text-right">  
151 - <button type="submit" class="btn btn-default">  
152 - <span class="glyphicon glyphicon-filter"></span> {% trans "Filter" %}  
153 - </button>  
154 - </p>  
155 -</form> 156 + <p class="text-right">
  157 + <button type="submit" class="btn btn-default">
  158 + <span class="glyphicon glyphicon-filter"></span> {% trans "Filter" %}
  159 + </button>
  160 + </p>
  161 + </form>
156 162
157 -<!-- Mobile since and date filters -->  
158 -<form role="form" class="hidden-md hidden-lg">  
159 - {% for name, value in request.GET.items %}  
160 - {% if value and not name == "since" and not name == "until" %}  
161 - <input type="hidden" name="{{ name }}" value="{{ value }}" />  
162 - {% endif %}  
163 - {% endfor %} 163 + <!-- Mobile since and date filters -->
  164 + <form role="form" class="hidden-md hidden-lg">
  165 + {% for name, value in request.GET.items %}
  166 + {% if value and not name == "since" and not name == "until" %}
  167 + <input type="hidden" name="{{ name }}" value="{{ value }}" />
  168 + {% endif %}
  169 + {% endfor %}
164 170
165 - <div class="form-group">  
166 - <label for="since">{% trans "Since" %}</label>  
167 - <input type="date" class="form-control" placeholder="{% trans "Since" %}" name="since" value="{{ request.GET.since }}" />  
168 - </div>  
169 - <div class="form-group hidden-md hidden-lg">  
170 - <label for="until">{% trans "Until" %}</label>  
171 - <input type="date" class="form-control" placeholder="{% trans "Until" %}" name="until" value="{{ request.GET.until }}" />  
172 - </div> 171 + <div class="form-group">
  172 + <label for="since">{% trans "Since" %}</label>
  173 + <input type="date" class="form-control" placeholder="{% trans "Since" %}" name="since" value="{{ request.GET.since }}" />
  174 + </div>
  175 + <div class="form-group hidden-md hidden-lg">
  176 + <label for="until">{% trans "Until" %}</label>
  177 + <input type="date" class="form-control" placeholder="{% trans "Until" %}" name="until" value="{{ request.GET.until }}" />
  178 + </div>
173 179
174 - <p class="text-right">  
175 - <button type="submit" class="btn btn-default">  
176 - <span class="glyphicon glyphicon-filter"></span> {% trans "Filter" %}  
177 - </button>  
178 - </p>  
179 -</form> 180 + <p class="text-right">
  181 + <button type="submit" class="btn btn-default">
  182 + <span class="glyphicon glyphicon-filter"></span> {% trans "Filter" %}
  183 + </button>
  184 + </p>
  185 + </form>
  186 + </div>
  187 +</div>
180 \ No newline at end of file 188 \ No newline at end of file
colab/search/templates/search/search.html
@@ -56,7 +56,6 @@ We must use STATIC_URL because we have a language composing the URL @@ -56,7 +56,6 @@ We must use STATIC_URL because we have a language composing the URL
56 <hr/> 56 <hr/>
57 57
58 <div class="row"> 58 <div class="row">
59 -  
60 <form class="col-xs-12 col-sm-12 hidden-md hidden-lg" action="{% url "haystack_search" %}"> 59 <form class="col-xs-12 col-sm-12 hidden-md hidden-lg" action="{% url "haystack_search" %}">
61 <div class="input-group"> 60 <div class="input-group">
62 <input type="text" class="form-control" name="q" placeholder="{% trans "Search here" %}" 61 <input type="text" class="form-control" name="q" placeholder="{% trans "Search here" %}"
@@ -69,13 +68,16 @@ We must use STATIC_URL because we have a language composing the URL @@ -69,13 +68,16 @@ We must use STATIC_URL because we have a language composing the URL
69 </div> 68 </div>
70 </form> 69 </form>
71 <br /> 70 <br />
  71 + </div>
72 72
73 - <div id="filters" class="hidden-xs hidden-sm col-md-2 col-lg-2"> 73 + <div class="row">
  74 + <div id="filters" class="hidden-xs hidden-sm col-md-12">
74 <h3>{% trans "Filters" %}</h3> 75 <h3>{% trans "Filters" %}</h3>
75 {% include "search/includes/search_filters.html" %} 76 {% include "search/includes/search_filters.html" %}
76 </div> 77 </div>
  78 + </div>
77 79
78 - <div class="col-xs-12 col-sm-12 hidden-md hidden-lg"> 80 + <div class="col-xs-12 col-sm-12 hidden-md hidden-lg">
79 <div class="panel-group" id="accordion"> 81 <div class="panel-group" id="accordion">
80 <div class="panel panel-default"> 82 <div class="panel panel-default">
81 <div class="panel-heading subject"> 83 <div class="panel-heading subject">
@@ -95,7 +97,8 @@ We must use STATIC_URL because we have a language composing the URL @@ -95,7 +97,8 @@ We must use STATIC_URL because we have a language composing the URL
95 </div> 97 </div>
96 <hr /> 98 <hr />
97 </div> 99 </div>
98 - 100 +
  101 + <div class="row">
99 <div class="col-md-10 col-lg-10"> 102 <div class="col-md-10 col-lg-10">
100 <ul class="list-unstyled"> 103 <ul class="list-unstyled">
101 {% for result in page.object_list %} 104 {% for result in page.object_list %}
@@ -158,7 +161,6 @@ We must use STATIC_URL because we have a language composing the URL @@ -158,7 +161,6 @@ We must use STATIC_URL because we have a language composing the URL
158 </div> 161 </div>
159 {% endif %} 162 {% endif %}
160 </div> 163 </div>
161 -  
162 </div> 164 </div>
163 165
164 {% endblock %} 166 {% endblock %}