Added project description and tooltip
authorverrierj
Thu, 15 Sep 2011 16:32:00 +0200
changeset 178 4b83c370dc8a
parent 177 32fbed79d3a1
child 179 03007a7c14ca
Added project description and tooltip
src/ldt/ldt/ldt_utils/forms.py
src/ldt/ldt/ldt_utils/migrations/0004_auto__add_field_project_description.py
src/ldt/ldt/ldt_utils/models.py
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html
src/ldt/ldt/ldt_utils/views.py
src/ldt/ldt/locale/en/LC_MESSAGES/django.mo
src/ldt/ldt/locale/fr/LC_MESSAGES/django.mo
src/ldt/ldt/static/ldt/js/projectscontents.js
web/ldtplatform/locale/fr/LC_MESSAGES/django.po
--- a/src/ldt/ldt/ldt_utils/forms.py	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/forms.py	Thu Sep 15 16:32:00 2011 +0200
@@ -12,6 +12,7 @@
 class LdtAddForm(forms.ModelForm):
     title = forms.CharField()
     contents = forms.ModelMultipleChoiceField(Content.objects.all()) #@UndefinedVariable
+    description = forms.CharField(widget=forms.Textarea, required=False)
     # owner = forms.ModelChoiceField(Author.objects.all())
     class Meta:
         model = Project
@@ -28,6 +29,7 @@
 
 class AddProjectForm (forms.Form):
     title = forms.CharField(widget=forms.TextInput(attrs={'class':'inputbox required'}))
+    description = forms.CharField(widget=forms.Textarea, required=False)
 
 class CopyProjectForm (forms.Form):
     title = forms.CharField()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/ldt_utils/migrations/0004_auto__add_field_project_description.py	Thu Sep 15 16:32:00 2011 +0200
@@ -0,0 +1,135 @@
+#@PydevCodeAnalysisIgnore
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        
+        # Adding field 'Project.description'
+        db.add_column('ldt_utils_project', 'description', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False)
+
+
+    def backwards(self, orm):
+        
+        # Deleting field 'Project.description'
+        db.delete_column('ldt_utils_project', 'description')
+
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'ldt_utils.author': {
+            'Meta': {'object_name': 'Author'},
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+            'firstname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'handle': ('django.db.models.fields.CharField', [], {'max_length': '512', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'lastname': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.content': {
+            'Meta': {'ordering': "['title']", 'object_name': 'Content'},
+            'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Author']", 'symmetrical': 'False', 'blank': 'True'}),
+            'content_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'iri_id': ('django.db.models.fields.CharField', [], {'default': "u'97a10691-df82-11e0-a2a1-001485352c9a'", 'unique': 'True', 'max_length': '1024'}),
+            'iriurl': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'media_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Media']", 'null': 'True', 'blank': 'True'}),
+            'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.media': {
+            'Meta': {'object_name': 'Media'},
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'external_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_permalink': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_publication_url': ('django.db.models.fields.URLField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'external_src_url': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'media_creation_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'mimetype_field': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True', 'blank': 'True'}),
+            'src': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'update_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'videopath': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'})
+        },
+        'ldt_utils.project': {
+            'Meta': {'ordering': "['title']", 'object_name': 'Project'},
+            'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+            'contents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ldt_utils.Content']", 'symmetrical': 'False'}),
+            'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}),
+            'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ldt': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+            'ldt_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '1024'}),
+            'modification_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'state': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
+        },
+        'ldt_utils.segment': {
+            'Meta': {'unique_together': "(('project_id', 'iri_id', 'ensemble_id', 'cutting_id', 'element_id'),)", 'object_name': 'Segment'},
+            'abstract': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'content': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Content']"}),
+            'cutting_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'date': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
+            'duration': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'element_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'ensemble_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'iri_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+            'project_id': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
+            'project_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ldt_utils.Project']", 'null': 'True'}),
+            'start_ts': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'tags': ('tagging.fields.TagField', [], {'max_length': '2048', 'null': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['ldt_utils']
--- a/src/ldt/ldt/ldt_utils/models.py	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/models.py	Thu Sep 15 16:32:00 2011 +0200
@@ -306,6 +306,7 @@
     created_by = models.CharField(_("created by"), max_length=70)
     changed_by = models.CharField(_("changed by"), max_length=70)
     state = models.IntegerField(choices=STATE_CHOICES, default=1)
+    description = models.TextField(null=True, blank=True)
     
     class Meta:
         ordering = ["title"]
@@ -351,10 +352,10 @@
     stream_mode = property(**stream_mode())
 
     @staticmethod
-    def create_project(user, title, contents):
+    def create_project(user, title, contents, description=''):
 #        owner = Owner.objects.get(user=user) #@UndefinedVariable
         owner = user
-        project = Project(title=title, owner=owner)
+        project = Project(title=title, owner=owner, description=description)
         project.ldt_id = str(uuid.uuid1()) #@UndefinedVariable
         project.created_by = user.username
         project.changed_by = user.username
@@ -365,10 +366,10 @@
         project.save()
         return create_ldt(project, user)
 
-    def copy_project(self, user, title):
+    def copy_project(self, user, title, description=''):
 #        owner = Owner.objects.get(user=user) #@UndefinedVariable
         owner = user
-        project = Project(title=title, owner=owner)
+        project = Project(title=title, owner=owner, description=description)
         project = copy_ldt(self, project, user)
         project.save()
         for content in self.contents.all():
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html	Thu Sep 15 16:32:00 2011 +0200
@@ -15,6 +15,14 @@
 	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/ldt.css" />
 	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/ldtform.css" />
 	<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" />
+	<style type="text/css" >
+		textarea {
+			padding: 0px;
+			width:390px;
+			height: 100px;
+		}
+	
+	</style>
 {% endblock %}
 
 {% block js_declaration %}
@@ -53,6 +61,8 @@
 	<input type="hidden" name="form_status" value="{{form_status}}" id="project_form_status" />
 	<label for="title">{% trans "Title" %}:</label>
 	{{form.title}}
+	<label for="description" class="projectdesc">{% trans "Description :" %}</label>
+	{{form.description}}
 	<label>{% trans "List of contents" %}</label>	
 	<div class="span-12 last projectscontentsdiv" id="ldtcreatecontentslistcontainer">
 		<div class="span-12 last projectscontentstablediv" id="ldtcreatecontentstablediv">
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html	Thu Sep 15 16:32:00 2011 +0200
@@ -24,13 +24,13 @@
         </td>
         <td class="projecttitle">
         {% ifequal project.state 2 %}
-        {% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}
+        {% if show_username %}{{ project.owner.username }} : {% endif %} <span class="projectinfos" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}">{{ project.title }}</span>
         {% else %}
-        <a class="projecttitlelink" href="{% url ldt.ldt_utils.views.update_project ldt_id=project.ldt_id %}">{% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}</a>
+        <a class="projecttitlelink" href="{% url ldt.ldt_utils.views.update_project ldt_id=project.ldt_id %}">{% if show_username %}{{ project.owner.username }} : {% endif %}<span class="projectinfos" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}">{{ project.title }}</span></a>
         {% endifequal %}
         </td>
     </tr>
 {% endfor %}
     </tbody>
 </table>
-</div>
+</div>
\ No newline at end of file
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/publishedprojectslist.html	Thu Sep 15 16:32:00 2011 +0200
@@ -15,7 +15,7 @@
         </td>
         <td class="projecttitle">
         {% ifequal project.state 2 %}
-        {{ project.title }}
+        <span class="projectinfos" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}">{{ project.title }}</span>
         {% else %}
         <a class="projecttitlelink" href="{% url ldt.ldt_utils.views.update_project ldt_id=project.ldt_id %}">{{ project.title }}</a>
         {% endifequal %}
--- a/src/ldt/ldt/ldt_utils/views.py	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/views.py	Thu Sep 15 16:32:00 2011 +0200
@@ -407,9 +407,10 @@
 def create_ldt_view(request):
     if request.method == "POST" :
         form = LdtAddForm(request.POST)
+        
         if form.is_valid():
             user = request.user
-            Project.create_project(title=form.cleaned_data['title'], user=user, contents=form.cleaned_data['contents'])
+            Project.create_project(title=form.cleaned_data['title'], user=user, contents=form.cleaned_data['contents'], description=form.cleaned_data['description'])
             form_status = "saved"
             contents = []
     else:
@@ -803,15 +804,16 @@
             form_status = 'saved'
             form = AddProjectForm(request.POST)
             if form.is_valid():
-                if project.title != form.cleaned_data['title']:
+                if project.title != form.cleaned_data['title'] or project.description != form.cleaned_data['description']:
                     project.title = form.cleaned_data['title']
+                    project.description = form.cleaned_data['description']
                     ldt = lxml.etree.fromstring(project.ldt.encode("utf-8"))
                     res = ldt.xpath("/iri/project")
                     res[0].set("title", project.title)
                     project.ldt = lxml.etree.tostring(ldt, pretty_print=True)
                     project.save()
     else:
-        form = AddProjectForm({'title':unicode(project.title)})
+        form = AddProjectForm({'title':unicode(project.title), 'description':unicode(project.description)})
         form_status = 'none'
         
     return render_to_response('ldt/ldt_utils/create_ldt.html', {'form':form, 'form_status':form_status, 'ldt_id': ldt_id, 'contents':contents, 'create_project_action':reverse("ldt.ldt_utils.views.update_project", args=[ldt_id])}, context_instance=RequestContext(request))
Binary file src/ldt/ldt/locale/en/LC_MESSAGES/django.mo has changed
Binary file src/ldt/ldt/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/ldt/ldt/static/ldt/js/projectscontents.js	Thu Sep 15 12:03:02 2011 +0200
+++ b/src/ldt/ldt/static/ldt/js/projectscontents.js	Thu Sep 15 16:32:00 2011 +0200
@@ -53,19 +53,39 @@
         });
     });
     
+        $.fn.qtip.styles.ldt = {
+    		'opacity' : 0.7,
+    		'-khtml-opacity' : 0.7,
+    		'-moz-opacity' : 0.7,
+    		'filter' : 'alpha(opacity=70)',
+    		border: {
+    			'width': 0,
+    			'color': '#505050'
+    		},
+    		tip: true,
+    		name: 'dark'
+    }
+    
     $('.cellimgdiv img').qtip({ 
-        style: { 
-            'name': 'dark',
-            'filter':'alpha(opacity=70)',
-            '-moz-opacity':'0.7',
-            '-khtml-opacity': '0.7',
-            'opacity': '0.7',
-            'border': {
-                'width' : '0',
-                'color': '#505050'
-            }, 
-            'tip': true
-        } 
+        style: 'ldt',
+    });
+    
+    $('.projectinfos').each( function () {
+        var desc = $(this).attr('data-desc');
+        if (desc == 'None') {
+            desc = '';
+        }
+        $(this).qtip({ 
+            content : {
+                text: '<b>' + $(this).attr('data-title') + '</b><br />' + desc,
+            },   
+            style : 'ldt',
+            position : {
+              corner: {
+                 target : 'bottomLeft'
+              }
+           },
+        });
     });
 }
 
@@ -264,7 +284,7 @@
 function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
 
     init_modal_window ('.ldt_link_open_ldt', 1025, 660, 1015, 650, base_node, searchprojectfilterurl);
-    init_modal_window ('.ldt_link_create_project', 500, 520, 500, 510, base_node, searchprojectfilterurl);
+    init_modal_window ('.ldt_link_create_project', 500, 700, 500, 690, base_node, searchprojectfilterurl);
     init_modal_window ('.ldt_link_copy_project', 500, 150, 500, 150, base_node, searchprojectfilterurl);
 
      
@@ -313,7 +333,7 @@
         filters: ['iframe'],
         sizes: {
             minW: '510',
-            minH: '560'
+            minH: '700'
         },
         callbacks: {
             afterClose: function(nm) {
@@ -324,7 +344,7 @@
                 iframe.load(function(){
 
                     nm.store.iframe.width(500);
-                    nm.store.iframe.height(550);
+                    nm.store.iframe.height(690);
                     
                     var form_status = $(this).contents().find("#project_form_status").val(); 
                     if(form_status === 'saved' || form_status === 'deleted') {
--- a/web/ldtplatform/locale/fr/LC_MESSAGES/django.po	Thu Sep 15 12:03:02 2011 +0200
+++ b/web/ldtplatform/locale/fr/LC_MESSAGES/django.po	Thu Sep 15 16:32:00 2011 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-30 12:21+0200\n"
+"POT-Creation-Date: 2011-09-14 16:54+0200\n"
 "PO-Revision-Date: 2010-02-17 02:57+0100\n"
 "Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,6 +20,10 @@
 msgid "French"
 msgstr "Français"
 
+#: .\settings.py:41
+msgid "English"
+msgstr ""
+
 #: .\templates\registration\login.html.py:21
 msgid "Log in"
 msgstr "Connexion"