 
     events: =>
         'click a.delete': @destroyModel
-        'click a.changeclearance': @changeClearance
-        'click a.addcontact': @addcontact
+        'click a.clearance': @changeClearance
         'click a.sendmail': @sendMail
-        'click a.add': @prepareContact
         'click a#rebuild-th-btn': @rebuildThumbs
-        'keyup #mails': @onKeyUpMails
 
     getRenderData: ->
-        clearance = @model.get 'clearance'
-        clearance = 'private' unless clearance?
-        clearanceHelpers = @clearanceHelpers clearance
         res = _.extend
-            clearanceHelpers: clearanceHelpers
             photosNumber: @model.photos.length
         , @model.attributes
         res

                , 500
        recFunc()

    # Check if enter key is pressed.
    onKeyUpMails: (event) ->
        if event.which is 13 or event.keyCode is 13
            @sendMail()

    # Send mail via server to contacts selected for the sharing.
    sendMail: (event) ->
        mails = @$('#mails').val()
        if mails.length is 0
            alert "Please enter an email."
        else
            @$("a.sendmail").spin 'tiny'
            @$("a.sendmail").css 'color', 'transparent'
            @model.sendMail @getPublicUrl(), mails,
                success: =>
                    @$("a.sendmail").spin()
                    @$("a.sendmail").css 'color', 'white'
                    # TODO: translation
                    msg = "Mail was successfully sent to: \n"
                    mails = mails.split(',')
                    for mail in mails
                        msg = msg + "\n" + mail
                    alert msg
                error: (err) =>
                    @$("a.sendmail").spin()
                    @$("a.sendmail").css 'color', 'white'
                    alert JSON.parse(err.responseText).error

    saveModel: (hash) ->
        promise = @model.save(hash)

        path = '/public/' if path is '/'
        hash = window.location.hash.replace '/edit', ''
        return origin + path + hash
