handle removal of keywords

This commit is contained in:
Frédéric Péters 2013-04-14 14:52:09 +02:00
parent dbedab053e
commit 07e047d53f
1 changed files with 12 additions and 2 deletions

View File

@ -27,13 +27,23 @@
tal:attributes="data-term-id item/value">
<span tal:content="item/content"
/> <span class="remove">×</span></span
><tal:block condition="not:repeat/item/end">, </tal:block
></tal:block
></tal:block
></span>
<a href="#" class="kw_add_link">Add keyword</a>
<script type="text/javascript" tal:content="structure view/js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('span.remove').unbind('click').click(function() {
var field = $(this).parents('.field');
var term_id = $(this).parent().attr('data-term-id');
$(field).find('select option[id=' + term_id + ']').remove();
$(this).parent().remove();
});
});
</script>
<style type="text/css">
span.selected-option {
border: 1px solid gray;