Adding stub for deleting categories
This commit is contained in:
parent
3dd296def2
commit
7bdf03f159
@ -22,14 +22,15 @@
|
|||||||
<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}}" 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}}" 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}}" 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>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -50,12 +50,22 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeCategory(id) {
|
||||||
|
alert('Delete stub');
|
||||||
|
}
|
||||||
|
|
||||||
function displayCategories(categories) {
|
function displayCategories(categories) {
|
||||||
var template = Handlebars.compile($('#template').html());
|
var template = Handlebars.compile($('#template').html());
|
||||||
$('#categories').append(template({categories: categories}));
|
$('#categories').append(template({categories: categories}));
|
||||||
|
|
||||||
$('#categories input:radio').change(function() {
|
$('#categories input:radio').change(function() {
|
||||||
setProfileValue($(this).attr('categoryId'), this.value);
|
setProfileValue($(this).attr('data-categoryId'), this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#categories button').click(function() {
|
||||||
|
if (confirm('Are you sure you want to delete this category?')) {
|
||||||
|
removeCategory($(this).attr('data-categoryId'));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user