{"action":"created","comment":{"url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/comments/47785533","id":47785533,"diff_hunk":"@@ -0,0 +1,80 @@\n+$(function () {\n+    var todoList = new TodoList();\n+    todoList.initialize();\n+});\n+\n+var TodoList = function () {\n+\n+    var bindCreationSubmissionEvents, bindCreationModalEvents, showErrorCallout,\n+        disableSubmitButtonIfNoRequired, showCreateModal, bindOpenedModal, bindClosedCreateModal;\n+\n+    this.initialize = function () {\n+        bindCreationSubmissionEvents(this);\n+        bindCreationModalEvents();\n+        disableSubmitButtonIfNoRequired();\n+    };\n+\n+    this.createList = function (options) {\n+        $('.lists').prepend(options.newTodoList);\n+\n+        var todoItem = new TodoItem();\n+        todoItem.initialize();\n+        var addNewItemButton = \"#add-new-item-btn-\" + options.todoListId;\n+        $('#listCreateModal').on('hidden.bs.modal', function() {\n+            todoItem.add(addNewItemButton);\n+            $('.new-todolist-form').trigger('reset');\n+        });\n+    };\n+    bindCreationModalEvents = function () {\n+        disableSubmitButtonIfNoRequired();\n+        bindOpenedModal();\n+        showCreateModal();\n+        bindClosedCreateModal();\n+\n+    };\n+    bindCreationSubmissionEvents = function (self) {\n+        $('.new-todolist-form').on('ajax:error', function (event, xhr) {\n+            var message = JSON.parse(xhr.responseText).error;\n+            showErrorCallout(message);\n+        });\n+        $('.new-todolist-form').on('ajax:success', function (event, options) {\n+            $('#listCreateModal').modal('toggle');\n+            self.createList(options);\n+        });\n+    };\n+\n+    bindOpenedModal = function() {\n+        $('#listCreateModal').on('shown.bs.modal', function() {\n+            $('.new-todolist-form').find('#list_title').focus();\n+        });\n+    };\n+\n+    bindClosedCreateModal = function() {\n+        $('#listCreateModal').on('hidden.bs.modal', function() {\n+            $('#list-error-callout').hide();\n+            disableSubmitButtonIfNoRequired();\n+            $('.add-new-list-btn').attr('disabled', false);\n+            $('.new-todolist-form').trigger('reset');\n+        });\n+    };\n+    showCreateModal = function() {\n+        $('.add-new-list-btn').click(function(){\n+            $('.add-new-list-btn').attr('disabled', true);\n+            $('#listCreateModal').modal('toggle');\n+        });\n+    };\n+    showErrorCallout = function (message) {\n+        $('#list-error-callout').css('display', 'block').html(message);\n+        $('#list_title').focus();\n+    };\n+\n+    disableSubmitButtonIfNoRequired = function () {\n+        $('.list-form-submit-btn').attr('disabled',true);","path":"app/assets/javascripts/lists.js","position":72,"original_position":72,"commit_id":"f7b330441eb80d21d72108084a59a2a244e8e2c3","original_commit_id":"f7b330441eb80d21d72108084a59a2a244e8e2c3","user":{"login":"serhiir","id":16033240,"avatar_url":"https://avatars.githubusercontent.com/u/16033240?v=3","gravatar_id":"","url":"https://api.github.com/users/serhiir","html_url":"https://github.com/serhiir","followers_url":"https://api.github.com/users/serhiir/followers","following_url":"https://api.github.com/users/serhiir/following{/other_user}","gists_url":"https://api.github.com/users/serhiir/gists{/gist_id}","starred_url":"https://api.github.com/users/serhiir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serhiir/subscriptions","organizations_url":"https://api.github.com/users/serhiir/orgs","repos_url":"https://api.github.com/users/serhiir/repos","events_url":"https://api.github.com/users/serhiir/events{/privacy}","received_events_url":"https://api.github.com/users/serhiir/received_events","type":"User","site_admin":false},"body":"@anatoliikryvishyn What is the purpose of disabling it here. Maybe this is mixed with binding within one method?","created_at":"2015-12-16T15:02:20Z","updated_at":"2015-12-16T15:02:20Z","html_url":"https://github.com/anatoliikryvishyn/TaDa/pull/5#discussion_r47785533","pull_request_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/comments/47785533"},"html":{"href":"https://github.com/anatoliikryvishyn/TaDa/pull/5#discussion_r47785533"},"pull_request":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5","id":53725052,"html_url":"https://github.com/anatoliikryvishyn/TaDa/pull/5","diff_url":"https://github.com/anatoliikryvishyn/TaDa/pull/5.diff","patch_url":"https://github.com/anatoliikryvishyn/TaDa/pull/5.patch","issue_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/5","number":5,"state":"open","locked":false,"title":"A user can create a new list","user":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"body":"There is a button in the top of the page, to create a new list. When button is pressed, modal form ( https://img.in6k.com/screens/screensfd6c003805b4.png ) displays. Name is required. When new list is created it shows on top of lists order. After list creation,  form for adding new items to this list opens.\r\n","created_at":"2015-12-15T16:17:21Z","updated_at":"2015-12-16T15:02:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6f7aa931300f24475ca93d181e06ce84eba5825c","assignee":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/milestones/3","html_url":"https://github.com/anatoliikryvishyn/TaDa/milestones/List%20creation%20and%20code%20tunning","labels_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/milestones/3/labels","id":1457153,"number":3,"title":"List creation and code tunning","description":"","creator":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":1,"state":"open","created_at":"2015-12-12T10:00:50Z","updated_at":"2015-12-16T09:19:53Z","due_on":"2015-12-15T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5/commits","review_comments_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5/comments","review_comment_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/5/comments","statuses_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/statuses/f7b330441eb80d21d72108084a59a2a244e8e2c3","head":{"label":"anatoliikryvishyn:5-create-new-list","ref":"5-create-new-list","sha":"f7b330441eb80d21d72108084a59a2a244e8e2c3","user":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"repo":{"id":46796979,"name":"TaDa","full_name":"anatoliikryvishyn/TaDa","owner":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anatoliikryvishyn/TaDa","description":"","fork":false,"url":"https://api.github.com/repos/anatoliikryvishyn/TaDa","forks_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/forks","keys_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/teams","hooks_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/hooks","issue_events_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/events{/number}","events_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/events","assignees_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/assignees{/user}","branches_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/branches{/branch}","tags_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/tags","blobs_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/refs{/sha}","trees_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/statuses/{sha}","languages_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/languages","stargazers_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/stargazers","contributors_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/contributors","subscribers_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/subscribers","subscription_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/subscription","commits_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/commits{/sha}","git_commits_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/commits{/sha}","comments_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/comments{/number}","issue_comment_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/comments{/number}","contents_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/contents/{+path}","compare_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/merges","archive_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/downloads","issues_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues{/number}","pulls_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls{/number}","milestones_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/milestones{/number}","notifications_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/labels{/name}","releases_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/releases{/id}","created_at":"2015-11-24T14:32:02Z","updated_at":"2015-12-07T09:01:23Z","pushed_at":"2015-12-15T16:17:21Z","git_url":"git://github.com/anatoliikryvishyn/TaDa.git","ssh_url":"git@github.com:anatoliikryvishyn/TaDa.git","clone_url":"https://github.com/anatoliikryvishyn/TaDa.git","svn_url":"https://github.com/anatoliikryvishyn/TaDa","homepage":null,"size":703,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"anatoliikryvishyn:master","ref":"master","sha":"ef4f6f506de094049c2d2dc3982f3d01ccc6ebc6","user":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"repo":{"id":46796979,"name":"TaDa","full_name":"anatoliikryvishyn/TaDa","owner":{"login":"anatoliikryvishyn","id":9845250,"avatar_url":"https://avatars.githubusercontent.com/u/9845250?v=3","gravatar_id":"","url":"https://api.github.com/users/anatoliikryvishyn","html_url":"https://github.com/anatoliikryvishyn","followers_url":"https://api.github.com/users/anatoliikryvishyn/followers","following_url":"https://api.github.com/users/anatoliikryvishyn/following{/other_user}","gists_url":"https://api.github.com/users/anatoliikryvishyn/gists{/gist_id}","starred_url":"https://api.github.com/users/anatoliikryvishyn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anatoliikryvishyn/subscriptions","organizations_url":"https://api.github.com/users/anatoliikryvishyn/orgs","repos_url":"https://api.github.com/users/anatoliikryvishyn/repos","events_url":"https://api.github.com/users/anatoliikryvishyn/events{/privacy}","received_events_url":"https://api.github.com/users/anatoliikryvishyn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anatoliikryvishyn/TaDa","description":"","fork":false,"url":"https://api.github.com/repos/anatoliikryvishyn/TaDa","forks_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/forks","keys_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/teams","hooks_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/hooks","issue_events_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/events{/number}","events_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/events","assignees_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/assignees{/user}","branches_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/branches{/branch}","tags_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/tags","blobs_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/refs{/sha}","trees_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/statuses/{sha}","languages_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/languages","stargazers_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/stargazers","contributors_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/contributors","subscribers_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/subscribers","subscription_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/subscription","commits_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/commits{/sha}","git_commits_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/git/commits{/sha}","comments_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/comments{/number}","issue_comment_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/comments{/number}","contents_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/contents/{+path}","compare_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/merges","archive_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/downloads","issues_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues{/number}","pulls_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls{/number}","milestones_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/milestones{/number}","notifications_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/labels{/name}","releases_url":"https://api.github.com/repos/anatoliikryvishyn/TaDa/releases{/id}","created_at":"2015-11-24T14:32:02Z","updated_at":"2015-12-07T09:01:23Z","pushed_at":"2015-12-15T16:17:21Z","git_url":"git://github.com/anatoliikryvishyn/TaDa.git","ssh_url":"git@github.com:anatoliikryvishyn/TaDa.git","clone_url":"https://github.com/anatoliikryvishyn/TaDa.git","svn_url":"https://github.com/anatoliikryvishyn/TaDa","homepage":null,"size":703,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5"},"html":{"href":"https://github.com/anatoliikryvishyn/TaDa/pull/5"},"issue":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/5"},"comments":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/anatoliikryvishyn/TaDa/statuses/f7b330441eb80d21d72108084a59a2a244e8e2c3"}}}}