Trigger pre and post render events in MainFileInfoDetailsView

The post-render event makes possible to modify the
MainFileInfoDetailsView element once it has been rendered, which is
needed by OCA.SystemTags.FilesPlugin to add the "Tags" label to the file
details, while the pre-render event makes possible to detach added
elements if needed before the MainFileInfoDetailsView is rendered again,
as that removes the events from the child DOM elements even if they
belong to other views.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2017-06-09 07:55:27 +02:00
parent 706106408c
commit 2384703cf6
1 changed files with 4 additions and 0 deletions

View File

@ -150,6 +150,8 @@
* Renders this details view
*/
render: function() {
this.trigger('pre-render');
if (this.model) {
var isFavorite = (this.model.get('tags') || []).indexOf(OC.TAG_FAVORITE) >= 0;
this.$el.html(this.template({
@ -188,6 +190,8 @@
this.$el.empty();
}
this.delegateEvents();
this.trigger('post-render');
}
});