]> source.dussan.org Git - nextcloud-server.git/commitdiff
Trigger pre and post render events in MainFileInfoDetailsView
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Fri, 9 Jun 2017 05:55:27 +0000 (07:55 +0200)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Tue, 13 Jun 2017 14:41:20 +0000 (16:41 +0200)
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>
apps/files/js/mainfileinfodetailview.js

index f5f9e926f64bccd6f90836b7dd6a11d2dfecc696..d703ca8371c6cac51aff7c2d48636867023a97f6 100644 (file)
                 * 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({
                                this.$el.empty();
                        }
                        this.delegateEvents();
+
+                       this.trigger('post-render');
                }
        });