{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/brs_38/pulls/comments/84814533","pull_request_review_id":5567955,"id":84814533,"diff_hunk":"@@ -0,0 +1,73 @@\n+class Admin::BooksController < ApplicationController\n+  before_action :logged_as_admin\n+  before_action :find_book, except: [:index, :create, :new]\n+  before_action :map_categories, only: [:edit, :new]\n+\n+  def index\n+    @books = Book.publish_date_order_desc.paginate page: params[:page],\n+      per_page: Settings.per_page\n+    if @books.blank?\n+      render :new\n+      flash[:danger] = t \"admin.book.all_book_flash\"\n+    end\n+  end\n+\n+  def new\n+    @book = Book.new\n+  end\n+\n+  def create\n+    @book = Book.new book_params\n+    @book.category_id = params[:category_id]\n+    if @book.save\n+      redirect_to admin_book_path(@book)\n+      flash[:success] = t \"book_controller.create_success\"\n+    else\n+      map_categories\n+      render :new\n+    end\n+  end\n+\n+  def show\n+  end\n+\n+  def edit\n+  end\n+\n+  def update\n+    if @book.update_attributes book_params\n+      flash[:success] = t \"book_controller.update_success\"\n+      redirect_to admin_book_path @book\n+    else\n+      map_categories\n+      render :edit\n+    end\n+  end\n+\n+  def destroy\n+    if @book.destroy\n+      flash[:success] = t \"book_controller.destroy_success\"\n+    else\n+      flash[:danger] = t \"book_controller.destroy_fail\"\n+    end\n+    redirect_to admin_books_path\n+  end\n+\n+  private\n+  def book_params\n+    params.require(:book).permit :title, :author,\n+      :publish_date, :number_of_page, :description, :cover\n+  end\n+\n+  def find_book\n+    @book = Book.find_by id: params[:id]\n+    if @book.nil?\n+      redirect_to admin_books_path\n+      flash[:danger] = t \"book_controller.book_blank\"\n+    end\n+  end\n+\n+  def map_categories","path":"app/controllers/admin/books_controller.rb","position":70,"original_position":70,"commit_id":"9dd1455d52fcb86c21f1bede32139de674184efb","original_commit_id":"9dd1455d52fcb86c21f1bede32139de674184efb","user":{"login":"hellovietnam93","id":8023606,"avatar_url":"https://avatars.githubusercontent.com/u/8023606?v=3","gravatar_id":"","url":"https://api.github.com/users/hellovietnam93","html_url":"https://github.com/hellovietnam93","followers_url":"https://api.github.com/users/hellovietnam93/followers","following_url":"https://api.github.com/users/hellovietnam93/following{/other_user}","gists_url":"https://api.github.com/users/hellovietnam93/gists{/gist_id}","starred_url":"https://api.github.com/users/hellovietnam93/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellovietnam93/subscriptions","organizations_url":"https://api.github.com/users/hellovietnam93/orgs","repos_url":"https://api.github.com/users/hellovietnam93/repos","events_url":"https://api.github.com/users/hellovietnam93/events{/privacy}","received_events_url":"https://api.github.com/users/hellovietnam93/received_events","type":"User","site_admin":false},"body":"load_categories","created_at":"2016-10-25T01:02:03Z","updated_at":"2016-10-25T01:04:44Z","html_url":"https://github.com/framgia/brs_38/pull/11#discussion_r84814533","pull_request_url":"https://api.github.com/repos/framgia/brs_38/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/framgia/brs_38/pulls/comments/84814533"},"html":{"href":"https://github.com/framgia/brs_38/pull/11#discussion_r84814533"},"pull_request":{"href":"https://api.github.com/repos/framgia/brs_38/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/brs_38/pulls/11","id":90558009,"html_url":"https://github.com/framgia/brs_38/pull/11","diff_url":"https://github.com/framgia/brs_38/pull/11.diff","patch_url":"https://github.com/framgia/brs_38/pull/11.patch","issue_url":"https://api.github.com/repos/framgia/brs_38/issues/11","number":11,"state":"open","locked":false,"title":"admin manager book","user":{"login":"duchv2307","id":22351604,"avatar_url":"https://avatars.githubusercontent.com/u/22351604?v=3","gravatar_id":"","url":"https://api.github.com/users/duchv2307","html_url":"https://github.com/duchv2307","followers_url":"https://api.github.com/users/duchv2307/followers","following_url":"https://api.github.com/users/duchv2307/following{/other_user}","gists_url":"https://api.github.com/users/duchv2307/gists{/gist_id}","starred_url":"https://api.github.com/users/duchv2307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duchv2307/subscriptions","organizations_url":"https://api.github.com/users/duchv2307/orgs","repos_url":"https://api.github.com/users/duchv2307/repos","events_url":"https://api.github.com/users/duchv2307/events{/privacy}","received_events_url":"https://api.github.com/users/duchv2307/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-24T06:57:14Z","updated_at":"2016-10-25T01:04:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"448bb69fbc7ce6a795383c9a4e37a048bb99f41f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/brs_38/pulls/11/commits","review_comments_url":"https://api.github.com/repos/framgia/brs_38/pulls/11/comments","review_comment_url":"https://api.github.com/repos/framgia/brs_38/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/brs_38/issues/11/comments","statuses_url":"https://api.github.com/repos/framgia/brs_38/statuses/9dd1455d52fcb86c21f1bede32139de674184efb","head":{"label":"duchv2307:admin-book","ref":"admin-book","sha":"9dd1455d52fcb86c21f1bede32139de674184efb","user":{"login":"duchv2307","id":22351604,"avatar_url":"https://avatars.githubusercontent.com/u/22351604?v=3","gravatar_id":"","url":"https://api.github.com/users/duchv2307","html_url":"https://github.com/duchv2307","followers_url":"https://api.github.com/users/duchv2307/followers","following_url":"https://api.github.com/users/duchv2307/following{/other_user}","gists_url":"https://api.github.com/users/duchv2307/gists{/gist_id}","starred_url":"https://api.github.com/users/duchv2307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duchv2307/subscriptions","organizations_url":"https://api.github.com/users/duchv2307/orgs","repos_url":"https://api.github.com/users/duchv2307/repos","events_url":"https://api.github.com/users/duchv2307/events{/privacy}","received_events_url":"https://api.github.com/users/duchv2307/received_events","type":"User","site_admin":false},"repo":{"id":71115972,"name":"brs_38","full_name":"duchv2307/brs_38","owner":{"login":"duchv2307","id":22351604,"avatar_url":"https://avatars.githubusercontent.com/u/22351604?v=3","gravatar_id":"","url":"https://api.github.com/users/duchv2307","html_url":"https://github.com/duchv2307","followers_url":"https://api.github.com/users/duchv2307/followers","following_url":"https://api.github.com/users/duchv2307/following{/other_user}","gists_url":"https://api.github.com/users/duchv2307/gists{/gist_id}","starred_url":"https://api.github.com/users/duchv2307/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duchv2307/subscriptions","organizations_url":"https://api.github.com/users/duchv2307/orgs","repos_url":"https://api.github.com/users/duchv2307/repos","events_url":"https://api.github.com/users/duchv2307/events{/privacy}","received_events_url":"https://api.github.com/users/duchv2307/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/duchv2307/brs_38","description":"Framgia Book Reviewing System (training)","fork":true,"url":"https://api.github.com/repos/duchv2307/brs_38","forks_url":"https://api.github.com/repos/duchv2307/brs_38/forks","keys_url":"https://api.github.com/repos/duchv2307/brs_38/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duchv2307/brs_38/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duchv2307/brs_38/teams","hooks_url":"https://api.github.com/repos/duchv2307/brs_38/hooks","issue_events_url":"https://api.github.com/repos/duchv2307/brs_38/issues/events{/number}","events_url":"https://api.github.com/repos/duchv2307/brs_38/events","assignees_url":"https://api.github.com/repos/duchv2307/brs_38/assignees{/user}","branches_url":"https://api.github.com/repos/duchv2307/brs_38/branches{/branch}","tags_url":"https://api.github.com/repos/duchv2307/brs_38/tags","blobs_url":"https://api.github.com/repos/duchv2307/brs_38/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duchv2307/brs_38/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duchv2307/brs_38/git/refs{/sha}","trees_url":"https://api.github.com/repos/duchv2307/brs_38/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duchv2307/brs_38/statuses/{sha}","languages_url":"https://api.github.com/repos/duchv2307/brs_38/languages","stargazers_url":"https://api.github.com/repos/duchv2307/brs_38/stargazers","contributors_url":"https://api.github.com/repos/duchv2307/brs_38/contributors","subscribers_url":"https://api.github.com/repos/duchv2307/brs_38/subscribers","subscription_url":"https://api.github.com/repos/duchv2307/brs_38/subscription","commits_url":"https://api.github.com/repos/duchv2307/brs_38/commits{/sha}","git_commits_url":"https://api.github.com/repos/duchv2307/brs_38/git/commits{/sha}","comments_url":"https://api.github.com/repos/duchv2307/brs_38/comments{/number}","issue_comment_url":"https://api.github.com/repos/duchv2307/brs_38/issues/comments{/number}","contents_url":"https://api.github.com/repos/duchv2307/brs_38/contents/{+path}","compare_url":"https://api.github.com/repos/duchv2307/brs_38/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duchv2307/brs_38/merges","archive_url":"https://api.github.com/repos/duchv2307/brs_38/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duchv2307/brs_38/downloads","issues_url":"https://api.github.com/repos/duchv2307/brs_38/issues{/number}","pulls_url":"https://api.github.com/repos/duchv2307/brs_38/pulls{/number}","milestones_url":"https://api.github.com/repos/duchv2307/brs_38/milestones{/number}","notifications_url":"https://api.github.com/repos/duchv2307/brs_38/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duchv2307/brs_38/labels{/name}","releases_url":"https://api.github.com/repos/duchv2307/brs_38/releases{/id}","deployments_url":"https://api.github.com/repos/duchv2307/brs_38/deployments","created_at":"2016-10-17T08:26:00Z","updated_at":"2016-10-23T07:31:20Z","pushed_at":"2016-10-24T13:17:37Z","git_url":"git://github.com/duchv2307/brs_38.git","ssh_url":"git@github.com:duchv2307/brs_38.git","clone_url":"https://github.com/duchv2307/brs_38.git","svn_url":"https://github.com/duchv2307/brs_38","homepage":null,"size":1145,"stargazers_count":1,"watchers_count":1,"language":null,"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":1,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"388971503dea489f467098f65ad4514cbc3aa952","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":70868869,"name":"brs_38","full_name":"framgia/brs_38","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/brs_38","description":"Framgia Book Reviewing System (training)","fork":false,"url":"https://api.github.com/repos/framgia/brs_38","forks_url":"https://api.github.com/repos/framgia/brs_38/forks","keys_url":"https://api.github.com/repos/framgia/brs_38/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/brs_38/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/brs_38/teams","hooks_url":"https://api.github.com/repos/framgia/brs_38/hooks","issue_events_url":"https://api.github.com/repos/framgia/brs_38/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/brs_38/events","assignees_url":"https://api.github.com/repos/framgia/brs_38/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/brs_38/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/brs_38/tags","blobs_url":"https://api.github.com/repos/framgia/brs_38/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/brs_38/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/brs_38/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/brs_38/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/brs_38/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/brs_38/languages","stargazers_url":"https://api.github.com/repos/framgia/brs_38/stargazers","contributors_url":"https://api.github.com/repos/framgia/brs_38/contributors","subscribers_url":"https://api.github.com/repos/framgia/brs_38/subscribers","subscription_url":"https://api.github.com/repos/framgia/brs_38/subscription","commits_url":"https://api.github.com/repos/framgia/brs_38/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/brs_38/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/brs_38/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/brs_38/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/brs_38/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/brs_38/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/brs_38/merges","archive_url":"https://api.github.com/repos/framgia/brs_38/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/brs_38/downloads","issues_url":"https://api.github.com/repos/framgia/brs_38/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/brs_38/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/brs_38/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/brs_38/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/brs_38/labels{/name}","releases_url":"https://api.github.com/repos/framgia/brs_38/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/brs_38/deployments","created_at":"2016-10-14T03:02:05Z","updated_at":"2016-10-14T03:02:05Z","pushed_at":"2016-10-24T14:34:52Z","git_url":"git://github.com/framgia/brs_38.git","ssh_url":"git@github.com:framgia/brs_38.git","clone_url":"https://github.com/framgia/brs_38.git","svn_url":"https://github.com/framgia/brs_38","homepage":null,"size":1137,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/brs_38/pulls/11"},"html":{"href":"https://github.com/framgia/brs_38/pull/11"},"issue":{"href":"https://api.github.com/repos/framgia/brs_38/issues/11"},"comments":{"href":"https://api.github.com/repos/framgia/brs_38/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/brs_38/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/brs_38/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/brs_38/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/brs_38/statuses/9dd1455d52fcb86c21f1bede32139de674184efb"}}}}
{"actor":{"display_login":"hellovietnam93"}}