X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9202593034e80f15577c7bc39af7245a25aacb10..8d490fc7810e0052bad3414b445b24276bbfca63:/platforma/static/js/views/gallery.js?ds=sidebyside diff --git a/platforma/static/js/views/gallery.js b/platforma/static/js/views/gallery.js index 1808ea18..a403c9ef 100644 --- a/platforma/static/js/views/gallery.js +++ b/platforma/static/js/views/gallery.js @@ -218,21 +218,24 @@ var ImageGalleryView = View.extend({ render: function(template) { - if(!this.model) return; - - /* first unbind all */ - if(this.$nextButton) this.$nextButton.unbind(); - if(this.$prevButton) this.$prevButton.unbind(); - if(this.$jumpButton) this.$jumpButton.unbind(); - if(this.$pageInput) this.$pageInput.unbind(); - - if(this.$zoomInButton) this.$zoomInButton.unbind(); - if(this.$zoomOutButton) this.$zoomOutButton.unbind(); - if(this.$zoomResetButton) this.$zoomResetButton.unbind(); - + if(!this.model) return; + + $('.choose-gallery-button', this.element).unbind(); + + /* first unbind all */ + if(this.$nextButton) this.$nextButton.unbind(); + if(this.$prevButton) this.$prevButton.unbind(); + if(this.$jumpButton) this.$jumpButton.unbind(); + if(this.$pageInput) this.$pageInput.unbind(); + + if(this.$zoomInButton) this.$zoomInButton.unbind(); + if(this.$zoomOutButton) this.$zoomOutButton.unbind(); + if(this.$zoomResetButton) this.$zoomResetButton.unbind(); + + if (!template) { /* render */ - this._super(template); - + this._super(); + /* fetch important parts */ this.$pageListRoot = $('.image-gallery-page-list', this.element); this.$pages = $('.image-gallery-page-container', this.$pageListRoot); @@ -258,6 +261,15 @@ var ImageGalleryView = View.extend({ this.gotoPage(this.currentPage); this.changePageZoom(this.pageZoom); + } else { + this._super(template); + + var self = this; + $('.choose-gallery-button', self.element).click(function() { + console.log('CLICK CLICK') + self.model.setGallery($('#id_subpath', self.element).val()); + }); + } }, jumpToPage: function() {