{"action":"created","issue":{"url":"https://api.github.com/repos/shakacode/react_on_rails/issues/31","labels_url":"https://api.github.com/repos/shakacode/react_on_rails/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/shakacode/react_on_rails/issues/31/comments","events_url":"https://api.github.com/repos/shakacode/react_on_rails/issues/31/events","html_url":"https://github.com/shakacode/react_on_rails/issues/31","id":107409297,"number":31,"title":"Options to the top level content tag, such as \"class\", support passing props as string","user":{"login":"justin808","id":1118459,"avatar_url":"https://avatars.githubusercontent.com/u/1118459?v=3","gravatar_id":"","url":"https://api.github.com/users/justin808","html_url":"https://github.com/justin808","followers_url":"https://api.github.com/users/justin808/followers","following_url":"https://api.github.com/users/justin808/following{/other_user}","gists_url":"https://api.github.com/users/justin808/gists{/gist_id}","starred_url":"https://api.github.com/users/justin808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justin808/subscriptions","organizations_url":"https://api.github.com/users/justin808/orgs","repos_url":"https://api.github.com/users/justin808/repos","events_url":"https://api.github.com/users/justin808/events{/privacy}","received_events_url":"https://api.github.com/users/justin808/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"josiasds","id":882253,"avatar_url":"https://avatars.githubusercontent.com/u/882253?v=3","gravatar_id":"","url":"https://api.github.com/users/josiasds","html_url":"https://github.com/josiasds","followers_url":"https://api.github.com/users/josiasds/followers","following_url":"https://api.github.com/users/josiasds/following{/other_user}","gists_url":"https://api.github.com/users/josiasds/gists{/gist_id}","starred_url":"https://api.github.com/users/josiasds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josiasds/subscriptions","organizations_url":"https://api.github.com/users/josiasds/orgs","repos_url":"https://api.github.com/users/josiasds/repos","events_url":"https://api.github.com/users/josiasds/events{/privacy}","received_events_url":"https://api.github.com/users/josiasds/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/shakacode/react_on_rails/milestones/1","html_url":"https://github.com/shakacode/react_on_rails/milestones/1.0","labels_url":"https://api.github.com/repos/shakacode/react_on_rails/milestones/1/labels","id":1280643,"number":1,"title":"1.0","description":null,"creator":{"login":"justin808","id":1118459,"avatar_url":"https://avatars.githubusercontent.com/u/1118459?v=3","gravatar_id":"","url":"https://api.github.com/users/justin808","html_url":"https://github.com/justin808","followers_url":"https://api.github.com/users/justin808/followers","following_url":"https://api.github.com/users/justin808/following{/other_user}","gists_url":"https://api.github.com/users/justin808/gists{/gist_id}","starred_url":"https://api.github.com/users/justin808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justin808/subscriptions","organizations_url":"https://api.github.com/users/justin808/orgs","repos_url":"https://api.github.com/users/justin808/repos","events_url":"https://api.github.com/users/justin808/events{/privacy}","received_events_url":"https://api.github.com/users/justin808/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":5,"state":"open","created_at":"2015-08-30T20:52:43Z","updated_at":"2015-09-21T06:26:32Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-09-20T18:28:00Z","updated_at":"2015-09-21T06:27:38Z","closed_at":null,"body":"We need to do like this from the react-rails gem.\r\n\r\nAlso, we could allow the user to set an `id` in the content tag, and that should replace the generated one. Also, support passing props as a string, or a hsh.\r\n\r\nWe need:\r\n\r\n- [ ] Provide examples in the `views/pages` directory and links in the `_header.html.erb` \r\n- [ ] tests for this, both at the unit level and at the integration test level.\r\n- [ ] Update the docs\r\n- [ ] Small change, don't try to call [props.to_json if props is already a string, here](https://github.com/shakacode/react_on_rails/blob/master/app/helpers/react_on_rails_helper.rb#L34).\r\n\r\nFrom the https://github.com/reactjs/react-rails/. We should make the API as similar as possible.\r\n\r\nhttps://github.com/reactjs/react-rails/blob/master/README.md\r\n\r\n- `component_class_name` is a string which names a globally-accessible component class. It may have dots (eg, `\"MyApp.Header.MenuItem\"`).\r\n- `props` is either an object that responds to `#to_json` or an already-stringified JSON object (eg, made with Jbuilder, see note below).\r\n- `html_options` may include:\r\n  - `tag:` to use an element other than a `div` to embed `data-react-class` and `-props`.\r\n  - `prerender: true` to render the component on the server.\r\n  - `**other` Any other arguments (eg `class:`, `id:`) are passed through to [`content_tag`](http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag).\r\n\r\nhttps://github.com/reactjs/react-rails/blob/master/lib/react/rails/component_mount.rb\r\n```ruby\r\n      # Render a UJS-type HTML tag annotated with data attributes, which\r\n      # are used by react_ujs to actually instantiate the React component\r\n      # on the client.\r\n      def react_component(name, props = {}, options = {}, &block)\r\n        options = {:tag => options} if options.is_a?(Symbol)\r\n\r\n        prerender_options = options[:prerender]\r\n        if prerender_options\r\n          block = Proc.new{ concat React::ServerRendering.render(name, props, prerender_options) }\r\n        end\r\n\r\n        html_options = options.reverse_merge(:data => {})\r\n        html_options[:data].tap do |data|\r\n          data[:react_class] = name\r\n          data[:react_props] = (props.is_a?(String) ? props : props.to_json)\r\n        end\r\n        html_tag = html_options[:tag] || :div\r\n\r\n        # remove internally used properties so they aren't rendered to DOM\r\n        html_options.except!(:tag, :prerender)\r\n\r\n        content_tag(html_tag, '', html_options, &block)\r\n      end\r\n    end\r\n```"},"comment":{"url":"https://api.github.com/repos/shakacode/react_on_rails/issues/comments/141888147","html_url":"https://github.com/shakacode/react_on_rails/issues/31#issuecomment-141888147","issue_url":"https://api.github.com/repos/shakacode/react_on_rails/issues/31","id":141888147,"user":{"login":"justin808","id":1118459,"avatar_url":"https://avatars.githubusercontent.com/u/1118459?v=3","gravatar_id":"","url":"https://api.github.com/users/justin808","html_url":"https://github.com/justin808","followers_url":"https://api.github.com/users/justin808/followers","following_url":"https://api.github.com/users/justin808/following{/other_user}","gists_url":"https://api.github.com/users/justin808/gists{/gist_id}","starred_url":"https://api.github.com/users/justin808/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justin808/subscriptions","organizations_url":"https://api.github.com/users/justin808/orgs","repos_url":"https://api.github.com/users/justin808/repos","events_url":"https://api.github.com/users/justin808/events{/privacy}","received_events_url":"https://api.github.com/users/justin808/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T06:27:38Z","updated_at":"2015-09-21T06:27:38Z","body":"@josiasds, @mapreal19 Would either of you like to take a look at this one? "}}