1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-02-21 18:54:32 +01:00

reset tags behaviour moved to corresponding view

This commit is contained in:
Arthur Schiwon 2015-12-27 17:54:59 +01:00
parent 13d54eb625
commit b723428225
3 changed files with 14 additions and 10 deletions

View File

@ -85,7 +85,8 @@
this.tagFilterView = new OCA.Bookmarks.TagFilterView({
collection: this.allTagsCollection,
id: 'tagitManager'
id: 'tagitManager',
el: '#tag_filter input'
});
this.settingsView = new OCA.Bookmarks.SettingsView({
@ -100,6 +101,9 @@
this.allTagsCollection.fetch();
console.warn('INiT DONE');
//FIXME: do be done by bookmarks collection
getBookmarks();
}
};
})();

View File

@ -6,9 +6,6 @@ var ajaxCallCount = 0;
$(document).ready(function () {
$('.bookmarks_list').scroll(updateOnBottom).empty();
$('.navigationAllBookmarks').click(resetTagFilter);
getBookmarks();
});
var formatString = (function () {
@ -59,10 +56,6 @@ function addFilterTag(event) {
$('#tag_filter input').tagit('createTag', $(this).text());
}
function resetTagFilter() {
$('#tag_filter input').tagit('removeAll');
}
function updateTagsList(tag) {
var selectedTags = $('#tag_filter input').tagit('assignedTags');

View File

@ -13,23 +13,30 @@
var TagFilterView = OC.Backbone.View.extend({
initialize: function(options) {
_.bindAll(this, 'reset');
var view = this;
this.collection.on('add remove', function() { view.render() });
$('#tag_filter input').tagit({
this.$el.tagit({
allowSpaces: true
});
$('.navigationAllBookmarks').on('click', this.reset);
},
render: function() {
console.warn('RUNNING');
$('#tag_filter input').tagit({
this.$el.tagit({
allowSpaces: true,
availableTags: this.collection.getLabels(),
onTagFinishRemoved: filterTagsChanged,
placeholderText: t('bookmarks', 'Filter by tag')
}).tagit('option', 'onTagAdded', filterTagsChanged);
},
reset: function() {
this.$el.tagit('removeAll');
}
});