{"action":"created","comment":{"url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/comments/39957590","id":39957590,"diff_hunk":"@@ -0,0 +1,200 @@\n+define([\n+  'jquery',\n+  'DoughBaseComponent',\n+  'eventsWithPromises',\n+  'utilities',\n+  'common'\n+], function($, DoughBaseComponent, eventsWithPromises, utilities, MAS) {\n+  'use strict';\n+\n+  var NewsletterSticky,\n+    defaultConfig = {\n+      appearsAfterPercentage: 40,\n+      visibleClassName: 'news-signup-sticky--visible',\n+      closeClassSelector: '.news-signup-sticky__close',\n+      closedClassName: 'news-signup-sticky__close--closed'\n+    },\n+    $newsletterStickForm,\n+    newsletterCloseBoxCookieURL;\n+\n+  NewsletterSticky = function($el, config) {\n+    NewsletterSticky.baseConstructor.call(this, $el, config, defaultConfig);\n+  };\n+\n+  /**\n+   * Inherit from base module, for shared methods and interface\n+   */\n+  DoughBaseComponent.extend(NewsletterSticky);\n+\n+  NewsletterSticky.componentName = 'NewsletterSticky';\n+\n+  /**\n+   * Initialize the component\n+   * @param {Promise} initialised\n+   * @return {NewsletterSticky}\n+   */\n+  NewsletterSticky.prototype.init = function(initialised) {\n+    this._initialisedSuccess(initialised);\n+    this._setVars();\n+\n+    this._setListeners(true);\n+    this._handleScroll();\n+\n+    return this;\n+  };\n+\n+  /**\n+   * Sets up local variables for the sticky newsletter component\n+   */\n+  NewsletterSticky.prototype._setVars = function() {\n+    this.closeButton = this.$el.find(this.config.closeClassSelector);\n+    this.window = $(window);\n+\n+    $newsletterStickForm = this.$el.find('form');\n+    newsletterCloseBoxCookieURL = $newsletterStickForm.find('#close-box-cookie-url').val();\n+  };\n+\n+  /**\n+   * Turn on and off the events\n+   * @param {Boolean} isActive true=on false=off\n+   */\n+  NewsletterSticky.prototype._setListeners = function(isActive) {\n+    this._setScrollListener(isActive);\n+\n+    if (isActive) {\n+      this.closeButton.on('click', $.proxy(this._handleCloseClick, this));\n+      this.$el.on('click', '.button--done', $.proxy(this._handleCloseClick, this));\n+      $newsletterStickForm.on('ajax:error', $.proxy(this._formAjaxErrorHandler, this));\n+    }\n+    else {\n+      this.closeButton.off('click', $.proxy(this._handleCloseClick, this));\n+      this.$el.off('click', '.button--done', $.proxy(this._handleCloseClick, this));\n+      $newsletterStickForm.off('ajax:error', $.proxy(this._formAjaxErrorHandler, this));\n+    }\n+  };\n+\n+  /**\n+   * Sets the scroll event on the window on or off\n+   * @param {Boolean} isActive true=on false=off\n+   */\n+  NewsletterSticky.prototype._setScrollListener = function(isActive) {\n+    $(window)[isActive ? 'on' : 'off']('scroll.newsletter', this._scrollDebounceMethod(isActive));","path":"app/assets/javascripts/components/NewsletterSticky.js","position":81,"original_position":81,"commit_id":"ae8b52ad5681613c3f9981f5dc8c38f7eab26e56","original_commit_id":"ae8b52ad5681613c3f9981f5dc8c38f7eab26e56","user":{"login":"benbarnett","id":295469,"avatar_url":"https://avatars.githubusercontent.com/u/295469?v=3","gravatar_id":"","url":"https://api.github.com/users/benbarnett","html_url":"https://github.com/benbarnett","followers_url":"https://api.github.com/users/benbarnett/followers","following_url":"https://api.github.com/users/benbarnett/following{/other_user}","gists_url":"https://api.github.com/users/benbarnett/gists{/gist_id}","starred_url":"https://api.github.com/users/benbarnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benbarnett/subscriptions","organizations_url":"https://api.github.com/users/benbarnett/orgs","repos_url":"https://api.github.com/users/benbarnett/repos","events_url":"https://api.github.com/users/benbarnett/events{/privacy}","received_events_url":"https://api.github.com/users/benbarnett/received_events","type":"User","site_admin":false},"body":"Also should use `this.window` as it's cached from the `setVars` method","created_at":"2015-09-21T10:30:37Z","updated_at":"2015-09-21T10:30:37Z","html_url":"https://github.com/moneyadviceservice/frontend/pull/1212#discussion_r39957590","pull_request_url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212","_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/comments/39957590"},"html":{"href":"https://github.com/moneyadviceservice/frontend/pull/1212#discussion_r39957590"},"pull_request":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212"}}},"pull_request":{"url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212","id":45412947,"html_url":"https://github.com/moneyadviceservice/frontend/pull/1212","diff_url":"https://github.com/moneyadviceservice/frontend/pull/1212.diff","patch_url":"https://github.com/moneyadviceservice/frontend/pull/1212.patch","issue_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues/1212","number":1212,"state":"open","locked":false,"title":"#6501 - Newsletter sign-up - Sticky footer","user":{"login":"nmiddleweek","id":2251042,"avatar_url":"https://avatars.githubusercontent.com/u/2251042?v=3","gravatar_id":"","url":"https://api.github.com/users/nmiddleweek","html_url":"https://github.com/nmiddleweek","followers_url":"https://api.github.com/users/nmiddleweek/followers","following_url":"https://api.github.com/users/nmiddleweek/following{/other_user}","gists_url":"https://api.github.com/users/nmiddleweek/gists{/gist_id}","starred_url":"https://api.github.com/users/nmiddleweek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmiddleweek/subscriptions","organizations_url":"https://api.github.com/users/nmiddleweek/orgs","repos_url":"https://api.github.com/users/nmiddleweek/repos","events_url":"https://api.github.com/users/nmiddleweek/events{/privacy}","received_events_url":"https://api.github.com/users/nmiddleweek/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-18T14:33:25Z","updated_at":"2015-09-21T10:30:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82e657265c0ac4591e03a704c2f869c57ed40bae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212/commits","review_comments_url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212/comments","review_comment_url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues/1212/comments","statuses_url":"https://api.github.com/repos/moneyadviceservice/frontend/statuses/ae8b52ad5681613c3f9981f5dc8c38f7eab26e56","head":{"label":"moneyadviceservice:newsletter_signup_nbm","ref":"newsletter_signup_nbm","sha":"ae8b52ad5681613c3f9981f5dc8c38f7eab26e56","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":15315123,"name":"frontend","full_name":"moneyadviceservice/frontend","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/frontend","description":"The Money Advice Service's improved website.","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/frontend","forks_url":"https://api.github.com/repos/moneyadviceservice/frontend/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/frontend/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/frontend/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/frontend/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/frontend/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/frontend/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/frontend/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/frontend/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/frontend/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/frontend/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/frontend/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/frontend/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/frontend/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/frontend/releases{/id}","created_at":"2013-12-19T15:25:21Z","updated_at":"2015-06-15T15:35:39Z","pushed_at":"2015-09-18T14:33:25Z","git_url":"git://github.com/moneyadviceservice/frontend.git","ssh_url":"git@github.com:moneyadviceservice/frontend.git","clone_url":"https://github.com/moneyadviceservice/frontend.git","svn_url":"https://github.com/moneyadviceservice/frontend","homepage":"https://www.moneyadviceservice.org.uk  ","size":38971,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":19,"forks":5,"open_issues":19,"watchers":4,"default_branch":"master"}},"base":{"label":"moneyadviceservice:master","ref":"master","sha":"0bd7c0bf6efbe5a91ed817001a02797965de5d70","user":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"repo":{"id":15315123,"name":"frontend","full_name":"moneyadviceservice/frontend","owner":{"login":"moneyadviceservice","id":2064781,"avatar_url":"https://avatars.githubusercontent.com/u/2064781?v=3","gravatar_id":"","url":"https://api.github.com/users/moneyadviceservice","html_url":"https://github.com/moneyadviceservice","followers_url":"https://api.github.com/users/moneyadviceservice/followers","following_url":"https://api.github.com/users/moneyadviceservice/following{/other_user}","gists_url":"https://api.github.com/users/moneyadviceservice/gists{/gist_id}","starred_url":"https://api.github.com/users/moneyadviceservice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moneyadviceservice/subscriptions","organizations_url":"https://api.github.com/users/moneyadviceservice/orgs","repos_url":"https://api.github.com/users/moneyadviceservice/repos","events_url":"https://api.github.com/users/moneyadviceservice/events{/privacy}","received_events_url":"https://api.github.com/users/moneyadviceservice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/moneyadviceservice/frontend","description":"The Money Advice Service's improved website.","fork":false,"url":"https://api.github.com/repos/moneyadviceservice/frontend","forks_url":"https://api.github.com/repos/moneyadviceservice/frontend/forks","keys_url":"https://api.github.com/repos/moneyadviceservice/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moneyadviceservice/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moneyadviceservice/frontend/teams","hooks_url":"https://api.github.com/repos/moneyadviceservice/frontend/hooks","issue_events_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/moneyadviceservice/frontend/events","assignees_url":"https://api.github.com/repos/moneyadviceservice/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/moneyadviceservice/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/moneyadviceservice/frontend/tags","blobs_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moneyadviceservice/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/moneyadviceservice/frontend/languages","stargazers_url":"https://api.github.com/repos/moneyadviceservice/frontend/stargazers","contributors_url":"https://api.github.com/repos/moneyadviceservice/frontend/contributors","subscribers_url":"https://api.github.com/repos/moneyadviceservice/frontend/subscribers","subscription_url":"https://api.github.com/repos/moneyadviceservice/frontend/subscription","commits_url":"https://api.github.com/repos/moneyadviceservice/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/moneyadviceservice/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/moneyadviceservice/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/moneyadviceservice/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/moneyadviceservice/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moneyadviceservice/frontend/merges","archive_url":"https://api.github.com/repos/moneyadviceservice/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moneyadviceservice/frontend/downloads","issues_url":"https://api.github.com/repos/moneyadviceservice/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/moneyadviceservice/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/moneyadviceservice/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/moneyadviceservice/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moneyadviceservice/frontend/labels{/name}","releases_url":"https://api.github.com/repos/moneyadviceservice/frontend/releases{/id}","created_at":"2013-12-19T15:25:21Z","updated_at":"2015-06-15T15:35:39Z","pushed_at":"2015-09-18T14:33:25Z","git_url":"git://github.com/moneyadviceservice/frontend.git","ssh_url":"git@github.com:moneyadviceservice/frontend.git","clone_url":"https://github.com/moneyadviceservice/frontend.git","svn_url":"https://github.com/moneyadviceservice/frontend","homepage":"https://www.moneyadviceservice.org.uk  ","size":38971,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":19,"forks":5,"open_issues":19,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212"},"html":{"href":"https://github.com/moneyadviceservice/frontend/pull/1212"},"issue":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/issues/1212"},"comments":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/issues/1212/comments"},"review_comments":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212/comments"},"review_comment":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/pulls/1212/commits"},"statuses":{"href":"https://api.github.com/repos/moneyadviceservice/frontend/statuses/ae8b52ad5681613c3f9981f5dc8c38f7eab26e56"}}}}