{"action":"created","comment":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/22439379","id":22439379,"diff_hunk":"@@ -10,6 +10,45 @@ def index\n     end\n   end\n \n+  def create\n+    Dashboard::Manager.add_widget_to_user(User.current, params[:widget])\n+    redirect_to root_path\n+  end\n+\n+  def destroy\n+    widget = Widget.find(params[:id])\n+    if widget.present? and widget.user == User.current\n+      User.current.widgets.destroy(widget)\n+      status = 200\n+    else\n+      status = 403\n+    end\n+    respond_to do |format|\n+      format.json {render :json => params[:id], :status => status}\n+    end\n+  end\n+\n+  def reset_default\n+    Dashboard::Manager.reset_user_to_default(User.current)\n+    redirect_to root_path\n+  end\n+\n+  def save_positions\n+    positions = params[:widgets]\n+    positions.each {|id,values|\n+      widget = User.current.widgets.where(\"id = #{id}\").first\n+      widget.hide   = values[:hide]\n+      widget.col    = values[:col]\n+      widget.row    = values[:row]","path":"app/controllers/dashboard_controller.rb","position":33,"original_position":33,"commit_id":"921d1714664b4de8140d23e9daa530a2c44cc383","original_commit_id":"921d1714664b4de8140d23e9daa530a2c44cc383","user":{"login":"ohadlevy","id":20167,"avatar_url":"https://avatars.githubusercontent.com/u/20167?v=3","gravatar_id":"","url":"https://api.github.com/users/ohadlevy","html_url":"https://github.com/ohadlevy","followers_url":"https://api.github.com/users/ohadlevy/followers","following_url":"https://api.github.com/users/ohadlevy/following{/other_user}","gists_url":"https://api.github.com/users/ohadlevy/gists{/gist_id}","starred_url":"https://api.github.com/users/ohadlevy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ohadlevy/subscriptions","organizations_url":"https://api.github.com/users/ohadlevy/orgs","repos_url":"https://api.github.com/users/ohadlevy/repos","events_url":"https://api.github.com/users/ohadlevy/events{/privacy}","received_events_url":"https://api.github.com/users/ohadlevy/received_events","type":"User","site_admin":false},"body":"I think you can do:\r\n```ruby\r\nwidget.update_attributes(values)\r\n```","created_at":"2015-01-04T13:59:28Z","updated_at":"2015-01-04T13:59:28Z","html_url":"https://github.com/theforeman/foreman/pull/2046#discussion_r22439379","pull_request_url":"https://api.github.com/repos/theforeman/foreman/pulls/2046","_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/22439379"},"html":{"href":"https://github.com/theforeman/foreman/pull/2046#discussion_r22439379"},"pull_request":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2046"}}},"pull_request":{"url":"https://api.github.com/repos/theforeman/foreman/pulls/2046","id":26795346,"html_url":"https://github.com/theforeman/foreman/pull/2046","diff_url":"https://github.com/theforeman/foreman/pull/2046.diff","patch_url":"https://github.com/theforeman/foreman/pull/2046.patch","issue_url":"https://api.github.com/repos/theforeman/foreman/issues/2046","number":2046,"state":"open","locked":false,"title":"DO NOT MERGE - Dashboard rewrite","user":{"login":"tbrisker","id":1540531,"avatar_url":"https://avatars.githubusercontent.com/u/1540531?v=3","gravatar_id":"","url":"https://api.github.com/users/tbrisker","html_url":"https://github.com/tbrisker","followers_url":"https://api.github.com/users/tbrisker/followers","following_url":"https://api.github.com/users/tbrisker/following{/other_user}","gists_url":"https://api.github.com/users/tbrisker/gists{/gist_id}","starred_url":"https://api.github.com/users/tbrisker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbrisker/subscriptions","organizations_url":"https://api.github.com/users/tbrisker/orgs","repos_url":"https://api.github.com/users/tbrisker/repos","events_url":"https://api.github.com/users/tbrisker/events{/privacy}","received_events_url":"https://api.github.com/users/tbrisker/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-04T13:51:51Z","updated_at":"2015-01-04T13:59:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd2dbf3cf1da9011c789ebcbc97a525b5493f8ba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/theforeman/foreman/pulls/2046/commits","review_comments_url":"https://api.github.com/repos/theforeman/foreman/pulls/2046/comments","review_comment_url":"https://api.github.com/repos/theforeman/foreman/pulls/comments/{number}","comments_url":"https://api.github.com/repos/theforeman/foreman/issues/2046/comments","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/921d1714664b4de8140d23e9daa530a2c44cc383","head":{"label":"tbrisker:widgets","ref":"widgets","sha":"921d1714664b4de8140d23e9daa530a2c44cc383","user":{"login":"tbrisker","id":1540531,"avatar_url":"https://avatars.githubusercontent.com/u/1540531?v=3","gravatar_id":"","url":"https://api.github.com/users/tbrisker","html_url":"https://github.com/tbrisker","followers_url":"https://api.github.com/users/tbrisker/followers","following_url":"https://api.github.com/users/tbrisker/following{/other_user}","gists_url":"https://api.github.com/users/tbrisker/gists{/gist_id}","starred_url":"https://api.github.com/users/tbrisker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbrisker/subscriptions","organizations_url":"https://api.github.com/users/tbrisker/orgs","repos_url":"https://api.github.com/users/tbrisker/repos","events_url":"https://api.github.com/users/tbrisker/events{/privacy}","received_events_url":"https://api.github.com/users/tbrisker/received_events","type":"User","site_admin":false},"repo":{"id":22373475,"name":"foreman","full_name":"tbrisker/foreman","owner":{"login":"tbrisker","id":1540531,"avatar_url":"https://avatars.githubusercontent.com/u/1540531?v=3","gravatar_id":"","url":"https://api.github.com/users/tbrisker","html_url":"https://github.com/tbrisker","followers_url":"https://api.github.com/users/tbrisker/followers","following_url":"https://api.github.com/users/tbrisker/following{/other_user}","gists_url":"https://api.github.com/users/tbrisker/gists{/gist_id}","starred_url":"https://api.github.com/users/tbrisker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbrisker/subscriptions","organizations_url":"https://api.github.com/users/tbrisker/orgs","repos_url":"https://api.github.com/users/tbrisker/repos","events_url":"https://api.github.com/users/tbrisker/events{/privacy}","received_events_url":"https://api.github.com/users/tbrisker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tbrisker/foreman","description":"an application that automates the lifecycle of servers ","fork":true,"url":"https://api.github.com/repos/tbrisker/foreman","forks_url":"https://api.github.com/repos/tbrisker/foreman/forks","keys_url":"https://api.github.com/repos/tbrisker/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tbrisker/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tbrisker/foreman/teams","hooks_url":"https://api.github.com/repos/tbrisker/foreman/hooks","issue_events_url":"https://api.github.com/repos/tbrisker/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/tbrisker/foreman/events","assignees_url":"https://api.github.com/repos/tbrisker/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/tbrisker/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/tbrisker/foreman/tags","blobs_url":"https://api.github.com/repos/tbrisker/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tbrisker/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tbrisker/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/tbrisker/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tbrisker/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/tbrisker/foreman/languages","stargazers_url":"https://api.github.com/repos/tbrisker/foreman/stargazers","contributors_url":"https://api.github.com/repos/tbrisker/foreman/contributors","subscribers_url":"https://api.github.com/repos/tbrisker/foreman/subscribers","subscription_url":"https://api.github.com/repos/tbrisker/foreman/subscription","commits_url":"https://api.github.com/repos/tbrisker/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/tbrisker/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/tbrisker/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/tbrisker/foreman/issues/comments/{number}","contents_url":"https://api.github.com/repos/tbrisker/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/tbrisker/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tbrisker/foreman/merges","archive_url":"https://api.github.com/repos/tbrisker/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tbrisker/foreman/downloads","issues_url":"https://api.github.com/repos/tbrisker/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/tbrisker/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/tbrisker/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/tbrisker/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tbrisker/foreman/labels{/name}","releases_url":"https://api.github.com/repos/tbrisker/foreman/releases{/id}","created_at":"2014-07-29T08:48:53Z","updated_at":"2015-01-04T07:45:07Z","pushed_at":"2015-01-04T13:51:34Z","git_url":"git://github.com/tbrisker/foreman.git","ssh_url":"git@github.com:tbrisker/foreman.git","clone_url":"https://github.com/tbrisker/foreman.git","svn_url":"https://github.com/tbrisker/foreman","homepage":"http://theforeman.org","size":22739,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"theforeman:develop","ref":"develop","sha":"826e18e7cf2d97b4cdaed83142e581f3ecd71e27","user":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"repo":{"id":258750,"name":"foreman","full_name":"theforeman/foreman","owner":{"login":"theforeman","id":1439844,"avatar_url":"https://avatars.githubusercontent.com/u/1439844?v=3","gravatar_id":"","url":"https://api.github.com/users/theforeman","html_url":"https://github.com/theforeman","followers_url":"https://api.github.com/users/theforeman/followers","following_url":"https://api.github.com/users/theforeman/following{/other_user}","gists_url":"https://api.github.com/users/theforeman/gists{/gist_id}","starred_url":"https://api.github.com/users/theforeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theforeman/subscriptions","organizations_url":"https://api.github.com/users/theforeman/orgs","repos_url":"https://api.github.com/users/theforeman/repos","events_url":"https://api.github.com/users/theforeman/events{/privacy}","received_events_url":"https://api.github.com/users/theforeman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/theforeman/foreman","description":"an application that automates the lifecycle of servers ","fork":false,"url":"https://api.github.com/repos/theforeman/foreman","forks_url":"https://api.github.com/repos/theforeman/foreman/forks","keys_url":"https://api.github.com/repos/theforeman/foreman/keys{/key_id}","collaborators_url":"https://api.github.com/repos/theforeman/foreman/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/theforeman/foreman/teams","hooks_url":"https://api.github.com/repos/theforeman/foreman/hooks","issue_events_url":"https://api.github.com/repos/theforeman/foreman/issues/events{/number}","events_url":"https://api.github.com/repos/theforeman/foreman/events","assignees_url":"https://api.github.com/repos/theforeman/foreman/assignees{/user}","branches_url":"https://api.github.com/repos/theforeman/foreman/branches{/branch}","tags_url":"https://api.github.com/repos/theforeman/foreman/tags","blobs_url":"https://api.github.com/repos/theforeman/foreman/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/theforeman/foreman/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/theforeman/foreman/git/refs{/sha}","trees_url":"https://api.github.com/repos/theforeman/foreman/git/trees{/sha}","statuses_url":"https://api.github.com/repos/theforeman/foreman/statuses/{sha}","languages_url":"https://api.github.com/repos/theforeman/foreman/languages","stargazers_url":"https://api.github.com/repos/theforeman/foreman/stargazers","contributors_url":"https://api.github.com/repos/theforeman/foreman/contributors","subscribers_url":"https://api.github.com/repos/theforeman/foreman/subscribers","subscription_url":"https://api.github.com/repos/theforeman/foreman/subscription","commits_url":"https://api.github.com/repos/theforeman/foreman/commits{/sha}","git_commits_url":"https://api.github.com/repos/theforeman/foreman/git/commits{/sha}","comments_url":"https://api.github.com/repos/theforeman/foreman/comments{/number}","issue_comment_url":"https://api.github.com/repos/theforeman/foreman/issues/comments/{number}","contents_url":"https://api.github.com/repos/theforeman/foreman/contents/{+path}","compare_url":"https://api.github.com/repos/theforeman/foreman/compare/{base}...{head}","merges_url":"https://api.github.com/repos/theforeman/foreman/merges","archive_url":"https://api.github.com/repos/theforeman/foreman/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/theforeman/foreman/downloads","issues_url":"https://api.github.com/repos/theforeman/foreman/issues{/number}","pulls_url":"https://api.github.com/repos/theforeman/foreman/pulls{/number}","milestones_url":"https://api.github.com/repos/theforeman/foreman/milestones{/number}","notifications_url":"https://api.github.com/repos/theforeman/foreman/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/theforeman/foreman/labels{/name}","releases_url":"https://api.github.com/repos/theforeman/foreman/releases{/id}","created_at":"2009-07-23T15:07:00Z","updated_at":"2015-01-03T03:28:47Z","pushed_at":"2015-01-02T09:09:12Z","git_url":"git://github.com/theforeman/foreman.git","ssh_url":"git@github.com:theforeman/foreman.git","clone_url":"https://github.com/theforeman/foreman.git","svn_url":"https://github.com/theforeman/foreman","homepage":"http://theforeman.org","size":63209,"stargazers_count":635,"watchers_count":635,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":353,"mirror_url":null,"open_issues_count":62,"forks":353,"open_issues":62,"watchers":635,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2046"},"html":{"href":"https://github.com/theforeman/foreman/pull/2046"},"issue":{"href":"https://api.github.com/repos/theforeman/foreman/issues/2046"},"comments":{"href":"https://api.github.com/repos/theforeman/foreman/issues/2046/comments"},"review_comments":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2046/comments"},"review_comment":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/theforeman/foreman/pulls/2046/commits"},"statuses":{"href":"https://api.github.com/repos/theforeman/foreman/statuses/921d1714664b4de8140d23e9daa530a2c44cc383"}}}}