radiocampus: integrate marielle design, homepage
This commit is contained in:
		
							
								
								
									
										136
									
								
								radiocampus/aircox_urls.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										136
									
								
								radiocampus/aircox_urls.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,136 @@
 | 
			
		||||
from django.urls import include, path, register_converter
 | 
			
		||||
from django.utils.translation import gettext_lazy as _
 | 
			
		||||
from rest_framework.routers import DefaultRouter
 | 
			
		||||
 | 
			
		||||
from . import models, views, viewsets
 | 
			
		||||
from .converters import DateConverter, PagePathConverter, WeekConverter
 | 
			
		||||
 | 
			
		||||
__all__ = ["api", "urls"]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
register_converter(PagePathConverter, "page_path")
 | 
			
		||||
register_converter(DateConverter, "date")
 | 
			
		||||
register_converter(WeekConverter, "week")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# urls = [
 | 
			
		||||
#    path('on_air', views.on_air, name='aircox.on_air'),
 | 
			
		||||
#    path('monitor', views.Monitor.as_view(), name='aircox.monitor'),
 | 
			
		||||
#    path('stats', views.StatisticsView.as_view(), name='aircox.stats'),
 | 
			
		||||
# ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
router = DefaultRouter()
 | 
			
		||||
router.register("user", viewsets.UserViewSet, basename="user")
 | 
			
		||||
router.register("group", viewsets.GroupViewSet, basename="group")
 | 
			
		||||
router.register("usergroup", viewsets.UserGroupViewSet, basename="usergroup")
 | 
			
		||||
 | 
			
		||||
router.register("images", viewsets.ImageViewSet, basename="image")
 | 
			
		||||
router.register("sound", viewsets.SoundViewSet, basename="sound")
 | 
			
		||||
router.register("track", viewsets.TrackROViewSet, basename="track")
 | 
			
		||||
router.register("comment", viewsets.CommentViewSet, basename="comment")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
api = [
 | 
			
		||||
    path("logs/", views.log.LogListAPIView.as_view(), name="live"),
 | 
			
		||||
    path(
 | 
			
		||||
        "user/settings/",
 | 
			
		||||
        viewsets.UserSettingsViewSet.as_view({"get": "retrieve", "post": "update", "put": "update"}),
 | 
			
		||||
        name="user-settings",
 | 
			
		||||
    ),
 | 
			
		||||
] + router.urls
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
urls = [
 | 
			
		||||
    path("", views.home.HomeView.as_view(), name="home"),
 | 
			
		||||
    path("api/", include((api, "aircox"), namespace="api")),
 | 
			
		||||
    # ---- ---- objects views
 | 
			
		||||
    # ---- articles
 | 
			
		||||
    path(
 | 
			
		||||
        _("articles/<slug:slug>/"),
 | 
			
		||||
        views.article.ArticleDetailView.as_view(),
 | 
			
		||||
        name="article-detail",
 | 
			
		||||
    ),
 | 
			
		||||
    path(
 | 
			
		||||
        _("articles/"),
 | 
			
		||||
        views.article.ArticleListView.as_view(model=models.article.Article),
 | 
			
		||||
        name="article-list",
 | 
			
		||||
    ),
 | 
			
		||||
    path(
 | 
			
		||||
        _("articles/c/<slug:category_slug>/"),
 | 
			
		||||
        views.article.ArticleListView.as_view(model=models.article.Article),
 | 
			
		||||
        name="article-list",
 | 
			
		||||
    ),
 | 
			
		||||
    # ---- timetable
 | 
			
		||||
    path(_("timetable/"), views.diffusion.TimeTableView.as_view(), name="timetable-list"),
 | 
			
		||||
    path(
 | 
			
		||||
        _("timetable/<date:date>/"),
 | 
			
		||||
        views.diffusion.TimeTableView.as_view(),
 | 
			
		||||
        name="timetable-list",
 | 
			
		||||
    ),
 | 
			
		||||
    # ---- pages
 | 
			
		||||
    path(
 | 
			
		||||
        _("publications/"),
 | 
			
		||||
        views.PageListView.as_view(model=models.Page, attach_to_value=models.StaticPage.Target.PAGES),
 | 
			
		||||
        name="page-list",
 | 
			
		||||
    ),
 | 
			
		||||
    path(
 | 
			
		||||
        _("publications/c/<slug:category_slug>/"),
 | 
			
		||||
        views.PageListView.as_view(model=models.Page, attach_to_value=models.StaticPage.Target.PAGES),
 | 
			
		||||
        name="page-list",
 | 
			
		||||
    ),
 | 
			
		||||
    path(
 | 
			
		||||
        _("pages/<slug:slug>/"),
 | 
			
		||||
        views.BasePageDetailView.as_view(
 | 
			
		||||
            model=models.StaticPage,
 | 
			
		||||
            queryset=models.StaticPage.objects.filter(attach_to__isnull=True),
 | 
			
		||||
        ),
 | 
			
		||||
        name="static-page-detail",
 | 
			
		||||
    ),
 | 
			
		||||
    path(
 | 
			
		||||
        _("pages/"),
 | 
			
		||||
        views.BasePageListView.as_view(
 | 
			
		||||
            model=models.StaticPage,
 | 
			
		||||
            queryset=models.StaticPage.objects.filter(attach_to__isnull=True),
 | 
			
		||||
        ),
 | 
			
		||||
        name="static-page-list",
 | 
			
		||||
    ),
 | 
			
		||||
    # ---- programs
 | 
			
		||||
    path(_("programs/"), views.program.ProgramListView.as_view(), name="program-list"),
 | 
			
		||||
    path(_("programs/c/<slug:category_slug>/"), views.program.ProgramListView.as_view(), name="program-list"),
 | 
			
		||||
    path(
 | 
			
		||||
        _("programs/<slug:slug>/"),
 | 
			
		||||
        views.program.ProgramDetailView.as_view(),
 | 
			
		||||
        name="program-detail",
 | 
			
		||||
    ),
 | 
			
		||||
    path(_("programs/<slug:parent_slug>/articles/"), views.article.ArticleListView.as_view(), name="article-list"),
 | 
			
		||||
    path(_("programs/<slug:parent_slug>/podcasts/"), views.episode.PodcastListView.as_view(), name="podcast-list"),
 | 
			
		||||
    path(_("programs/<slug:parent_slug>/episodes/"), views.episode.EpisodeListView.as_view(), name="episode-list"),
 | 
			
		||||
    path(
 | 
			
		||||
        _("programs/<slug:parent_slug>/diffusions/"), views.diffusion.DiffusionListView.as_view(), name="diffusion-list"
 | 
			
		||||
    ),
 | 
			
		||||
    path(
 | 
			
		||||
        _("programs/<slug:parent_slug>/publications/"),
 | 
			
		||||
        views.PageListView.as_view(model=models.Page, attach_to_value=models.StaticPage.Target.PAGES),
 | 
			
		||||
        name="page-list",
 | 
			
		||||
    ),
 | 
			
		||||
    # ---- episodes
 | 
			
		||||
    path(_("programs/episodes/"), views.episode.EpisodeListView.as_view(), name="episode-list"),
 | 
			
		||||
    path(_("programs/episodes/c/<slug:category_slug>/"), views.episode.EpisodeListView.as_view(), name="episode-list"),
 | 
			
		||||
    path(
 | 
			
		||||
        _("programs/episodes/<slug:slug>/"),
 | 
			
		||||
        views.episode.EpisodeDetailView.as_view(),
 | 
			
		||||
        name="episode-detail",
 | 
			
		||||
    ),
 | 
			
		||||
    path(_("podcasts/"), views.episode.PodcastListView.as_view(), name="podcast-list"),
 | 
			
		||||
    path(_("podcasts/c/<slug:category_slug>/"), views.episode.PodcastListView.as_view(), name="podcast-list"),
 | 
			
		||||
    # ---- dashboard
 | 
			
		||||
    path(_("dashboard/"), views.dashboard.DashboardView.as_view(), name="dashboard"),
 | 
			
		||||
    path(_("dashboard/program/<pk>/"), views.program.ProgramUpdateView.as_view(), name="program-edit"),
 | 
			
		||||
    path(_("dashboard/episodes/<pk>/"), views.episode.EpisodeUpdateView.as_view(), name="episode-edit"),
 | 
			
		||||
    path(_("dashboard/statistics/"), views.dashboard.StatisticsView.as_view(), name="dashboard-statistics"),
 | 
			
		||||
    path(_("dashboard/statistics/<date:date>/"), views.dashboard.StatisticsView.as_view(), name="dashboard-statistics"),
 | 
			
		||||
    path(_("dashboard/users/"), views.auth.UserListView.as_view(), name="user-list"),
 | 
			
		||||
    # ---- others
 | 
			
		||||
    path(_("errors/no-station/"), views.errors.NoStationErrorView.as_view(), name="errors-no-station"),
 | 
			
		||||
]
 | 
			
		||||
@ -139,6 +139,10 @@ a.heading.title:hover {
 | 
			
		||||
.header.has-cover {
 | 
			
		||||
    min-height: unset;
 | 
			
		||||
}
 | 
			
		||||
.today {
 | 
			
		||||
   color:  yellow;
 | 
			
		||||
   font-size: 1.4em !important;
 | 
			
		||||
}
 | 
			
		||||
.mt-3 {
 | 
			
		||||
    margin-top: unset !important;
 | 
			
		||||
}
 | 
			
		||||
@ -158,6 +162,38 @@ a.heading.title:hover {
 | 
			
		||||
.page section.container {
 | 
			
		||||
    margin-top: 0;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid {
 | 
			
		||||
    display: block;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid article div.media {
 | 
			
		||||
    line-height: 1;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid article.active div.media div.media-content a, .radiocampus-grid article.active div.media div.media-content span {
 | 
			
		||||
    color: yellow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.radiocampus-grid article.active div.media a:before {
 | 
			
		||||
    content: "\2192";
 | 
			
		||||
    margin-right: 6px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.radiocampus-grid article div.media a.preview-cover {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid article div.media div.media-content.flex-column {
 | 
			
		||||
    display: unset;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid article div.media div.media-content section.content {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid article div.media div.media-content div.episode-date {
 | 
			
		||||
    display: none;
 | 
			
		||||
}
 | 
			
		||||
.radiocampus-grid article div.media div.media-content span.heading.subtitle {
 | 
			
		||||
    float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.schedule {
 | 
			
		||||
    background-color: unset;
 | 
			
		||||
    font-size: 0.9em;
 | 
			
		||||
@ -169,6 +205,11 @@ a.heading.title:hover {
 | 
			
		||||
.schedules {
 | 
			
		||||
    margin-bottom: 0.4rem !important;
 | 
			
		||||
}
 | 
			
		||||
.title, .preview .title, .preview .title:not(:last-child) {
 | 
			
		||||
    text-transform: unset;
 | 
			
		||||
    font-weight: unset;
 | 
			
		||||
    font-size: 1.2em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media screen and (max-width: 400px) {
 | 
			
		||||
    body {
 | 
			
		||||
@ -235,6 +276,10 @@ a.heading.title:hover {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.list-item .headings {
 | 
			
		||||
    margin-bottom: .2rem !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.list-item:nth-child(3n+1):not(.wide) .media {
 | 
			
		||||
  border-color: transparent !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										33
									
								
								radiocampus/templates/aircox/home_timetable_list.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								radiocampus/templates/aircox/home_timetable_list.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
			
		||||
{% extends "aircox/page_list.html" %}
 | 
			
		||||
{% comment %}List of diffusions as a timetable{% endcomment %}
 | 
			
		||||
{% load i18n aircox humanize %}
 | 
			
		||||
 | 
			
		||||
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block secondary-nav %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% block breadcrumbs %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{% block list-container %}
 | 
			
		||||
<br />
 | 
			
		||||
<br />
 | 
			
		||||
<div style="display: flex; justify-content: flex-end;height:100%;">
 | 
			
		||||
<div style="min-width:300px;margin-right:12%">
 | 
			
		||||
<!-- <a href="{% url "timetable-list" date=date %}">{{ date|date:"l d F Y" }}</a> -->
 | 
			
		||||
<section class="clear-both list grid radiocampus-grid" role="list">
 | 
			
		||||
    <span class="title today">Aujourd'hui</span>
 | 
			
		||||
</section>
 | 
			
		||||
{% with list_class="radiocampus-grid" %}
 | 
			
		||||
{{ block.super }}
 | 
			
		||||
{% endwith %}
 | 
			
		||||
</div>
 | 
			
		||||
</div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block list %}
 | 
			
		||||
{% include "./widgets/logs.html" with object_list=object_list timetable=True  %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
							
								
								
									
										47
									
								
								radiocampus/urls.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										47
									
								
								radiocampus/urls.py
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,47 @@
 | 
			
		||||
"""Aircox URL Configuration.
 | 
			
		||||
 | 
			
		||||
The `urlpatterns` list routes URLs to views. For more information please see:
 | 
			
		||||
    https://docs.djangoproject.com/en/1.8/topics/http/urls/
 | 
			
		||||
Examples:
 | 
			
		||||
Function views
 | 
			
		||||
    1. Add an import:  from my_app import views
 | 
			
		||||
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
 | 
			
		||||
Class-based views
 | 
			
		||||
    1. Add an import:  from other_app.views import Home
 | 
			
		||||
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
 | 
			
		||||
Including another URLconf
 | 
			
		||||
    1. Add an import:  from blog import urls as blog_urls
 | 
			
		||||
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
 | 
			
		||||
"""
 | 
			
		||||
# from django.conf.urls.i18n import i18n_patterns
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.conf.urls.static import static
 | 
			
		||||
from django.contrib import admin
 | 
			
		||||
from django.urls import include, path
 | 
			
		||||
 | 
			
		||||
from debug_toolbar.toolbar import debug_toolbar_urls
 | 
			
		||||
 | 
			
		||||
import aircox.urls
 | 
			
		||||
import aircox_streamer.urls
 | 
			
		||||
 | 
			
		||||
from radiocampus.views.diffusion import TimeTableView
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    *aircox.urls.urls,
 | 
			
		||||
    path("streamer/", include((aircox_streamer.urls.urls, "aircox_streamer"), namespace="streamer")),
 | 
			
		||||
    path("admin/", admin.site.urls),
 | 
			
		||||
    path("accounts/", include("django.contrib.auth.urls")),
 | 
			
		||||
    path("filer/", include("filer.urls")),
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
for i, pa in enumerate(urlpatterns):
 | 
			
		||||
    if "name" in pa.__dict__.keys() and pa.name == "home":
 | 
			
		||||
        urlpatterns.pop(i)
 | 
			
		||||
 | 
			
		||||
urlpatterns.append(path("", TimeTableView.as_view(), name="home"))
 | 
			
		||||
 | 
			
		||||
if settings.DEBUG:
 | 
			
		||||
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(
 | 
			
		||||
        settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
 | 
			
		||||
    )
 | 
			
		||||
    urlpatterns += debug_toolbar_urls()
 | 
			
		||||
							
								
								
									
										13
									
								
								radiocampus/views/diffusion.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								radiocampus/views/diffusion.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
from aircox.models import Diffusion, StaticPage
 | 
			
		||||
from aircox.views.page import attach
 | 
			
		||||
from aircox.views.diffusion import TimeTableView as AircoxTimeTableView
 | 
			
		||||
 | 
			
		||||
__all__ = "TimeTableView"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@attach
 | 
			
		||||
class TimeTableView(AircoxTimeTableView):
 | 
			
		||||
    model = Diffusion
 | 
			
		||||
    redirect_date_url = "timetable-list"
 | 
			
		||||
    attach_to_value = StaticPage.Target.TIMETABLE
 | 
			
		||||
    template_name = "aircox/home_timetable_list.html"
 | 
			
		||||
		Reference in New Issue
	
	Block a user