{"id":24529256,"url":"https://github.com/opencomponents/opencomponents-rails","last_synced_at":"2025-10-26T22:02:01.800Z","repository":{"id":56886822,"uuid":"38009286","full_name":"opencomponents/opencomponents-rails","owner":"opencomponents","description":"OpenComponents for Rails","archived":false,"fork":false,"pushed_at":"2016-03-06T01:30:25.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-02-18T22:04:58.321Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opencomponents.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-24T20:29:12.000Z","updated_at":"2017-09-10T12:15:46.000Z","dependencies_parsed_at":"2022-08-21T00:20:48.279Z","dependency_job_id":null,"html_url":"https://github.com/opencomponents/opencomponents-rails","commit_stats":null,"previous_names":["opentable/opencomponents-rails"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Fopencomponents-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Fopencomponents-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Fopencomponents-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencomponents%2Fopencomponents-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opencomponents","download_url":"https://codeload.github.com/opencomponents/opencomponents-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243769949,"owners_count":20345215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T07:35:40.269Z","updated_at":"2025-10-26T22:02:01.748Z","avatar_url":"https://github.com/opencomponents.png","language":"Ruby","readme":"# OpenComponents::Rails\n[![Build Status](https://travis-ci.org/opentable/opencomponents-rails.svg?branch=master)][1]\n[![Gem Version](https://badge.fury.io/rb/opencomponents-rails.svg)][2]\n\n[1]:https://travis-ci.org/opentable/opencomponents-rails\n[2]:http://badge.fury.io/rb/opencomponents-rails\n\nOpenComponents for Rails. This gem provides view helper methods for component\nrendering on both server- and client-side.\n\n## Getting Started\nAdd the gem to your Gemfile and run `bundle install`:\n\n```ruby\ngem 'opencomponents-rails'\n```\n\n### Configuration\nAll configuration options are set through Rails environment configuration files.\n\n```ruby\n# production.rb\n\n# Sets the registry URL to fetch components from. Defaults to http://localhost:3030.\nconfig.opencomponents.registry = 'http://my.awesome.registry'\n\n# Determines whether rendering should be handed off to the browser if server-side\n# rendering fails. Defaults to true.\nconfig.opencomponents.enable_client_failover = true\n\n# Sets the timeout length (in seconds) for registry requests. Defaults to 5.\nconfig.opencomponents.request_timeout = 10\n```\n\n## Rendering\n`OpenComponents::Rails` supports both server- and client-side rendering of components.\nBy default, the gem will fall back to client-side rendering if a server-side registry\nrequest times out. If client-side failover if disabled, an error will be raised instead.\nThis is configurable using the `enable_client_failover` option.\n\n### Client-Side Rendering\nThe OpenComponents client-side javascript library is bundled with this gem for inclusion\nin the asset compilation process. To enable client-side rendering through the asset\npipeline, add the library to your javascript manifest:\n\n```javascript\n//= require opencomponents\n```\n\nOnce that's done, you can use the `oc_component_tag` method in your views. You can either\npass the method a fully formed `href` attribute or use the same options as `OpenComponents`\n[Renderer][3].\n```erb\n\u003c%= oc_component_tag('my-sweet-component', href: 'http://localhost:3030/my-sweet-component/1.0.1?name=Zan') %\u003e\n\n\u003c%= oc_component_tag('my-sweet-component', params: {name: 'Zan'}, version: '1.0.1') %\u003e\n```\n\nComponents using this tag will be automatically rendered on DOM load.\n\n### Server-Side Rendering\nIn your view, simply call `render_component`:\n\n```erb\n\u003c%= render_component('my-sweet-component', params: {name: 'Zan'}, version: '1.0.1') %\u003e\n```\n\nThe method accepts the same options as the `OpenComponents` [Renderer][3].\n\n[3]:http://www.rubydoc.info/gems/opencomponents/OpenComponents/Renderer\n\n## Contributing\nWould be pretty cool of you. Open an Issue or PR if you find bugs or have ideas for improvements.\n\n## License\nCopyright 2015 OpenTable. See LICENSE for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencomponents%2Fopencomponents-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencomponents%2Fopencomponents-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencomponents%2Fopencomponents-rails/lists"}