Commits

Kai Diefenbach committed 610ce8f

Fixed template selection; issue #134

Comments (0)

Files changed (3)

lfs/manage/views/categories/view.py

     }))
 
     if request.is_ajax():
+        html = [["#view", view_html]]
         return HttpResponse(simplejson.dumps({
-            "view": view_html,
+            "html": html,
             "message": message,
         }, cls=LazyEncoder))
     else:

lfs/templates/manage/category/view.html

 
 <form action="{% url lfs_manage_category_view category.id %}"
       method="post"
-      class="category-data-form"
-      enctype="multipart/form-data">
+      class="category-data-form">
     {% csrf_token %}
-
     {% include "manage/lfs_form.html" %}
-
     <div class="buttons">
         <input value="{% trans 'Save View' %}"
                type="submit"
             }
         }
     })
-</script>
+</script>

lfs/templates/manage/widgets/selectimage.html

 {% load i18n %}
 
-<select onchange ="document.getElementById('{{selectimageid}}').src=this.options[this.selectedIndex].title" {{ finalattrs|safe }}>
+<select {{ finalattrs|safe }}>
     {% for id, urls in choices %}
         {% with id|stringformat:"s" as idstring %}
-            {% ifequal id currentvalue %}
-                <option value="{{ id }}" title="{{urls.image}}" selected="selected">{{urls.name}}</option>
+            {% if idstring == currentvalue or id == currentvalue %}
+                <option value="{{ id }}" title="{{ urls.image }}" selected="selected">{{ urls.name }}</option>
             {% else %}
-                <option value="{{ id }}" title="{{urls.image}}">{{urls.name}}</option>
-            {% endifequal %}
+                <option value="{{ id }}" title="{{ urls.image }}">{{ urls.name }}</option>
+            {% endif %}
         {% endwith %}
     {% endfor %}
 </select>