Commit b3095185 authored by Matthieu Gautier's avatar Matthieu Gautier

Merge branch 'radios-and-themes' into 'master'

Radios and themes

Closes #8 and #12

See merge request !22
parents 0c44386e 259f8dc1
.no-underline {
text-decoration: none;
}
......@@ -3,6 +3,7 @@
{% block extra_head %}
<link rel="stylesheet" type="text/css" href="{% static "mediacenter/mediacenter.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "irfi/overrides.css" %}">
{% endblock %}
{% block body_class %}mediacenter{% endblock %}
......
......@@ -3,13 +3,17 @@
{% if available_themes %}
<div class="card tinted">
<h4><span class="theme discover">{% trans "browse" %}</span> {% trans 'by theme' %}</h4>
{% for theme, label in available_themes %}
{% is_in_qs 'theme' theme as in_qs %}
{% if in_qs %}
<a href="{% remove_qs theme=theme %}" class="flatlist active">{{ label|capfirst }}</a>
{% else %}
<a href="{% replace_qs theme=theme %}" class="flatlist">{{ label|capfirst }}</a>
{% endif %}
{% endfor %}
<ul>
{% for theme, label in available_themes %}
{% is_in_qs 'theme' theme as in_qs %}
<li>
{% if in_qs %}
<a href="{% remove_qs theme=theme %}" class="flatlist no-underline active">{{ label|capfirst }}</a>
{% else %}
<a href="{% replace_qs theme=theme %}" class="flatlist no-underline">{{ label|capfirst }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% load i18n ideascube_tags %}
{% spaceless %}
{% if q or kind or lang or tags or source or theme %}
<div class="filters card tinted">
<h4>{% trans "Filters" %}</h4>
<ul>
{% if q %}
<li>
<a href="{% remove_qs q=q %}">
{{ q }}
<i class="fa fa-close"></i>
</a>
</li>
{% endif %}
{% if kind %}
<li>
<a href="{% remove_qs kind=kind %}">
{{ view.model.KIND_DICT|getitem:kind }}
<i class="fa fa-close"></i>
</a>
</li>
{% endif %}
{% if lang %}
{% with LANG_INFO|getitem:lang as lang_info %}
<li>
<a href="{% remove_qs lang=lang %}">
{{ lang_info.name_local }}
<i class="fa fa-close"></i>
</a>
</li>
{% endwith %}
{% endif %}
{% if source %}
<li>
<a href="{% remove_qs source=source %}">
{{ source_name }}
<i class="fa fa-close"></i>
</a>
</li>
{% endif %}
{% for t in tags %}
<li>
<a href="{% remove_qs tags=t %}">
{{ t|tag_name }}
<i class="fa fa-close"></i>
</a>
</li>
{% endfor %}
{% if theme %}
<li>
<a href="{% remove_qs theme=theme %}">
{{ theme_name }}
<i class="fa fa-close"></i>
</a>
</li>
{% endif %}
</ul>
</div>
{% endif %}
{% endspaceless %}
......@@ -2,18 +2,12 @@
{% load i18n %}
{% block twothird %}
<h2>{% trans 'Radio Name' %}</h4>
<form method="POST" action="">
{% csrf_token %}
<select id="radio_name" name="radio_name">
{% for radio in radios %}
<option value="{{ radio }}"{% if radio == radio_name %} selected="selected"{% endif %}>
{{ radio }}
</option>
{% endfor %}
</select>
<input type="text" id="radio_name" name="radio_name" value="{{ radio_name }}" />
{% comment %}Translators: Do not translate this, the translation is in Ideascube{% endcomment %}
<input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}
......
......@@ -40,14 +40,7 @@ def radio_name(request):
else:
messages.error(request, _('Radio name cannot be empty'))
return render(request, 'serveradmin/radio_name.html', context={
'radios': [
# FIXME: Use the actual radios for RFI
'France Inter',
'Ideas Cube',
'Radio Canut',
],
})
return render(request, 'serveradmin/radio_name.html')
class MessageCreate(FormView):
......@@ -233,6 +226,12 @@ class RadioIndex(
self._set_available_tags(context)
self._set_available_themes(context)
theme = self.request.GET.get('theme')
for t in RadioShow.THEMES:
if t[0] == theme:
context['theme'] = theme
context['theme_name'] = t[1]
return context
def get_queryset(self):
......
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