     # afterAttach is called 2x when dep cop is the active pane item on reload.
     return if @subscribedToEvents
 
+    self = this
+
     @openBlogPost.on 'click', =>
       require('shell').openExternal('http://blog.atom.io/2015/05/01/removing-deprecated-apis.html')
       false

    "#{repoUrl}/issues/new?title=#{encodeURI(title)}&body=#{encodeURI(body)}"

  createSelectorIssueUrl: (packageName, deprecation, sourcePath) ->
    return unless repo = atom.packages.getLoadedPackage(packageName)?.metadata?.repository
    repoUrl = repo.url ? repo
    repoUrl = repoUrl.replace(/\.git$/, '')

    title = deprecation.message
    body = "In #{sourcePath}: #{deprecation.message}"

                      @div class: 'list-item deprecation-message', =>
                        @raw marked(deprecation.message)

                      if issueUrl = self.createSelectorIssueUrl(packageName, deprecation, sourcePath)
                        repoUrl = self.getRepoUrl(packageName)
                        issueTitle = deprecation.message

                        @div class: 'btn-toolbar', =>
                          @button class: 'btn issue-url', 'data-issue-title': issueTitle, 'data-repo-url': repoUrl, 'data-issue-url': issueUrl, 'Report Issue'
