{"action":"created","comment":{"url":"https://api.github.com/repos/archangel/archangel/pulls/comments/103094854","pull_request_review_id":23872940,"id":103094854,"diff_hunk":"@@ -0,0 +1,119 @@\n+# frozen_string_literal: true\n+\n+module Archangel\n+  # Navigation Item Service\n+  #\n+  # @author dfreerksen\n+  # @since 0.0.1\n+  #\n+  class NavigationItemService\n+    attr_accessor :item, :items, :primary\n+\n+    attr_reader :children, :key, :label, :link, :highlights_on, :html,\n+                :link_html\n+\n+    def initialize(item, items, primary)\n+      self.item = item\n+      self.items = items\n+      self.primary = primary\n+    end\n+\n+    def key\n+      @key ||= item.label.underscore\n+    end\n+\n+    def label\n+      @label ||= item.label\n+    end\n+\n+    def link\n+      @link ||= build_link\n+    end\n+\n+    def highlights_on\n+      @highlights_on ||= build_highlights_on\n+    end\n+\n+    def html\n+      @html ||= build_html\n+    end\n+\n+    def link_html\n+      @link_html ||= build_link_html\n+    end\n+\n+    def children\n+      @children ||= build_children\n+    end\n+\n+    def to_proc\n+      options = {\n+        highlights_on: highlights_on,\n+        html: html,\n+        link_html: link_html\n+      }\n+\n+      if children.any?\n+        primary.item(key, label, link, options) do |secondary|\n+          children.each do |child|\n+            NavigationItemService.new(child, items, secondary).to_proc\n+          end\n+        end\n+      else\n+        primary.item(key, label, link, options)\n+      end\n+    end\n+\n+    protected\n+\n+    def build_link\n+      return item.url unless item.url.blank?\n+\n+      return nil if item.menuable.nil?\n+\n+      check_homepage? ? \"/\" : \"/#{item.menuable.path}\"\n+    end\n+\n+    def build_highlights_on\n+      return false if item.url =~ URI.regexp\n+\n+      return %r{/#{item.highlights_on}} unless item.highlights_on.blank?\n+\n+      build_menuable_highlights_on\n+    end\n+\n+    def build_menuable_highlights_on\n+      menuable_object = item.menuable\n+\n+      return nil if menuable_object.nil?\n+\n+      return %r{/$} if check_homepage?\n+\n+      %r{/#{menuable_object.path}}\n+    end\n+\n+    def build_html\n+      attributes = { id: item.attr_id, class: item.attr_class }.compact\n+\n+      attributes[:class] = [","path":"app/services/archangel/navigation_item_service.rb","position":98,"original_position":98,"commit_id":"88cc6f3628ef8e7c5aed7c86bc3d255d51963e45","original_commit_id":"88cc6f3628ef8e7c5aed7c86bc3d255d51963e45","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Favor a normal if-statement over a modifier clause in a multiline statement.","created_at":"2017-02-26T04:01:25Z","updated_at":"2017-02-26T04:01:25Z","html_url":"https://github.com/archangel/archangel/pull/16#discussion_r103094854","pull_request_url":"https://api.github.com/repos/archangel/archangel/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/archangel/archangel/pulls/comments/103094854"},"html":{"href":"https://github.com/archangel/archangel/pull/16#discussion_r103094854"},"pull_request":{"href":"https://api.github.com/repos/archangel/archangel/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/archangel/archangel/pulls/16","id":104727539,"html_url":"https://github.com/archangel/archangel/pull/16","diff_url":"https://github.com/archangel/archangel/pull/16.diff","patch_url":"https://github.com/archangel/archangel/pull/16.patch","issue_url":"https://api.github.com/repos/archangel/archangel/issues/16","number":16,"state":"open","locked":false,"title":"[WIP] Navigation","user":{"login":"dfreerksen","id":220746,"avatar_url":"https://avatars.githubusercontent.com/u/220746?v=3","gravatar_id":"","url":"https://api.github.com/users/dfreerksen","html_url":"https://github.com/dfreerksen","followers_url":"https://api.github.com/users/dfreerksen/followers","following_url":"https://api.github.com/users/dfreerksen/following{/other_user}","gists_url":"https://api.github.com/users/dfreerksen/gists{/gist_id}","starred_url":"https://api.github.com/users/dfreerksen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfreerksen/subscriptions","organizations_url":"https://api.github.com/users/dfreerksen/orgs","repos_url":"https://api.github.com/users/dfreerksen/repos","events_url":"https://api.github.com/users/dfreerksen/events{/privacy}","received_events_url":"https://api.github.com/users/dfreerksen/received_events","type":"User","site_admin":false},"body":"# Summary\r\n\r\nMenu management for Archangel using `simple-navigation`\r\n\r\n## What's new\r\n\r\n- Added [`simple-navigation`](https://github.com/codeplant/simple-navigation)\r\n- Added [`cocoon`](https://github.com/nathanvda/cocoon) for management of nested attributes\r\n- Menu CRUD in Admin\r\n- Default menu items for sections (Admin, Auth, Frontend)","created_at":"2017-02-06T02:26:51Z","updated_at":"2017-02-26T04:01:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b3446caf98b52179be35c3b77972a1bb2edf771","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/archangel/archangel/pulls/16/commits","review_comments_url":"https://api.github.com/repos/archangel/archangel/pulls/16/comments","review_comment_url":"https://api.github.com/repos/archangel/archangel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/archangel/archangel/issues/16/comments","statuses_url":"https://api.github.com/repos/archangel/archangel/statuses/88cc6f3628ef8e7c5aed7c86bc3d255d51963e45","head":{"label":"archangel:feature/navigation","ref":"feature/navigation","sha":"88cc6f3628ef8e7c5aed7c86bc3d255d51963e45","user":{"login":"archangel","id":17705830,"avatar_url":"https://avatars.githubusercontent.com/u/17705830?v=3","gravatar_id":"","url":"https://api.github.com/users/archangel","html_url":"https://github.com/archangel","followers_url":"https://api.github.com/users/archangel/followers","following_url":"https://api.github.com/users/archangel/following{/other_user}","gists_url":"https://api.github.com/users/archangel/gists{/gist_id}","starred_url":"https://api.github.com/users/archangel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/archangel/subscriptions","organizations_url":"https://api.github.com/users/archangel/orgs","repos_url":"https://api.github.com/users/archangel/repos","events_url":"https://api.github.com/users/archangel/events{/privacy}","received_events_url":"https://api.github.com/users/archangel/received_events","type":"Organization","site_admin":false},"repo":{"id":53335824,"name":"archangel","full_name":"archangel/archangel","owner":{"login":"archangel","id":17705830,"avatar_url":"https://avatars.githubusercontent.com/u/17705830?v=3","gravatar_id":"","url":"https://api.github.com/users/archangel","html_url":"https://github.com/archangel","followers_url":"https://api.github.com/users/archangel/followers","following_url":"https://api.github.com/users/archangel/following{/other_user}","gists_url":"https://api.github.com/users/archangel/gists{/gist_id}","starred_url":"https://api.github.com/users/archangel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/archangel/subscriptions","organizations_url":"https://api.github.com/users/archangel/orgs","repos_url":"https://api.github.com/users/archangel/repos","events_url":"https://api.github.com/users/archangel/events{/privacy}","received_events_url":"https://api.github.com/users/archangel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/archangel/archangel","description":null,"fork":false,"url":"https://api.github.com/repos/archangel/archangel","forks_url":"https://api.github.com/repos/archangel/archangel/forks","keys_url":"https://api.github.com/repos/archangel/archangel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/archangel/archangel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/archangel/archangel/teams","hooks_url":"https://api.github.com/repos/archangel/archangel/hooks","issue_events_url":"https://api.github.com/repos/archangel/archangel/issues/events{/number}","events_url":"https://api.github.com/repos/archangel/archangel/events","assignees_url":"https://api.github.com/repos/archangel/archangel/assignees{/user}","branches_url":"https://api.github.com/repos/archangel/archangel/branches{/branch}","tags_url":"https://api.github.com/repos/archangel/archangel/tags","blobs_url":"https://api.github.com/repos/archangel/archangel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/archangel/archangel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/archangel/archangel/git/refs{/sha}","trees_url":"https://api.github.com/repos/archangel/archangel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/archangel/archangel/statuses/{sha}","languages_url":"https://api.github.com/repos/archangel/archangel/languages","stargazers_url":"https://api.github.com/repos/archangel/archangel/stargazers","contributors_url":"https://api.github.com/repos/archangel/archangel/contributors","subscribers_url":"https://api.github.com/repos/archangel/archangel/subscribers","subscription_url":"https://api.github.com/repos/archangel/archangel/subscription","commits_url":"https://api.github.com/repos/archangel/archangel/commits{/sha}","git_commits_url":"https://api.github.com/repos/archangel/archangel/git/commits{/sha}","comments_url":"https://api.github.com/repos/archangel/archangel/comments{/number}","issue_comment_url":"https://api.github.com/repos/archangel/archangel/issues/comments{/number}","contents_url":"https://api.github.com/repos/archangel/archangel/contents/{+path}","compare_url":"https://api.github.com/repos/archangel/archangel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/archangel/archangel/merges","archive_url":"https://api.github.com/repos/archangel/archangel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/archangel/archangel/downloads","issues_url":"https://api.github.com/repos/archangel/archangel/issues{/number}","pulls_url":"https://api.github.com/repos/archangel/archangel/pulls{/number}","milestones_url":"https://api.github.com/repos/archangel/archangel/milestones{/number}","notifications_url":"https://api.github.com/repos/archangel/archangel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/archangel/archangel/labels{/name}","releases_url":"https://api.github.com/repos/archangel/archangel/releases{/id}","deployments_url":"https://api.github.com/repos/archangel/archangel/deployments","created_at":"2016-03-07T15:25:16Z","updated_at":"2016-03-08T15:16:11Z","pushed_at":"2017-02-26T04:01:02Z","git_url":"git://github.com/archangel/archangel.git","ssh_url":"git@github.com:archangel/archangel.git","clone_url":"https://github.com/archangel/archangel.git","svn_url":"https://github.com/archangel/archangel","homepage":null,"size":2119,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"archangel:master","ref":"master","sha":"22aa4a73c6905f34e6840d6dee5aa38b201650b9","user":{"login":"archangel","id":17705830,"avatar_url":"https://avatars.githubusercontent.com/u/17705830?v=3","gravatar_id":"","url":"https://api.github.com/users/archangel","html_url":"https://github.com/archangel","followers_url":"https://api.github.com/users/archangel/followers","following_url":"https://api.github.com/users/archangel/following{/other_user}","gists_url":"https://api.github.com/users/archangel/gists{/gist_id}","starred_url":"https://api.github.com/users/archangel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/archangel/subscriptions","organizations_url":"https://api.github.com/users/archangel/orgs","repos_url":"https://api.github.com/users/archangel/repos","events_url":"https://api.github.com/users/archangel/events{/privacy}","received_events_url":"https://api.github.com/users/archangel/received_events","type":"Organization","site_admin":false},"repo":{"id":53335824,"name":"archangel","full_name":"archangel/archangel","owner":{"login":"archangel","id":17705830,"avatar_url":"https://avatars.githubusercontent.com/u/17705830?v=3","gravatar_id":"","url":"https://api.github.com/users/archangel","html_url":"https://github.com/archangel","followers_url":"https://api.github.com/users/archangel/followers","following_url":"https://api.github.com/users/archangel/following{/other_user}","gists_url":"https://api.github.com/users/archangel/gists{/gist_id}","starred_url":"https://api.github.com/users/archangel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/archangel/subscriptions","organizations_url":"https://api.github.com/users/archangel/orgs","repos_url":"https://api.github.com/users/archangel/repos","events_url":"https://api.github.com/users/archangel/events{/privacy}","received_events_url":"https://api.github.com/users/archangel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/archangel/archangel","description":null,"fork":false,"url":"https://api.github.com/repos/archangel/archangel","forks_url":"https://api.github.com/repos/archangel/archangel/forks","keys_url":"https://api.github.com/repos/archangel/archangel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/archangel/archangel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/archangel/archangel/teams","hooks_url":"https://api.github.com/repos/archangel/archangel/hooks","issue_events_url":"https://api.github.com/repos/archangel/archangel/issues/events{/number}","events_url":"https://api.github.com/repos/archangel/archangel/events","assignees_url":"https://api.github.com/repos/archangel/archangel/assignees{/user}","branches_url":"https://api.github.com/repos/archangel/archangel/branches{/branch}","tags_url":"https://api.github.com/repos/archangel/archangel/tags","blobs_url":"https://api.github.com/repos/archangel/archangel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/archangel/archangel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/archangel/archangel/git/refs{/sha}","trees_url":"https://api.github.com/repos/archangel/archangel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/archangel/archangel/statuses/{sha}","languages_url":"https://api.github.com/repos/archangel/archangel/languages","stargazers_url":"https://api.github.com/repos/archangel/archangel/stargazers","contributors_url":"https://api.github.com/repos/archangel/archangel/contributors","subscribers_url":"https://api.github.com/repos/archangel/archangel/subscribers","subscription_url":"https://api.github.com/repos/archangel/archangel/subscription","commits_url":"https://api.github.com/repos/archangel/archangel/commits{/sha}","git_commits_url":"https://api.github.com/repos/archangel/archangel/git/commits{/sha}","comments_url":"https://api.github.com/repos/archangel/archangel/comments{/number}","issue_comment_url":"https://api.github.com/repos/archangel/archangel/issues/comments{/number}","contents_url":"https://api.github.com/repos/archangel/archangel/contents/{+path}","compare_url":"https://api.github.com/repos/archangel/archangel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/archangel/archangel/merges","archive_url":"https://api.github.com/repos/archangel/archangel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/archangel/archangel/downloads","issues_url":"https://api.github.com/repos/archangel/archangel/issues{/number}","pulls_url":"https://api.github.com/repos/archangel/archangel/pulls{/number}","milestones_url":"https://api.github.com/repos/archangel/archangel/milestones{/number}","notifications_url":"https://api.github.com/repos/archangel/archangel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/archangel/archangel/labels{/name}","releases_url":"https://api.github.com/repos/archangel/archangel/releases{/id}","deployments_url":"https://api.github.com/repos/archangel/archangel/deployments","created_at":"2016-03-07T15:25:16Z","updated_at":"2016-03-08T15:16:11Z","pushed_at":"2017-02-26T04:01:02Z","git_url":"git://github.com/archangel/archangel.git","ssh_url":"git@github.com:archangel/archangel.git","clone_url":"https://github.com/archangel/archangel.git","svn_url":"https://github.com/archangel/archangel","homepage":null,"size":2119,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/archangel/archangel/pulls/16"},"html":{"href":"https://github.com/archangel/archangel/pull/16"},"issue":{"href":"https://api.github.com/repos/archangel/archangel/issues/16"},"comments":{"href":"https://api.github.com/repos/archangel/archangel/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/archangel/archangel/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/archangel/archangel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/archangel/archangel/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/archangel/archangel/statuses/88cc6f3628ef8e7c5aed7c86bc3d255d51963e45"}}}}
{"actor":{"display_login":"houndci-bot"}}