{"action":"created","issue":{"url":"https://api.github.com/repos/projectblacklight/spotlight/issues/1804","repository_url":"https://api.github.com/repos/projectblacklight/spotlight","labels_url":"https://api.github.com/repos/projectblacklight/spotlight/issues/1804/labels{/name}","comments_url":"https://api.github.com/repos/projectblacklight/spotlight/issues/1804/comments","events_url":"https://api.github.com/repos/projectblacklight/spotlight/issues/1804/events","html_url":"https://github.com/projectblacklight/spotlight/issues/1804","id":239524333,"number":1804,"title":"How to add new Sir Trevor block to widget menu","user":{"login":"travisLilleberg","id":8809048,"avatar_url":"https://avatars2.githubusercontent.com/u/8809048?v=4","gravatar_id":"","url":"https://api.github.com/users/travisLilleberg","html_url":"https://github.com/travisLilleberg","followers_url":"https://api.github.com/users/travisLilleberg/followers","following_url":"https://api.github.com/users/travisLilleberg/following{/other_user}","gists_url":"https://api.github.com/users/travisLilleberg/gists{/gist_id}","starred_url":"https://api.github.com/users/travisLilleberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travisLilleberg/subscriptions","organizations_url":"https://api.github.com/users/travisLilleberg/orgs","repos_url":"https://api.github.com/users/travisLilleberg/repos","events_url":"https://api.github.com/users/travisLilleberg/events{/privacy}","received_events_url":"https://api.github.com/users/travisLilleberg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-06-29T15:45:41Z","updated_at":"2017-08-28T21:25:04Z","closed_at":"2017-08-28T21:16:26Z","body":"Hello,\r\n\r\nI'm trying to add a \"Subheading\" block to the Sir Trevor widget options, which is the same as heading, except that it uses h3s instead of h2s. I'm following the instructions on [the wiki](https://github.com/projectblacklight/spotlight/wiki/Page-widgets).\r\n\r\nI can see it's being loaded into the SirTrevor.Blocks, it's just not showing up in the widget icons when someone makes a new block.\r\n![blocks](https://user-images.githubusercontent.com/8809048/27696082-b7b8fd38-5cbe-11e7-96a7-da77519870fa.png)\r\n\r\nI've chased the issue down to line 21 in javascripts/spotlight/sir_trevor/block_controls.js\r\n\r\n```javascript\r\n function generateBlocksHTML(Blocks, availableTypes) {\r\n    var groups = {};\r\n    for(var i in availableTypes) {\r\n      //. . . . etc\r\n```\r\nIt seems my 'Subheading' block is not in the availableTypes array, so it's not being loaded. \r\n\r\nSo my question is, how can I get it into availableTypes? Have I set up my view/model/js wrong? I'll attach my files at the bottom.\r\n\r\nThanks for any help,\r\n\r\n-- Travis\r\n\r\n\r\n\r\n**app/assets/javascripts/spotlight/blocks/subheading_block.js**\r\n```js\r\nSirTrevor.Blocks.Subheading = (function() {\r\n\r\n  return SirTrevor.Block.extend({\r\n    type: \"subheading\",\r\n\r\n    title: function() { return \"hi!\" },\r\n\r\n    icon_name: \"tweet\", //Just for testing, will make an icon later\r\n\r\n    formable: true,\r\n\r\n    editorHTML: function() {\r\n      return _.template(this.template, this)(this);\r\n    },\r\n\r\n    template: '<input type=\"text\" name=\"title\" />'\r\n\r\n  });\r\n})();\r\n```\r\n\r\n**app/views/spotlight/sir_trevor/blocks/_subheading_block.html.erb**\r\n```ruby\r\n<h3><%= subheading_block.title %></h3>\r\n```\r\n\r\n**app/models/sir_trevor_rails/blocks/subheading_block.rb**\r\n```ruby\r\nmodule SirTrevorRails\r\n  module Blocks\r\n    ##\r\n    # Display a subheading\r\n    class SubheadingBlock < SirTrevorRails::Block\r\n      include Displayable\r\n      include Textable\r\n\r\n    end\r\n  end\r\nend\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/projectblacklight/spotlight/issues/comments/325486745","html_url":"https://github.com/projectblacklight/spotlight/issues/1804#issuecomment-325486745","issue_url":"https://api.github.com/repos/projectblacklight/spotlight/issues/1804","id":325486745,"user":{"login":"mejackreed","id":1656824,"avatar_url":"https://avatars0.githubusercontent.com/u/1656824?v=4","gravatar_id":"","url":"https://api.github.com/users/mejackreed","html_url":"https://github.com/mejackreed","followers_url":"https://api.github.com/users/mejackreed/followers","following_url":"https://api.github.com/users/mejackreed/following{/other_user}","gists_url":"https://api.github.com/users/mejackreed/gists{/gist_id}","starred_url":"https://api.github.com/users/mejackreed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mejackreed/subscriptions","organizations_url":"https://api.github.com/users/mejackreed/orgs","repos_url":"https://api.github.com/users/mejackreed/repos","events_url":"https://api.github.com/users/mejackreed/events{/privacy}","received_events_url":"https://api.github.com/users/mejackreed/received_events","type":"User","site_admin":false},"created_at":"2017-08-28T21:25:04Z","updated_at":"2017-08-28T21:25:04Z","body":"@travisLilleberg Its :shipit: now. Please take it for a spin to see if it works ok for you. Enhancements are welcome."}}
{"actor":{"display_login":"mejackreed"}}