{"action":"created","comment":{"url":"https://api.github.com/repos/yurenju/hackeditr/pulls/comments/34685396","id":34685396,"diff_hunk":"@@ -46,46 +47,61 @@ module.exports = function($http, $scope, SweetAlert) {\n \n   $scope.save = function(scope) {\n     // transfer to csv format\n-    SweetAlert.swal(\n-      {\n-        title: 'Are you sure?',\n-        text: 'Your will not be able to recover this change!',\n-        type: 'warning',\n-        showCancelButton: true,\n-        confirmButtonColor: '#AEDEF4',confirmButtonText: 'Yes',\n-        cancelButtonText: 'Cancel',\n-        closeOnConfirm: false\n-      }, function(isConfirm) {\n-        if (isConfirm) {\n-          var tagLine = scope.data[0].join(',');\n-          var titleLine = scope.data[1].join(',');\n-          var csvData = tagLine + '\\n' + titleLine + '\\n';\n-          (scope.list).forEach(function(node) {\n-            csvData += node.url + ',' + node.title + ',,\\n';\n-            if (node.items.length > 0) {\n-              node.items.forEach(function(node) {\n-                csvData += '\" ' + node.url + '\"' + ',' + node.title + ',,\\n';\n-              });\n-            }\n-          });\n+    var tagLine = scope.data[0].join(',');\n+    var titleLine = scope.data[1].join(',');\n+    var csvData = tagLine + '\\n' + titleLine + '\\n';\n+    (scope.list).forEach(function(node) {\n+      csvData += node.url + ',' + node.title + ',,\\n';\n+      if (node.items.length > 0) {\n+        node.items.forEach(function(node) {\n+          csvData += '\" ' + node.url + '\"' + ',' + node.title + ',,\\n';\n+        });\n+      }\n+    });\n \n-          var req = {\n-            method: 'PUT',\n-            url: 'https://ethercalc.org/_/hackeditr',\n-            headers: {\n-              'Content-Type': 'text/csv'\n-            },\n-            data: csvData\n-          };\n-          $http(req)\n-            .success(function(data, status) {\n-              SweetAlert.swal('Saved!', 'Your change has been saved.', 'success');\n-            })\n-            .error(function(data, status) {\n-              SweetAlert.swal('Error!', 'Your change has not been saved.', 'error');\n-            });\n+    var req = {\n+      method: 'PUT',\n+      url: 'https://ethercalc.org/_/hackeditr',\n+      headers: {\n+        'Content-Type': 'text/csv'\n+      },\n+      data: csvData\n+    };\n+    $http(req)\n+      .success(function(data, status) {\n+        $scope.$broadcast('success', 'Success!');\n+      })\n+      .error(function(data, status) {\n+        $scope.$broadcast('success', 'Error! Please try again.');\n+      });\n+  };\n \n-        }\n+  $scope.open = function (pos) {\n+    var modalInstance = $modal.open({\n+      animation: true,\n+      templateUrl: 'dialogContent.html',\n+      controller: 'DialogInstanceController'\n     });\n-  }\n+\n+    modalInstance.result.then(function (data) {\n+      // pos === -1 mean this folder is first lavel node\n+      var url = data.url ? data.url : '';\n+      var title = data.title ? data.title : 'New folder';","path":"app/main-controller.js","position":93,"original_position":93,"commit_id":"28a193450fa9a8dabbc676e11724e47a779e8863","original_commit_id":"28a193450fa9a8dabbc676e11724e47a779e8863","user":{"login":"yurenju","id":22155,"avatar_url":"https://avatars.githubusercontent.com/u/22155?v=3","gravatar_id":"","url":"https://api.github.com/users/yurenju","html_url":"https://github.com/yurenju","followers_url":"https://api.github.com/users/yurenju/followers","following_url":"https://api.github.com/users/yurenju/following{/other_user}","gists_url":"https://api.github.com/users/yurenju/gists{/gist_id}","starred_url":"https://api.github.com/users/yurenju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurenju/subscriptions","organizations_url":"https://api.github.com/users/yurenju/orgs","repos_url":"https://api.github.com/users/yurenju/repos","events_url":"https://api.github.com/users/yurenju/events{/privacy}","received_events_url":"https://api.github.com/users/yurenju/received_events","type":"User","site_admin":false},"body":"use `||` for default value\r\n\r\n```js\r\nvar url = data.url || '';\r\nvar title = data.title || 'New folder';\r\n```","created_at":"2015-07-15T14:44:38Z","updated_at":"2015-07-15T14:44:38Z","html_url":"https://github.com/yurenju/hackeditr/pull/5#discussion_r34685396","pull_request_url":"https://api.github.com/repos/yurenju/hackeditr/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/yurenju/hackeditr/pulls/comments/34685396"},"html":{"href":"https://github.com/yurenju/hackeditr/pull/5#discussion_r34685396"},"pull_request":{"href":"https://api.github.com/repos/yurenju/hackeditr/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/yurenju/hackeditr/pulls/5","id":40026487,"html_url":"https://github.com/yurenju/hackeditr/pull/5","diff_url":"https://github.com/yurenju/hackeditr/pull/5.diff","patch_url":"https://github.com/yurenju/hackeditr/pull/5.patch","issue_url":"https://api.github.com/repos/yurenju/hackeditr/issues/5","number":5,"state":"open","locked":false,"title":"add create new Item mechanism","user":{"login":"chialin","id":179470,"avatar_url":"https://avatars.githubusercontent.com/u/179470?v=3","gravatar_id":"","url":"https://api.github.com/users/chialin","html_url":"https://github.com/chialin","followers_url":"https://api.github.com/users/chialin/followers","following_url":"https://api.github.com/users/chialin/following{/other_user}","gists_url":"https://api.github.com/users/chialin/gists{/gist_id}","starred_url":"https://api.github.com/users/chialin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chialin/subscriptions","organizations_url":"https://api.github.com/users/chialin/orgs","repos_url":"https://api.github.com/users/chialin/repos","events_url":"https://api.github.com/users/chialin/events{/privacy}","received_events_url":"https://api.github.com/users/chialin/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-15T14:09:43Z","updated_at":"2015-07-15T14:44:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04f1485dac98d448c797fdb98177595e65d9a02b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yurenju/hackeditr/pulls/5/commits","review_comments_url":"https://api.github.com/repos/yurenju/hackeditr/pulls/5/comments","review_comment_url":"https://api.github.com/repos/yurenju/hackeditr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yurenju/hackeditr/issues/5/comments","statuses_url":"https://api.github.com/repos/yurenju/hackeditr/statuses/28a193450fa9a8dabbc676e11724e47a779e8863","head":{"label":"chialin:ngDialog","ref":"ngDialog","sha":"28a193450fa9a8dabbc676e11724e47a779e8863","user":{"login":"chialin","id":179470,"avatar_url":"https://avatars.githubusercontent.com/u/179470?v=3","gravatar_id":"","url":"https://api.github.com/users/chialin","html_url":"https://github.com/chialin","followers_url":"https://api.github.com/users/chialin/followers","following_url":"https://api.github.com/users/chialin/following{/other_user}","gists_url":"https://api.github.com/users/chialin/gists{/gist_id}","starred_url":"https://api.github.com/users/chialin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chialin/subscriptions","organizations_url":"https://api.github.com/users/chialin/orgs","repos_url":"https://api.github.com/users/chialin/repos","events_url":"https://api.github.com/users/chialin/events{/privacy}","received_events_url":"https://api.github.com/users/chialin/received_events","type":"User","site_admin":false},"repo":{"id":38808111,"name":"hackeditr","full_name":"chialin/hackeditr","owner":{"login":"chialin","id":179470,"avatar_url":"https://avatars.githubusercontent.com/u/179470?v=3","gravatar_id":"","url":"https://api.github.com/users/chialin","html_url":"https://github.com/chialin","followers_url":"https://api.github.com/users/chialin/followers","following_url":"https://api.github.com/users/chialin/following{/other_user}","gists_url":"https://api.github.com/users/chialin/gists{/gist_id}","starred_url":"https://api.github.com/users/chialin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chialin/subscriptions","organizations_url":"https://api.github.com/users/chialin/orgs","repos_url":"https://api.github.com/users/chialin/repos","events_url":"https://api.github.com/users/chialin/events{/privacy}","received_events_url":"https://api.github.com/users/chialin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chialin/hackeditr","description":"","fork":true,"url":"https://api.github.com/repos/chialin/hackeditr","forks_url":"https://api.github.com/repos/chialin/hackeditr/forks","keys_url":"https://api.github.com/repos/chialin/hackeditr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chialin/hackeditr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chialin/hackeditr/teams","hooks_url":"https://api.github.com/repos/chialin/hackeditr/hooks","issue_events_url":"https://api.github.com/repos/chialin/hackeditr/issues/events{/number}","events_url":"https://api.github.com/repos/chialin/hackeditr/events","assignees_url":"https://api.github.com/repos/chialin/hackeditr/assignees{/user}","branches_url":"https://api.github.com/repos/chialin/hackeditr/branches{/branch}","tags_url":"https://api.github.com/repos/chialin/hackeditr/tags","blobs_url":"https://api.github.com/repos/chialin/hackeditr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chialin/hackeditr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chialin/hackeditr/git/refs{/sha}","trees_url":"https://api.github.com/repos/chialin/hackeditr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chialin/hackeditr/statuses/{sha}","languages_url":"https://api.github.com/repos/chialin/hackeditr/languages","stargazers_url":"https://api.github.com/repos/chialin/hackeditr/stargazers","contributors_url":"https://api.github.com/repos/chialin/hackeditr/contributors","subscribers_url":"https://api.github.com/repos/chialin/hackeditr/subscribers","subscription_url":"https://api.github.com/repos/chialin/hackeditr/subscription","commits_url":"https://api.github.com/repos/chialin/hackeditr/commits{/sha}","git_commits_url":"https://api.github.com/repos/chialin/hackeditr/git/commits{/sha}","comments_url":"https://api.github.com/repos/chialin/hackeditr/comments{/number}","issue_comment_url":"https://api.github.com/repos/chialin/hackeditr/issues/comments{/number}","contents_url":"https://api.github.com/repos/chialin/hackeditr/contents/{+path}","compare_url":"https://api.github.com/repos/chialin/hackeditr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chialin/hackeditr/merges","archive_url":"https://api.github.com/repos/chialin/hackeditr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chialin/hackeditr/downloads","issues_url":"https://api.github.com/repos/chialin/hackeditr/issues{/number}","pulls_url":"https://api.github.com/repos/chialin/hackeditr/pulls{/number}","milestones_url":"https://api.github.com/repos/chialin/hackeditr/milestones{/number}","notifications_url":"https://api.github.com/repos/chialin/hackeditr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chialin/hackeditr/labels{/name}","releases_url":"https://api.github.com/repos/chialin/hackeditr/releases{/id}","created_at":"2015-07-09T08:30:24Z","updated_at":"2015-07-13T15:38:42Z","pushed_at":"2015-07-15T14:35:49Z","git_url":"git://github.com/chialin/hackeditr.git","ssh_url":"git@github.com:chialin/hackeditr.git","clone_url":"https://github.com/chialin/hackeditr.git","svn_url":"https://github.com/chialin/hackeditr","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yurenju:master","ref":"master","sha":"340cc08617759f558d953b3791d3135d01cf60bf","user":{"login":"yurenju","id":22155,"avatar_url":"https://avatars.githubusercontent.com/u/22155?v=3","gravatar_id":"","url":"https://api.github.com/users/yurenju","html_url":"https://github.com/yurenju","followers_url":"https://api.github.com/users/yurenju/followers","following_url":"https://api.github.com/users/yurenju/following{/other_user}","gists_url":"https://api.github.com/users/yurenju/gists{/gist_id}","starred_url":"https://api.github.com/users/yurenju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurenju/subscriptions","organizations_url":"https://api.github.com/users/yurenju/orgs","repos_url":"https://api.github.com/users/yurenju/repos","events_url":"https://api.github.com/users/yurenju/events{/privacy}","received_events_url":"https://api.github.com/users/yurenju/received_events","type":"User","site_admin":false},"repo":{"id":38763566,"name":"hackeditr","full_name":"yurenju/hackeditr","owner":{"login":"yurenju","id":22155,"avatar_url":"https://avatars.githubusercontent.com/u/22155?v=3","gravatar_id":"","url":"https://api.github.com/users/yurenju","html_url":"https://github.com/yurenju","followers_url":"https://api.github.com/users/yurenju/followers","following_url":"https://api.github.com/users/yurenju/following{/other_user}","gists_url":"https://api.github.com/users/yurenju/gists{/gist_id}","starred_url":"https://api.github.com/users/yurenju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurenju/subscriptions","organizations_url":"https://api.github.com/users/yurenju/orgs","repos_url":"https://api.github.com/users/yurenju/repos","events_url":"https://api.github.com/users/yurenju/events{/privacy}","received_events_url":"https://api.github.com/users/yurenju/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yurenju/hackeditr","description":"","fork":false,"url":"https://api.github.com/repos/yurenju/hackeditr","forks_url":"https://api.github.com/repos/yurenju/hackeditr/forks","keys_url":"https://api.github.com/repos/yurenju/hackeditr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yurenju/hackeditr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yurenju/hackeditr/teams","hooks_url":"https://api.github.com/repos/yurenju/hackeditr/hooks","issue_events_url":"https://api.github.com/repos/yurenju/hackeditr/issues/events{/number}","events_url":"https://api.github.com/repos/yurenju/hackeditr/events","assignees_url":"https://api.github.com/repos/yurenju/hackeditr/assignees{/user}","branches_url":"https://api.github.com/repos/yurenju/hackeditr/branches{/branch}","tags_url":"https://api.github.com/repos/yurenju/hackeditr/tags","blobs_url":"https://api.github.com/repos/yurenju/hackeditr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yurenju/hackeditr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yurenju/hackeditr/git/refs{/sha}","trees_url":"https://api.github.com/repos/yurenju/hackeditr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yurenju/hackeditr/statuses/{sha}","languages_url":"https://api.github.com/repos/yurenju/hackeditr/languages","stargazers_url":"https://api.github.com/repos/yurenju/hackeditr/stargazers","contributors_url":"https://api.github.com/repos/yurenju/hackeditr/contributors","subscribers_url":"https://api.github.com/repos/yurenju/hackeditr/subscribers","subscription_url":"https://api.github.com/repos/yurenju/hackeditr/subscription","commits_url":"https://api.github.com/repos/yurenju/hackeditr/commits{/sha}","git_commits_url":"https://api.github.com/repos/yurenju/hackeditr/git/commits{/sha}","comments_url":"https://api.github.com/repos/yurenju/hackeditr/comments{/number}","issue_comment_url":"https://api.github.com/repos/yurenju/hackeditr/issues/comments{/number}","contents_url":"https://api.github.com/repos/yurenju/hackeditr/contents/{+path}","compare_url":"https://api.github.com/repos/yurenju/hackeditr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yurenju/hackeditr/merges","archive_url":"https://api.github.com/repos/yurenju/hackeditr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yurenju/hackeditr/downloads","issues_url":"https://api.github.com/repos/yurenju/hackeditr/issues{/number}","pulls_url":"https://api.github.com/repos/yurenju/hackeditr/pulls{/number}","milestones_url":"https://api.github.com/repos/yurenju/hackeditr/milestones{/number}","notifications_url":"https://api.github.com/repos/yurenju/hackeditr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yurenju/hackeditr/labels{/name}","releases_url":"https://api.github.com/repos/yurenju/hackeditr/releases{/id}","created_at":"2015-07-08T15:42:34Z","updated_at":"2015-07-09T15:23:06Z","pushed_at":"2015-07-15T14:35:49Z","git_url":"git://github.com/yurenju/hackeditr.git","ssh_url":"git@github.com:yurenju/hackeditr.git","clone_url":"https://github.com/yurenju/hackeditr.git","svn_url":"https://github.com/yurenju/hackeditr","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yurenju/hackeditr/pulls/5"},"html":{"href":"https://github.com/yurenju/hackeditr/pull/5"},"issue":{"href":"https://api.github.com/repos/yurenju/hackeditr/issues/5"},"comments":{"href":"https://api.github.com/repos/yurenju/hackeditr/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/yurenju/hackeditr/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/yurenju/hackeditr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yurenju/hackeditr/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/yurenju/hackeditr/statuses/28a193450fa9a8dabbc676e11724e47a779e8863"}}}}