1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2025-02-22 19:54:24 +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({ this.tagFilterView = new OCA.Bookmarks.TagFilterView({
collection: this.allTagsCollection, collection: this.allTagsCollection,
id: 'tagitManager' id: 'tagitManager',
el: '#tag_filter input'
}); });
this.settingsView = new OCA.Bookmarks.SettingsView({ this.settingsView = new OCA.Bookmarks.SettingsView({
@ -100,6 +101,9 @@
this.allTagsCollection.fetch(); this.allTagsCollection.fetch();
console.warn('INiT DONE'); console.warn('INiT DONE');
//FIXME: do be done by bookmarks collection
getBookmarks();
} }
}; };
})(); })();

View File

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

View File

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