--- a/src/metadatacomposer/static/metadatacomposer/css/style.css Thu May 16 15:48:26 2013 +0200
+++ b/src/metadatacomposer/static/metadatacomposer/css/style.css Thu May 16 17:10:36 2013 +0200
@@ -80,4 +80,8 @@
.html-apercu{overflow: auto; margin-top: 10px;}
.input-image-url{display: none;}
.timeline-annotation-widget{width: 460px;height: 40px;background-color: #ecf0f1; position: relative;}
-.timeline-annotation-widget .annotation{width: 10px; height: 10px; background-color: #c0392b; position: absolute; top:15px;}
\ No newline at end of file
+.timeline-annotation-widget .annotation{width: 10px; height: 10px; background-color: #c0392b; position: absolute; top:15px;}
+.loader {
+ background: url(../img/loader.gif) center no-repeat;
+ background-size: 25px 25px;
+}
\ No newline at end of file
Binary file src/metadatacomposer/static/metadatacomposer/img/loader.gif has changed
--- a/src/metadatacomposer/templates/metadatacomposer_home.html Thu May 16 15:48:26 2013 +0200
+++ b/src/metadatacomposer/templates/metadatacomposer_home.html Thu May 16 17:10:36 2013 +0200
@@ -13,7 +13,7 @@
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{% block css_import %}
- <link rel="stylesheet" href="{% static 'metadatacomposer/css/bootstrap.min.css' %}" />
+ <link rel="stylesheet" href="{% static 'metadatacomposer/lib/bootstrap/css/bootstrap.min.css' %}" />
<link rel="stylesheet" href="{% static 'metadatacomposer/css/style.css' %}" />
{% endblock %}
{% block css_page %}
@@ -65,27 +65,27 @@
</div>
<div class="row">
<div class="span2">
- <a href=""><img src="img/140x140.gif" alt=""></a>
+ <a href=""><img src="{% static 'metadatacomposer/img/140x140.gif' %}" alt=""></a>
<h4><a href="">Titre de l'image</a></h4>
</div>
<div class="span2">
- <a href=""><img src="img/140x140.gif" alt=""></a>
+ <a href=""><img src="{% static 'metadatacomposer/img/140x140.gif' %}" alt=""></a>
<h4><a href="">Titre de l'image</a></h4>
</div>
<div class="span2">
- <a href=""><img src="img/140x140.gif" alt=""></a>
+ <a href=""><img src="{% static 'metadatacomposer/img/140x140.gif' %}" alt=""></a>
<h4><a href="">Titre de l'image</a></h4>
</div>
<div class="span2">
- <a href=""><img src="img/140x140.gif" alt=""></a>
+ <a href=""><img src="{% static 'metadatacomposer/img/140x140.gif' %}" alt=""></a>
<h4><a href="">Titre de l'image</a></h4>
</div>
<div class="span2">
- <a href=""><img src="img/140x140.gif" alt=""></a>
+ <a href=""><img src="{% static 'metadatacomposer/img/140x140.gif' %}" alt=""></a>
<h4><a href="">Titre de l'image</a></h4>
</div>
<div class="span2">
- <a href=""><img src="img/140x140.gif" alt=""></a>
+ <a href=""><img src="{% static 'metadatacomposer/img/140x140.gif' %}" alt=""></a>
<h4><a href="">Titre de l'image</a></h4>
</div>
</div>
@@ -115,8 +115,8 @@
{% block js_common %}
<script src="{% static 'metadatacomposer/lib/jquery-1.9.1.min.js' %}"></script>
<script src="{% static 'metadatacomposer/lib/bootstrap/js/bootstrap.min.js' %}"></script>
- <script src="{% static 'metadatacomposer/lib/ZeroClipboard/ZeroClipboard.min.js' %}"></script>js/common.js
<script src="{% static 'metadatacomposer/lib/spin/jquery.spin-1.0.2.js' %}"></script>
+ <script src="{% static 'metadatacomposer/js/common.js' %}"></script>
{% endblock %}
{% block js_page %}
<script src="{% static 'metadatacomposer/js/home.js' %}"></script>
--- a/src/metadatacomposer/templates/metadatacomposer_project_list.html Thu May 16 15:48:26 2013 +0200
+++ b/src/metadatacomposer/templates/metadatacomposer_project_list.html Thu May 16 17:10:36 2013 +0200
@@ -5,7 +5,7 @@
{% load thumbnail %}
{% load front_tags %}
-{% block title %}{% trans "Project list" %}{% endblock %}
+{% block title %}{% trans "Projects list" %}{% endblock %}
{% block containers %}
<article class="container">
@@ -85,5 +85,6 @@
</article>
{% endblock %}
{% block js_page %}
+ <script src="{% static 'metadatacomposer/lib/ZeroClipboard/ZeroClipboard.min.js' %}"></script>
<script src="{% static 'metadatacomposer/js/projet.js' %}"></script>
{% endblock %}
--- a/src/metadatacomposer/templates/metadatacomposer_resource_list.html Thu May 16 15:48:26 2013 +0200
+++ b/src/metadatacomposer/templates/metadatacomposer_resource_list.html Thu May 16 17:10:36 2013 +0200
@@ -5,7 +5,7 @@
{% load thumbnail %}
{% load front_tags %}
-{% block title %}{% trans "Project list" %}{% endblock %}
+{% block title %}{% trans "Resources list" %}{% endblock %}
{% block containers %}
<div class="container">
@@ -37,7 +37,7 @@
</thead>
<tbody class="liste">
<tr id="row-list-ressources-image-id1">
- <td><img src="img/60x60.gif" alt=""></td>
+ <td><img src="{% static 'metadatacomposer/img/60x60.gif' %}" alt=""></td>
<td>Titre de l'image qwerty</td>
<td>
<ul>
@@ -55,7 +55,7 @@
</td>
</tr>
<tr id="row-list-ressources-image-id2">
- <td><img src="img/60x60.gif" alt=""></td>
+ <td><img src="{% static 'metadatacomposer/img/60x60.gif' %}" alt=""></td>
<td>Titre de l'image azerty</td>
<td>
<ul>
@@ -129,12 +129,24 @@
</div>
{% endblock %}
{% block js_page %}
- <script src="{% static 'metadatacomposer/js/projet.js' %}"></script>
<script src="{% static 'metadatacomposer/js/ressource.js' %}"></script>
<script type="text/javascript">
- $(document).ready(function(){
- console.log("coucou ready");
- init_content_pagination_events();
+ $(document).on('click', 'a.content_pagination', function(e){
+ e.preventDefault();e.stopPropagation();
+ var url = $(this).attr('href');
+ $(this).addClass("loader");
+ $.ajax({
+ url: url,
+ cache: false,
+ type: 'GET',
+ success: function(data, status, request) {
+ $("#content_list_container").html(data);
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ resp = $.parseJSON(jqXHR.responseText);
+ alert(resp.message);
+ }
+ });
});
</script>
{% endblock %}
--- a/src/metadatacomposer/templates/partial/resource_content_list.html Thu May 16 15:48:26 2013 +0200
+++ b/src/metadatacomposer/templates/partial/resource_content_list.html Thu May 16 17:10:36 2013 +0200
@@ -1,4 +1,6 @@
+{% load static %}
{% load i18n %}
+{% load thumbnail %}
{% load front_tags %}
<table class="table table-striped">
<thead>
@@ -13,7 +15,7 @@
<tbody class="liste">
{% for res in content_results %}
<tr id="row-list-ressources-video-id1">
- <td><img src="img/60x60.gif" alt=""></td>
+ <td>{% thumbnail res.content.image "60x60" crop="center" format="PNG" as im %}<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />{% empty %}<img src="{% static 'metadatacomposer/img/60x60.gif' %}" width="60px" height="60px" />{% endthumbnail %}</td>
<td>{{ res.content.title }}</td>
<td>
<ul>
--- a/src/metadatacomposer/views.py Thu May 16 15:48:26 2013 +0200
+++ b/src/metadatacomposer/views.py Thu May 16 17:10:36 2013 +0200
@@ -8,8 +8,11 @@
from django.utils.decorators import method_decorator
from django.views.generic.base import View, TemplateResponseMixin
from ldt.ldt_utils.models import Project, Content
-#import logging
-#import re
+
+
+import logging #@UnresolvedImport
+logger = logging.getLogger(__name__)
+
class MetadataComposerContextView(View):
@@ -86,7 +89,7 @@
def get(self, request, branding="iri", **kwargs):
self.branding = branding
- # We get the first page of contents
+ # We get the first contents page and theirs projects
content_results = get_contents_and_projects(1, request.user)
# We get the first page of images
@@ -108,7 +111,7 @@
def get(self, request, branding="iri", **kwargs):
self.branding = branding
page = request.GET.get("page") or 1
-
+ # Get current contents page and theirs projects
content_results = get_contents_and_projects(page, request.user)
context = self.get_context_dict(request)
@@ -120,12 +123,11 @@
def get_contents_and_projects(page, user):
# We get the current's page contents
+ # prefetch_related("project_set") is unfortunately useless because we have to filter the project queryset later
contents = Content.safe_objects.order_by('-update_date')
-
nb = getattr(settings, 'METADATACOMPOSER_ELEMENTS_PER_PAGE', 9)
if page=="x":
nb = contents.count()
-
paginator = Paginator(contents, nb)
try:
results = paginator.page(page)
@@ -135,9 +137,10 @@
# We add the user's projects for each content
results_object_list = []
for content in results.object_list:
+ # We filter the content's projects with the user's ones
projects = content.project_set.all().filter(owner=user)
results_object_list.append({"content":content, "projects":projects})
+
results.object_list = results_object_list
-
return results
\ No newline at end of file