             editable: @options.editable
             collection: @model.photos
             beforeUpload: @beforePhotoUpload
+
+        # Do not run afterRender again when model changed.
+        @model.on 'change', =>
+            data = _.extend {}, @options, @getRenderData()
+            @$el.html @template(data)
+            @$el.find("#photos").append @galery.$el
 
         @galery.album = @model
         @galery.render()

{editable} = require 'lib/helpers'

thProcessor = require 'models/thumbprocessor'
contactModel = require 'models/contact'

Contact = new contactModel()
clipboard = new Clipboard()

module.exports = class AlbumView extends BaseView
    template: require 'templates/album'

                app.router.navigate 'albums', true

    # Change sharing state of the album.
    changeClearance: (event) =>
        @model.set 'clearance', [] unless @model.get('clearance')?
        @model.set 'type', 'album'

        console.log @model
        new ShareModal model: @model


    # Temporary tool to allow people to rebuild the thumbnails with size
    # set recently. New size is larger, so older thumbs looks blurry.
