Skip to content

Commit

Permalink
Added support for deleting languages in the article_authors.html temp…
Browse files Browse the repository at this point in the history
…late.

This is where translations are assigned, and thus the most logical
(in my mind) place for this functionality.
  • Loading branch information
lethain committed Jul 7, 2008
1 parent 31a252c commit 14283b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion editor/views.py
Expand Up @@ -204,7 +204,7 @@ def update(request):
return HttpResponse("success")


API_CLASSES = {"comment":Comment, "project":Project, "flow":Flow, "tag":Tag, "series":Series, "draft":Draft, "entry":Entry, "author":Author, "resource":Resource, "recommendedsite":RecommendedSite,'site_to_notify':SiteToNotify,'site':Site}
API_CLASSES = {"comment":Comment, "project":Project, "flow":Flow, "tag":Tag, "series":Series, "draft":Draft, "entry":Entry, "author":Author, "resource":Resource, "recommendedsite":RecommendedSite,'site_to_notify':SiteToNotify,'site':Site,"language":Language}

def get_class(str):
return API_CLASSES[str]
Expand Down
18 changes: 17 additions & 1 deletion templates/lifeflow/editor/article_authors.html
Expand Up @@ -55,6 +55,14 @@
update_model("{{ model }}",{{ object.pk }}, data);
});
});

var delete_language = function(pk) {
delete_model("language",pk);
var id = "#language_" + pk;
var opt = "#language_option_" + pk;
$(id).fadeOut('slow');
$(opt).fadeOut('slow');
}
</script>

<div class="editing">
Expand Down Expand Up @@ -84,7 +92,7 @@
<select class="small" id="language" size="10" name="Language">
{% with langs as object_list %}
{% for object in object_list %}
<option value="{{ object.pk }}"> {{ object }} </option>
<option id="language_option_{{ object.pk }}" value="{{ object.pk }}"> {{ object }} </option>
{% endfor %}
{% endwith %}
</select>
Expand Down Expand Up @@ -112,6 +120,14 @@
</form>

</li>
<li>
<p> Delete unwanted languages. </p>
{% for language in langs %}
<a id="language_{{ language.pk}}" class="button negative" onclick="delete_language({{ language.pk }})"> Delete "{{ language }}" </a>
{% endfor %}

</li>


</ul>
</div>
Expand Down

0 comments on commit 14283b2

Please sign in to comment.