Move filter label options out of JS and into template.

This commit is contained in:
Brian J Brennan 2013-06-06 16:03:21 -04:00
Родитель d5d55e42d4
Коммит 5ed0a58265
2 изменённых файлов: 10 добавлений и 19 удалений

Просмотреть файл

@ -5,15 +5,6 @@ var mob = 0;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) mob = 1
$('.show-tooltip').tooltip();
/*move filter labels into the selectors*/
if($('.navbar.filter').length != 0) {
$('.navbar.filter form label').each(function(){
var selectID = ($(this).attr('for'));
var selectEle = $('#' + selectID);
$('#' + selectID + ' option:first').text($(this).text());
});
}
/*landing page overrides*/
if($('body.home').length != 0) {
@ -39,9 +30,9 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) mob
/*landing page menu rearrange*/
$('<p id="rahm">This summer Mayor Rahm Emanuel is challenging all Chicago youth to participate in the Summer of Learning. School stops for the summer, but learning never should.</p>').prependTo('.footer .upper');
$('<div id="bubbles"><span class="lt">Join the conversation on <a href="https://www.facebook.com/ChicagoSummerOfLearning" target="_blank">Facebook</a>.</span><span class="rt">share stories</span></div>').appendTo('.footer .upper');
/*landing page mobile overrides*/
if(mob) {
if(mob) {
vidLink = '<a href="http://www.youtube.com/v/6WwpwtYNsNk">watch video</a>';
}
@ -56,7 +47,7 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) mob
$('li.challenges a').append('<span> your future.</span>');
} else {
/*non-landing page overrides*/
if(mob) {
if(mob) {
var dynWrap = $('<div id="dynWrap" style="display:none;"></div>');
var dynList = $('<li id="dyn"></li>');
var dynLink = $('<a href="#" title="">Menu</a>').click(function(){
@ -74,4 +65,4 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) mob
});
}
}
});
});

Просмотреть файл

@ -3,7 +3,7 @@
{% block content %}
{% block filter %}
{% if filters %}
{% if filters %}
<div class="navbar filter">
<form class="navbar-inner navbar-form form-inline text-center" method="get">
{% for filter in filters %}
@ -11,17 +11,17 @@
<label for="filter-{{ filter.name }}" class="filter-icon filter-{{ filter.name }}">{{ filter.label }}</label>
{% if filter.options %}
<select id="filter-{{ filter.name }}" name="{{ filter.name }}" class="input-medium{% if filter.class %} {{ filter.class }}{% endif %}">
<option></option>
{% if filter.is_grouped %}
{% for label, options in filter.options %}
<option value="">{{ filter.label }}</option>
{% if filter.is_grouped %}
{% for label, options in filter.options %}
<optgroup label="{{ label }}">
{% for value, label in options %}
<option value="{{ value }}"{% if filter.selected == value %} selected="selected"{% endif %}>{{ label }}</option>
{% endfor %}
</optgroup>
{% endfor %}
{% else %}
{% for item in filter.options %}
{% else %}
{% for item in filter.options %}
<option value="{{ item.value }}"{% if filter.selected == item.value %} selected="selected"{% endif %}>{{ item.label }}</option>
{% endfor %}
{% endif %}