Corrected bug in description display
authorverrierj
Mon, 19 Sep 2011 10:32:44 +0200
changeset 179 03007a7c14ca
parent 178 4b83c370dc8a
child 180 6c1e1da5ce30
Corrected bug in description display
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html
src/ldt/ldt/ldt_utils/utils.py
src/ldt/ldt/ldt_utils/views.py
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html	Thu Sep 15 16:32:00 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_content.html	Mon Sep 19 10:32:44 2011 +0200
@@ -51,7 +51,7 @@
 
 {% block body %}
 	{% if content_form.errors %}
-	<div id="content-form-error">
+	<!-- <div id="content-form-error">
 		<p>{% trans "The operation could not be performed because one or more error(s) occurred.<br />Please resubmit the content form after making the following changes:" %}</p>
 		<ul>
 		{% for field in content_form %}
@@ -60,7 +60,7 @@
 		</ul>
 	</div>
 	{% endif %}
-
+ -->
 	{% if media_form.errors %}
 	<div id="media-form-error">
 		<p>{% trans "The operation could not be performed because one or more error(s) occurred.<br />Please resubmit the media form after making the following changes:" %}</p>
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html	Thu Sep 15 16:32:00 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html	Mon Sep 19 10:32:44 2011 +0200
@@ -8,11 +8,8 @@
 {% for project in projects %}
     <tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}" >
         {% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %}
-        {% if is_gecko %}
-            <td class="cellimg"><div class="cellimgdiv"><a  href="{% url index_project_full project.ldt_id %}"><img src="{{LDT_MEDIA_PREFIX}}img/page_edit.png" alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/></a></div></td>
-        {% else %}
-            <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}img/page_edit.png" href="{% url index_project project.ldt_id %}" class="ldt_link" alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/></div></td>
-        {% endif %}
+
+        <td class="cellimg"><div class="cellimgdiv"><a  href="{% url index_project_full project.ldt_id %}"><img src="{{LDT_MEDIA_PREFIX}}img/page_edit.png" alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/></a></div></td>
         <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}img/page_copy.png" href="{% url ldt.ldt_utils.views.copy_project project.ldt_id %}" class="ldt_link_copy_project" alt="{% trans 'copy project' %}" title="{% trans 'copy project' %}"/></div></td>
         <td class="cellimg"><div class="cellimgdiv"><img src="{{LDT_MEDIA_PREFIX}}img/plugin.png" href="{{WEB_URL}}{{json_url_id}}" id="player_project_{{project.ldt_id}}" class="ldt_link_embed" alt="{% trans 'link json by id' %}" title="{% trans 'link json by id' %}"/></div></td>
         <td class="cellimg">
@@ -24,9 +21,9 @@
         </td>
         <td class="projecttitle">
         {% ifequal project.state 2 %}
-        {% if show_username %}{{ project.owner.username }} : {% endif %} <span class="projectinfos" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}">{{ project.title }}</span>
+        {% if show_username %}{{ project.owner.username }} : {% endif %} <span class="projectinfos" data-title="{{ project.title }}" data-desc="{{ project.get_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 %}<span class="projectinfos" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}">{{ project.title }}</span></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.get_description|linebreaksbr }}">{{ project.title }}</span></a>
         {% endifequal %}
         </td>
     </tr>
--- a/src/ldt/ldt/ldt_utils/utils.py	Thu Sep 15 16:32:00 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/utils.py	Mon Sep 19 10:32:44 2011 +0200
@@ -174,7 +174,7 @@
     #node project
     elementProject = lxml.etree.SubElement(iri, 'project')
     
-    elementProject.set('abstract', "")
+    elementProject.set('abstract', project.description)
     elementProject.set('title', project.title)
     elementProject.set('user', user.username)
     elementProject.set('id', project.ldt_id)
@@ -261,7 +261,7 @@
     ldt = lxml.etree.fromstring(project.ldt.encode("utf-8"))
     res = ldt.xpath("/iri/project")
     for elementProject in res:
-        elementProject.set('abstract', "")
+        elementProject.set('abstract', project.description)
         elementProject.set('title', new_project.title)
         elementProject.set('user', user.username)
         elementProject.set('id', new_project.ldt_id)
--- a/src/ldt/ldt/ldt_utils/views.py	Thu Sep 15 16:32:00 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/views.py	Mon Sep 19 10:32:44 2011 +0200
@@ -765,7 +765,7 @@
         form = AddProjectForm(request.POST)
         if form.is_valid():
             user = request.user
-            project = Project.create_project(title=form.cleaned_data['title'], user=user, contents=contents)
+            project = Project.create_project(title=form.cleaned_data['title'], user=user, contents=contents, description=form.cleaned_data['description'])
             # Modal window is not used with firefox
             is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
             if is_gecko :
@@ -810,10 +810,11 @@
                     ldt = lxml.etree.fromstring(project.ldt.encode("utf-8"))
                     res = ldt.xpath("/iri/project")
                     res[0].set("title", project.title)
+                    res[0].set("abstract", project.description)
                     project.ldt = lxml.etree.tostring(ldt, pretty_print=True)
                     project.save()
     else:
-        form = AddProjectForm({'title':unicode(project.title), 'description':unicode(project.description)})
+        form = AddProjectForm({'title':unicode(project.title), 'description':unicode(project.get_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))