2015-11-30 17:40:17 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3
|
|
|
|
* or later.
|
|
|
|
*
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
OCA.SystemTags = _.extend({}, OCA.SystemTags);
|
|
|
|
if (!OCA.SystemTags) {
|
|
|
|
/**
|
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
OCA.SystemTags = {};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @namespace
|
|
|
|
*/
|
|
|
|
OCA.SystemTags.FilesPlugin = {
|
2016-02-16 13:24:44 +03:00
|
|
|
ignoreLists: [
|
|
|
|
'files_trashbin',
|
|
|
|
'files.public'
|
2015-11-30 17:40:17 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
attach: function(fileList) {
|
2016-02-16 13:24:44 +03:00
|
|
|
if (this.ignoreLists.indexOf(fileList.id) >= 0) {
|
2015-11-30 17:40:17 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-06-09 09:57:34 +03:00
|
|
|
var systemTagsInfoView = new OCA.SystemTags.SystemTagsInfoView();
|
|
|
|
fileList.registerDetailView(systemTagsInfoView);
|
|
|
|
|
|
|
|
_.each(fileList.getRegisteredDetailViews(), function(detailView) {
|
|
|
|
if (detailView instanceof OCA.Files.MainFileInfoDetailView) {
|
2017-06-09 10:09:41 +03:00
|
|
|
var systemTagsInfoViewToggleView =
|
|
|
|
new OCA.SystemTags.SystemTagsInfoViewToggleView({
|
|
|
|
systemTagsInfoView: systemTagsInfoView
|
|
|
|
});
|
|
|
|
systemTagsInfoViewToggleView.render();
|
|
|
|
|
|
|
|
// The toggle view element is detached before the
|
|
|
|
// MainFileInfoDetailView is rendered to prevent its event
|
|
|
|
// handlers from being removed.
|
|
|
|
systemTagsInfoViewToggleView.listenTo(detailView, 'pre-render', function() {
|
|
|
|
systemTagsInfoViewToggleView.$el.detach();
|
|
|
|
});
|
|
|
|
systemTagsInfoViewToggleView.listenTo(detailView, 'post-render', function() {
|
2018-08-21 17:28:37 +03:00
|
|
|
var clicker = _.bind(systemTagsInfoViewToggleView.click, systemTagsInfoViewToggleView);
|
|
|
|
systemTagsInfoViewToggleView.$el.click(clicker);
|
2017-06-09 10:09:41 +03:00
|
|
|
detailView.$el.find('.file-details').append(systemTagsInfoViewToggleView.$el);
|
|
|
|
});
|
2017-06-09 09:57:34 +03:00
|
|
|
}
|
|
|
|
});
|
2015-11-30 17:40:17 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
OC.Plugins.register('OCA.Files.FileList', OCA.SystemTags.FilesPlugin);
|
|
|
|
|