Browse Source

UI tweaks.

Rafał Pitoń 11 years ago
parent
commit
c0fff6ab86

+ 1 - 1
misago/apps/search/forms.py

@@ -84,7 +84,7 @@ class ForumsSearchForm(AdvancedSearchForm):
         self.add_field('search_forums', ForumMultipleChoiceField(label=_("Search Forums"),
                                                                  help_text=_("If you want, you can limit search to specified forums."),
                                                                  queryset=Forum.objects.get(special='root').get_descendants().filter(pk__in=self.request.acl.forums.acl['can_browse']),
-                                                                 required=False, empty_label=None))
+                                                                 required=False, empty_label=None, widget=forms.SelectMultiple))
         self.add_field('search_forums_childs', forms.BooleanField(label=_("Include Children Forums"), required=False))
 
 

+ 1 - 1
templates/cranefly/layout.html

@@ -68,7 +68,7 @@
           <li><a href="{{ url('popular_threads') }}" title="{% trans %}Popular Threads{% endtrans %}" class="hot tooltip-bottom"><i class="icon-fire"></i></a></li>
           <li><a href="{{ url('new_threads') }}" title="{% trans %}New Threads{% endtrans %}" class="fresh tooltip-bottom"><i class="icon-leaf"></i></a></li>{% if not user.crawler %}
           {% if acl.search.can_search() and not user.is_crawler() %}
-          <li><a href="{{ url('search_forums') }}" title="{% trans %}Search Forums{% endtrans %}" class="tooltip-bottom"><i class="icon-search"></i></a></li>{% endif %}
+          <li><a href="{{ url('search_forums') }}" title="{% trans %}Search Community{% endtrans %}" class="tooltip-bottom"><i class="icon-search"></i></a></li>{% endif %}
           {% endif %}
           <li><a href="{{ url('users') }}" title="{% trans %}Browse Users{% endtrans %}" class="tooltip-bottom"><i class="icon-group"></i></a></li>
           {% if settings.tos_url or settings.tos_content %}<li><a href="{% if settings.tos_url %}{{ settings.tos_url }}{% else %}{{ url('tos') }}{% endif %}" title="{% if settings.tos_title %}{{ settings.tos_title }}{% else %}{% trans %}Forum Terms of Service{% endtrans %}{% endif %}" class="tooltip-bottom"><i class="icon-certificate"></i></a></li>{% endif %}

+ 1 - 1
templates/cranefly/search/search_forums.html

@@ -26,7 +26,7 @@
         {{ form_theme.row(form.search_thread, attrs={'class': 'span8'}) }}
         {{ form_theme.row(form.search_author, attrs={'class': 'span8'}) }}
         <hr>
-        {{ form_theme.row(form.search_forums, attrs={'class': 'span8'}) }}
+        {{ form_theme.row(form.search_forums, attrs={'class': 'span8', 'size': 8}) }}
         {{ form_theme.row(form.search_forums_childs, attrs={'inline': lang_search_forum_children()}) }}
         <hr>
         {{ form_theme.row(form.search_before, attrs={'class': 'span8 form-datepicker'}) }}

+ 20 - 6
templates/forms.html

@@ -99,10 +99,10 @@
 {{ _yesno(_field, context) }}
 {% elif widget == 'Select' %}
 {{ _select(_field, context) }}
-{% elif widget == 'SelectDateWidget' %}
-{{ _select_date(_field, context) }}
 {% elif widget == 'RadioSelect' %}
 {{ _radio_select(_field, context) }}
+{% elif widget == 'SelectMultiple' %}
+{{ _select_multiple(_field, context) }}
 {% elif widget == 'CheckboxSelectMultiple' %}
 {{ _checkbox_select(_field, context) }}
 {% elif widget == 'ReCaptchaWidget' %}
@@ -148,10 +148,6 @@
 </select>
 {%- endmacro %}
 
-{% macro _select_date(_field, context) -%}
-{{ context }}
-{%- endmacro %}
-
 {% macro _radio_select(_field, context) -%}
 <div class="radio-group">
   {% for option in context['optgroups'][0][1] %}
@@ -163,6 +159,24 @@
 </div>
 {%- endmacro %}
 
+{% macro _select_multiple(_field, context) -%}
+<select id="id_{{ context.name }}" name="{{ context.name }}" {{ attributes(context.attrs)|trim }}>
+  {% if context['optgroups']|length > 1 %}
+  {% for optgroup in context['optgroups'] %}
+  <optgroup label="{{ optgroup[0] }}">
+    {% for option in optgroup[1] %}
+    <option value="{{ option[0] }}"{% if 'value' in context and option[0] in context.value %} selected="selected"{% endif %}>{{ option[1] }}</option>
+    {% endfor %}
+  </optgroup>
+  {% endfor %}
+  {% else %}
+  {% for option in context['optgroups'][0][1] %}
+  <option value="{{ option[0] }}"{% if 'value' in context and option[0] in context.value %} selected="selected"{% endif %}>{{ option[1] }}</option>
+  {% endfor %}
+  {% endif %}
+</select>
+{%- endmacro %}
+
 {% macro _checkbox_select(_field, context) %}
 <div class="select-multiple">
 {% for option in context['optgroups'][0][1] %}