Delete catgories from DOM
This commit is contained in:
parent
7bdf03f159
commit
8f01c714e4
@ -18,19 +18,19 @@
|
|||||||
<tbody id="categories"></tbody>
|
<tbody id="categories"></tbody>
|
||||||
<script id="template" type="text/x-handlers-template">
|
<script id="template" type="text/x-handlers-template">
|
||||||
{{#each categories}}
|
{{#each categories}}
|
||||||
<tr>
|
<tr class="category_{{id}}">
|
||||||
<td class="text-left">{{description}}</td>
|
<td class="text-left">{{description}}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<input type="radio" name="category_{{id}}" data-categoryId="{{id}}" value="1" {{checkMatch 1}}> Agree
|
<input type="radio" name="category_{{id}}" data-categoryId="{{id}}" value="1" {{checkMatch 1}}> Agree
|
||||||
</label>
|
</label>
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<input type="radio" name="category_{{id}}" data-categoryId="{{id}}" value="-1" {{checkMatch -1}}> Disagree
|
<input type="radio" name="category_{{id}}" data-categoryId="{{id}}" value="-1" {{checkMatch -1}}> Disagree
|
||||||
</label>
|
</label>
|
||||||
<label class="radio-inline">
|
<label class="radio-inline">
|
||||||
<input type="radio" name="category_{{id}}" data-categoryId="{{id}}" value="0" {{checkMatch 0}}> Neither
|
<input type="radio" name="category_{{id}}" data-categoryId="{{id}}" value="0" {{checkMatch 0}}> Neither
|
||||||
</label>
|
</label>
|
||||||
<button type="button" data-categoryId="{{id}}" class="btn btn-xs btn-danger">×</button>
|
<button type="button" data-categoryId="{{id}}" class="btn btn-xs btn-danger">×</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -51,7 +51,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeCategory(id) {
|
function removeCategory(id) {
|
||||||
alert('Delete stub');
|
$.getJSON('/forget', {id: id}, function(results) {
|
||||||
|
if (results.success) {
|
||||||
|
$('tr.category_' + id).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayCategories(categories) {
|
function displayCategories(categories) {
|
||||||
|
Loading…
Reference in New Issue
Block a user