class MediaFondsForm(ModelForm):
- widget = FilteredSelectMultiple("Verbose name", is_stacked=False)
- field = forms.ModelMultipleChoiceField(queryset=MediaCorpus.objects.all())
- children = forms.ModelMultipleChoiceField(widget=widget, queryset=field)
+
+ widget = FilteredSelectMultiple("Corpus", True,)
+ queryset = queryset=MediaCorpus.objects.all()
+ children = forms.ModelMultipleChoiceField(widget=widget, queryset=queryset, label='Corpus')
class Meta:
model = MediaFonds
exclude = ['description',]
+ class Media:
+ css = {'all': ['/static/admin/css/widgets.css',],}
+ js = ['/admin/django/jsi18n/',]
+
class MediaFondsRelatedForm(ModelForm):
+
class Meta:
model = MediaFondsRelated
class MediaCorpusForm(ModelForm):
- # queryset = MediaCollection.objects.all()
- # widget = FilteredSelectMultiple('children', False)
- # # # field = forms.ModelMultipleChoiceField(queryset=MediaCorpus.objects.all())
- # children = forms.ModelMultipleChoiceField(widget=widget, queryset=queryset, required=True)
+
+ queryset = MediaCollection.objects.all()
+ widget = FilteredSelectMultiple('Collections', False)
+ children = forms.ModelMultipleChoiceField(widget=widget, queryset=queryset,label='Collections')
class Meta:
model = MediaCorpus
class MediaCorpusRelatedForm(ModelForm):
+
class Meta:
model = MediaCorpusRelated
class MediaCollectionForm(ModelForm):
+
class Meta:
model = MediaCollection
+
def clean_doctype_code(self):
return self.cleaned_data['doctype_code'] or 0
class MediaCollectionRelatedForm(ModelForm):
+
class Meta:
model = MediaCollectionRelated
class MediaItemForm(ModelForm):
+
class Meta:
model = MediaItem
class MediaItemRelatedForm(ModelForm):
+
class Meta:
model = MediaItemRelated
class MediaItemKeywordForm(ModelForm):
+
class Meta:
model = MediaItemKeyword
class MediaItemPerformanceForm(ModelForm):
+
class Meta:
model = MediaItemPerformance
class PlaylistForm(ModelForm):
+
class Meta:
model = Playlist
class FondsRelatedInline(InlineFormSet):
+
model = MediaFondsRelated
class CorpusRelatedInline(InlineFormSet):
+
model = MediaCorpusRelated
a img {border: none;}
body {
- font: 0.9em/1em verdana, sans-serif;
+ font: 0.8125em/1em verdana, sans-serif;
line-height: 1.3em;
color: #333;
background: #FFF;
moz-border-radius-topright: 5px 5px;
border-top-right-radius: 5px 5px;
font-weight: bold;
- font-size: 15px;
+ font-size: 14px;
padding: .5em 1em;
}
#menu a:hover, #menu a.active{
}
dl.listing dd {
margin-left: 19.4em;
- /*font-weight: bold;*/
+ font-weight: bold;
}
/* dublin core display */
.infos dl, .infos table {
position: relative;
+ font-size: 105%;
}
.extraInfos dl, .extraInfos table {
position: relative;
-
+ font-size: 105%;
}
.extraInfos div {
/* Pagination */
.pagination {
- margin-top: .7em;
- margin-bottom: .3em;
+ margin-top: 0em;
+ margin-bottom: 0em;
padding: .3em 0;
- font-size: 1em;
+ font-size: 0.7em;
background-color: #fff;
- border-bottom: 1px solid #aaa;
+ /*border-bottom: 1px solid #aaa;*/
color: #333;
font-weight: bold;
}
.pagination a {
background-color: #fff;
border-bottom: none;
- font-size: 1em;
padding: .3em;
}
color:#444;
text-decoration: none;
margin:0;
- font: 0.8em/1.2em sans-serif;
+ font: 1em/1.2em Verdana, sans-serif;
}
.component + .component, .component + .component_icon, .component_icon + .component ,
.component_icon + .component_icon{
{% extends "telemeta/base.html" %}
{% load telemeta_utils %}
{% load i18n %}
+{% load bootstrap_pagination %}
-{% block head_title %}{% trans "Media Collections" %} - {{ block.super }}{% endblock %}
+{% block head_title %}{% trans "Collections" %} - {{ block.super }}{% endblock %}
{% block title%}
- <img src="{{ STATIC_URL }}telemeta/images/collections_red.png" style="vertical-align:middle" /> {% trans "Media Collections" %}
+<div class='row'>
+<div class="col-md-4">
+ <img src="{{ STATIC_URL }}telemeta/images/collections_red.png" style="vertical-align:middle" /> {% trans "Collections" %} ({{ page_obj.start_index }} - {{ page_obj.end_index }} / {{ count }})
+</div>
+<div class="col-md-8">
+{% bootstrap_paginate page_obj range=10 show_first_last="True" %}
+</div>
+<div class="col-md-0"> </div>
+</div>
{% endblock %}
{% block title_buttons %}
- <a href="{% url "telemeta-collections" %}" class="component_icon button icon_filter">{% trans "All" %}</a>
- <a href="{% url "telemeta-collections-unpublished" %}" class="component_icon button icon_filter">{% trans "Unpublished" %}</a>
- <a href="{% url "telemeta-collections-published" %}" class="component_icon button icon_filter">{% trans "Published" %}</a>
- <a href="{% url "telemeta-collections-sound" %}" class="component_icon button icon_filter">{% trans "Sounds" %}</a>
- {% if user.is_authenticated and perms.telemeta.add_mediacollection %}
+
+<!-- Single button -->
+<div class="btn-group">
+ <button type="button" class="btn btn-default dropdown-toggle icon-filter" data-toggle="dropdown">
+ <i class="icon-filter"></i> {% trans "Filters" %} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" role="menu">
+ <li><a href="{% url "telemeta-collections" %}" class="">{% trans "All" %}</a></li>
+ <li><a href="{% url "telemeta-collections-unpublished" %}">{% trans "Unpublished" %}</a></li>
+ <li><a href="{% url "telemeta-collections-published" %}">{% trans "Published" %}</a></li>
+ <li><a href="{% url "telemeta-collections-sound" %}">{% trans "Sounds" %}</a></li>
+ </ul>
+</div>
+
+ {% if user.is_authenticated and perms.telemeta.add_mediacollection %}
<a href="{% url "telemeta-collection-add" %}" class="component_icon button icon_add">{% trans "Add" %}</a>
- {% endif %}
+ {% endif %}
{% endblock %}
{% block content %}
-{% with object_list as collections %}
<div class="fullpage">
{% include "telemeta/inc/collection_list.html" %}
</div>
-{% endwith %}
{% endblock %}
{% load telemeta_utils %}
{% load i18n %}
-{% load pagination_tags %}
-{% if collections %}
-{% paginate %}
+{% if object_list %}
<table class="listing">
<tr>
<th>{% trans "Recording period" %}</th>
<th>{% trans "Sound" %}</th>
</tr>
-{% for collection in collections %}
+{% for collection in object_list %}
<tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
<td class="highlight">
<a href="{% url "telemeta-collection-detail" collection.public_id %}">{{ collection.title }}</a>
{% load telemeta_utils %}
{% load i18n %}
-{% load pagination_tags %}
-{% if items %}
-{% paginate %}
+{% if object_list %}
<table class="listing">
<tr>
<th>{% trans "Year of recording" %}</th>
<th>{% trans "Sound" %}</th>
</tr>
-{% for item in items %}
+{% for item in object_list %}
<tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
<td class="highlight">
<a href="{% url "telemeta-item-detail" item.public_id %}">{{ item }}</a>
{% load telemeta_utils %}
{% load i18n %}
-{% if resources %}
-{% include "pure_pagination/pagination.html" %}
+{% if object_list %}
<table class="listing">
<tr>
<th width="15%">{% trans "Code" %}</th>
<th width="5%">{% trans "Sound" %}</th>
</tr>
-{% for resource in resources %}
+{% for resource in object_list %}
<tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
<td class="highlight">
<a href="{% url "telemeta-resource-detail" type resource.public_id %}">{{ resource.title }}</a>
</tr>
{% endfor %}
</table>
+
{% else %}
<p>{% trans "No resource" %}</p>
{% endif %}
{% extends "telemeta/base.html" %}
{% load i18n %}
{% load telemeta_utils %}
+{% load bootstrap_pagination %}
{% block head_title %}{% trans "Media Items" %} - {{ block.super }}{% endblock %}
{% block title %}
- <img src="{{ STATIC_URL }}telemeta/images/item.png" alt="item" style="vertical-align:middle" /> {% trans "Media Items" %}
+<div class='row'>
+<div class="col-md-4">
+ <img src="{{ STATIC_URL }}telemeta/images/item.png" alt="item" style="vertical-align:middle" /> {% trans "Items" %} ({{ page_obj.start_index }} - {{ page_obj.end_index }} / {{ count }})
+</div>
+<div class="col-md-8">
+{% bootstrap_paginate page_obj range=10 show_first_last="True" %}
+</div>
+<div class="col-md-0"> </div>
+</div>
{% endblock %}
{% block title_buttons %}
- <a href="{% url "telemeta-items" %}" class="component_icon button icon_filter">{% trans "All" %}</a>
- <a href="{% url "telemeta-items-unpublished" %}" class="component_icon button icon_filter">{% trans "Unpublished" %}</a>
- <a href="{% url "telemeta-items-published" %}" class="component_icon button icon_filter">{% trans "Published" %}</a>
- <a href="{% url "telemeta-items-sound" %}" class="component_icon button icon_filter">{% trans "Sounds" %}</a>
+
+<div class="btn-group">
+ <button type="button" class="btn btn-default dropdown-toggle icon-filter" data-toggle="dropdown">
+ <i class="icon-filter"></i> {% trans "Filters" %} <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" role="menu">
+ <li><a href="{% url "telemeta-items" %}" class="">{% trans "All" %}</a></li>
+ <li><a href="{% url "telemeta-items-unpublished" %}">{% trans "Unpublished" %}</a></li>
+ <li><a href="{% url "telemeta-items-published" %}">{% trans "Published" %}</a></li>
+ <li><a href="{% url "telemeta-items-sound" %}">{% trans "Sounds" %}</a></li>
+ </ul>
+</div>
+
{% if user.is_authenticated and perms.telemeta.add_mediaitem %}
<a href="{% url "telemeta-item-add" %}" class="component_icon button icon_add">{% trans "Add" %}</a>
{% endif %}
{% endblock %}
{% block content %}
-{% with object_list as items %}
<div class="fullpage">
{% include "telemeta/inc/mediaitem_list.html" %}
</div>
-{% endwith %}
{% endblock %}
{% extends "telemeta/resource_detail.html" %}
{% load i18n %}
{% load telemeta_utils %}
+{% load bootstrap3 %}
+
+
{% block title %}
<img src="{{ STATIC_URL }}telemeta/images/{{ type }}.png" style="vertical-align:middle" /> {{ type }} : {{ resource }}
{% endblock %}
{% block title_buttons %}
<a href="{% url "telemeta-resource-detail" type resource.public_id %}" class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
- {% if perms.telemeta.add_mediacorpus or perms.telemeta.add_mediafonds %}
- <a href="#" class="component_icon button icon_save" onclick="document.getElementById('_editForm').submit(); return false;">{% trans "Save" %}</a>
- {% endif %}
{% endblock %}
{% block infos %}
- <div class="infos">
- <form method="post" id="_editForm" action="">{% csrf_token %}
- <table>
- <tr><td colspan="2">{% for error in form.non_field_errors %}<li class="error">{{ error }}</li>{% endfor %}</td></tr>
- {% for field in form %}
- <tr>
- <tr><td class="error">{{ field.errors }}</td></tr>
- {% if "children" in field.html_name %}
- <td>{% trans field.label_tag %}:</td><td><div class="vscroll"> {{ field }}</div></td>
- {% elif not 'description' == field.name %}
- <td>{{ field.label_tag }}:</td><td> {{ field }}</td>
- {% endif %}
- </tr>
- {% endfor %}
- <tr>
- <td style="padding-top: 1em">{% trans "Related media" %}:</td>
- <td style="padding-top: 1em"><a href="{% url "telemeta-resource-related_edit" type resource.public_id %}" class="component_icon button icon_edit">{% trans "Edit"%} {% trans "related media"%}</a></td>
- </tr>
- </table>
- <div align="center" style="margin-top:3ex;">
+
+ <div>
+ <form method="post" id="_editForm" action="">{% csrf_token %}
+
+ <ul class="nav nav-tabs" role="tablist">
+ <li class="active"><a href="#general" role="tab" data-toggle="tab">General</a></li>
+ <li><a href="#related" role="tab" data-toggle="tab">Related media</a></li>
+ </ul>
+
+ <div class="tab-content">
+
+ <div class="tab-pane fade in active" id="general">
+ <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
+ <script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
+ <script type="text/javascript" src="/static/admin/js/actions.min.js"></script>
+
+ {{ form.media }}
+ {% bootstrap_form form %}
+ </div>
+
+ <div class="tab-pane" id="related">
+ {% for formset in inlines %}
+ {{ formset.management_form }}
+ {% for form in formset %}
+ <hr />
+ {% bootstrap_form form %}
+ {# {{ form.as_table }} #}
+ {% endfor %}
+ {% endfor %}
+ </div>
+
+ </div>
+
+
+ <div align="center" style="margin-top:3ex;">
<a href="{% url "telemeta-resource-detail" type resource.public_id %}" class="component_icon button icon_cancel">{% trans "Cancel" %}</a>
- {% if perms.telemeta.add_mediacorpus or perms.telemeta.add_mediafonds %}
- <a href="#" class="component_icon button icon_save" onclick="document.getElementById('_editForm').submit(); return false;">{% trans "Save" %}</a>
+ {% if perms.telemeta.change_mediacorpus or perms.telemeta.change_mediafonds %}
+ <input type="submit" value="Enregistrer" class="default" name="_save"/>
{% endif %}
- </div>
- </form>
- </div>
-{% endblock infos%}
+ {# <a href="#" class="component_icon button icon_save" id="submit_button">{% trans "Save" %}</a> #}
+ </div>
+
+ </form>
+ </div>
+
+
+{% endblock infos %}
+
{% block delete %}
{% endblock %}
{% extends "telemeta/base.html" %}
{% load telemeta_utils %}
{% load i18n %}
+{% load bootstrap_pagination %}
{% block head_title %}{% trans type %} - {{ block.super }}{% endblock %}
{% block title%}
-<img src="{{ STATIC_URL }}telemeta/images/{{ type }}.png" style="vertical-align:middle" /> {{ type|capitalize }}
+<div class='row'>
+<div class="col-md-4">
+<img src="{{ STATIC_URL }}telemeta/images/{{ type }}.png" style="vertical-align:middle" /> {{ all_resource }} {{ type|capitalize }} ({{ page_obj.start_index }} - {{ page_obj.end_index }} / {{ count }})
+</div>
+<div class="col-md-6">
+{% bootstrap_paginate page_obj range=10 show_first_last="True" %}
+</div>
+<div class="col-md-2"> </div>
+</div>
{% endblock %}
{% block title_buttons %}
- {% if perms.telemeta.add_mediacorpus or perms.telemeta.add_mediafonds %}
+ {% if perms.telemeta.add_mediacorpus or perms.telemeta.add_mediafonds or user.is_superuser or user.is_staff %}
<a href="{% url "telemeta-resource-add" type %}" class="component_icon button icon_add">{% trans "Add" %}</a>
{% endif %}
{% endblock %}
{% block content %}
-{% with object_list as resources and type as type %}
-<div class="fullpage">
-{% include "telemeta/inc/resource_list.html" %}
-</div>
-{% endwith %}
+ <div class="fullpage">
+ {% include "telemeta/inc/resource_list.html" %}
+ </div>
{% endblock %}
return super(CollectionPackageView, self).dispatch(*args, **kwargs)
-
class CollectionListView(ListView):
model = MediaCollection
paginate_by = 20
queryset = MediaCollection.objects.enriched()
+ def get_context_data(self, **kwargs):
+ context = super(CollectionListView, self).get_context_data(**kwargs)
+ context['count'] = self.object_list.count()
+ return context
+
class CollectionUnpublishedListView(CollectionListView):
paginate_by = 20
queryset = MediaItem.objects.enriched().order_by('code', 'old_code')
+ def get_context_data(self, **kwargs):
+ context = super(ItemListView, self).get_context_data(**kwargs)
+ context['count'] = self.object_list.count()
+ return context
+
class ItemUnpublishedListView(ItemListView):
from django.utils.translation import ugettext_lazy as _
from django.forms.models import model_to_dict
from django.views.generic.edit import DeletionMixin, BaseDeleteView
-from pure_pagination.mixins import PaginationMixin
class ResourceView(object):
return context
-class ResourceListView(ResourceMixin, PaginationMixin, ListView):
+class ResourceListView(ResourceMixin, ListView):
template_name = "telemeta/resource_list.html"
paginate_by = 20
self.setup(self.type)
return self.model.objects.all().order_by('code')
+ def get_context_data(self, **kwargs):
+ context = super(ResourceListView, self).get_context_data(**kwargs)
+ context['count'] = self.object_list.count()
+ return context
class ResourceDetailView(ResourceSingleMixin, DetailView):