# HG changeset patch # User cavaliet # Date 1312455242 -7200 # Node ID 5c3ed9c919bbae32337f97092be5e2029f1fa8cb # Parent 3ac45d07640ace195f49f691c8abd9e6ae272d6e New search feature on top right corner. Advanced search included in published projects tab. Colored icons. Change css to avoid scroll on contents and projects table. diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/core/models.py --- a/src/ldt/ldt/core/models.py Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/core/models.py Thu Aug 04 12:54:02 2011 +0200 @@ -1,8 +1,14 @@ from django.contrib.auth.models import User, Group from django.db import models +class OwnerManager(models.Manager): + def get_by_natural_key(self, user_name): + return self.get(user__username=user_name) + class Owner(models.Model): + objects = OwnerManager() + user = models.ForeignKey(User, blank=True, null=True) group = models.ForeignKey(Group, blank=True, null=True) @@ -11,6 +17,12 @@ return self.user.username else: return self.group.name + + def natural_key(self): + # Right now there is no group so the user.username is enough + return self.user.username + natural_key.dependencies = ['auth.user'] + class Document(models.Model): diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/models.py Thu Aug 04 12:54:02 2011 +0200 @@ -89,7 +89,13 @@ return "|".join(strings) +class ContentManager(models.Manager): + def get_by_natural_key(self, iri_id): + return self.get(iri_id=iri_id) + class Content(models.Model): + objects = ContentManager() + iri_id = models.CharField(max_length=1024, unique=True, default=generate_uuid, verbose_name=_('content.iri_id')) iriurl = models.CharField(max_length=1024, verbose_name=_('content.iriurl')) creation_date = models.DateTimeField(auto_now_add=True, verbose_name=_('content.creation_date')) @@ -104,6 +110,13 @@ class Meta: ordering = ["title"] + + def natural_key(self): + return self.iri_id + + # added for import + def get_by_natural_key(self, iri_id): + return self.get(iri_id=iri_id) def get_duration(self): if self.duration is None: diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/content_list.html diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/copy_ldt.html Thu Aug 04 12:54:02 2011 +0200 @@ -11,7 +11,7 @@
{% trans "Copy your project" %}
-
{% csrf_token %} + {% csrf_token %}
diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html Thu Aug 04 12:54:02 2011 +0200 @@ -40,19 +40,17 @@
{% trans "name" %}
-
-
- - - {% for content in contents %} - - - - - {% endfor %} - -
{{ content.title }}
-
+
+ + + {% for content in contents %} + + + + + {% endfor %} + +
{{ content.title }}
diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Thu Aug 04 12:54:02 2011 +0200 @@ -2,22 +2,17 @@
{% trans "name" %}
-
{% for content in contents %} - - + + {% endfor %}
{% trans 'create project' %}
{% trans 'preview media'%}
{% trans 'create project' %}
{% trans 'preview media'%}
{{ content.title|default:"_" }}
-
- diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Thu Aug 04 12:54:02 2011 +0200 @@ -2,7 +2,6 @@
{% trans "name" %}
-
@@ -10,12 +9,12 @@ {% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %} {% if is_gecko %} - + {% else %} - + {% endif %} - - + +
{% trans 'open ldt' %}
{% trans 'open ldt' %}
{% trans 'open ldt' %}
{% trans 'open ldt' %}
{% trans 'copy project' %}
{% trans 'link json by id' %}
{% trans 'copy project' %}
{% trans 'link json by id' %}
{% ifequal project.state 2 %} {% trans 'Project published, click to unpublish' %} @@ -35,7 +34,3 @@
-
- diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html Thu Aug 04 12:54:02 2011 +0200 @@ -0,0 +1,27 @@ +{% load i18n %} +
+{% trans "name" %} +
+
+ + +{% for project in projects %} + + {% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %} + + + + + +{% endfor %} + +
{% trans 'copy the project' %}
{% trans 'link json by id' %}
+ {% trans 'Project published' %} + + {% ifequal project.state 2 %} + {{ project.title }} + {% else %} + {{ project.title }} + {% endifequal %} +
+
diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/published_projects.html Thu Aug 04 12:54:02 2011 +0200 @@ -0,0 +1,79 @@ +{% extends "ldt/ldt_base.html" %} +{% load i18n %} + +{% block js_import %} +{{block.super}} + +{% endblock %} + + +{% block js_declaration %} +{{block.super}} + + +{% endblock %} + +{% block css_import %} +{{block.super}} + +{% endblock %} + +{% block content %} +
+
+
+
{% trans "Search" %}
+
+
+ + {% csrf_token %} + + {{ form.as_table }} +
+ +
+
+
+
+
{% trans "Published projects" %} +  {% trans 'Create project' %}
+
+
loader
+
+
+
+ {% include "ldt/ldt_utils/partial/publishedprojectslist.html" %} +
+
+
+{% endblock %} diff -r 3ac45d07640a -r 5c3ed9c919bb src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html --- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html Wed Jun 29 12:17:41 2011 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/workspace_base.html Thu Aug 04 12:54:02 2011 +0200 @@ -12,7 +12,7 @@