{"id":13427980,"url":"https://github.com/cllns/subdivision_select","last_synced_at":"2025-04-16T01:19:28.091Z","repository":{"id":31299459,"uuid":"34861641","full_name":"cllns/subdivision_select","owner":"cllns","description":":earth_africa: A Rails plugin to populate a state/province select box from country_select","archived":false,"fork":false,"pushed_at":"2024-01-22T10:53:08.000Z","size":274,"stargazers_count":20,"open_issues_count":4,"forks_count":18,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T03:22:53.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/cllns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-30T15:24:32.000Z","updated_at":"2025-02-06T16:00:38.000Z","dependencies_parsed_at":"2024-11-16T16:03:51.258Z","dependency_job_id":"9e2578b1-2bde-4272-af90-f9fdf5446832","html_url":"https://github.com/cllns/subdivision_select","commit_stats":{"total_commits":51,"total_committers":4,"mean_commits":12.75,"dds":0.05882352941176472,"last_synced_commit":"5323418d3a66cac32d5c780ebd525dc84b497623"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cllns%2Fsubdivision_select","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cllns%2Fsubdivision_select/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cllns%2Fsubdivision_select/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cllns%2Fsubdivision_select/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cllns","download_url":"https://codeload.github.com/cllns/subdivision_select/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586241,"owners_count":21128998,"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":"2024-07-31T01:00:43.866Z","updated_at":"2025-04-16T01:19:28.048Z","avatar_url":"https://github.com/cllns.png","language":"Ruby","readme":"Subdivision Select\n===\n\n**subdivision_select** is a Rails plugin that extends the functionality of the [**country_select**](https://github.com/stefanpenner/country_select) gem.\n\nWhen you select a country,\na select box for the states or provinces (i.e. subdivisions) is automatically populated for that country.\n\nIt loads them via AJAX,\nbut this plugin doesn't require you to write any javascript.\n\n![Subdivision Select Animated GIF Demo](/demo.gif)\n\nTerminology\n---\nThis plugin is called **subdivision_select** but it could have been called\n*state_selct* or *province_select*\n\nThe terminology comes from [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2).\n\nThe data is provided by the `countries` gem.\n\nExample\n---\n```\n\u003c% form_for(@address) do |f| %\u003e\n  \u003cdiv class=\"field\"\u003e\n    \u003c%= f.label :country %\u003e\n    \u003c%= f.country_select :country %\u003e\n  \u003c/div\u003e\n\n  \u003cdiv class=\"field\"\u003e\n    \u003c%= f.label :subdivision, \"State / Province\" %\u003e\n    \u003c%= f.subdivision_select :subdivision, @address.country %\u003e\n  \u003c/div\u003e\n\n  \u003c%= f.submit %\u003e\n\u003c% end %\u003e\n\n```\n\nYou can also use `subdivision_select_tag`,\nif using\n[FormTagHelpers](http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html).\n\nThis plugin makes no assumptions about what you call the subdivision select,\nso if you already named your column 'state' or 'province',\nyou can use that instead.\n\nCurrently,\nthis plugin assumes your country column is named `country`,\nand doesn't provide anyway to override that.\n\nInstallation\n---\n1) Add the following to your `Gemfile`:\n\n```\ngem \"subdivision_select\"\n```\n\n2) Add the following to your `config/routes.rb`:\n\n```\n mount SubdivisionSelect::Engine, at: 'subdivisions'\n```\n(the 'subdivisions' part is necessary, since that path is hardcoded in JS)\n\n\n3) Add the following to `application.js` (or whatever your JS digest file is called)\n\n```\n//= require subdivision_select\n```\n\nDevelopment and Testing\n---\nIf you want to work on this gem, fork and clone the repo.\nWe use RSpec and Capybara.\n\nThere is a 'dummy app' in `spec/dummy` you can use for testing.\n\nIf you add a feature,\nplease add a feature spec for it,\nusing Capybara.\n\nLicense\n---\nMIT\n\n\nContributing\n---\nPlease open a new Github Issue for any problems you have with the gem.\nBugs reports and feature requests are always welcome,\nbut I'm also willing to do tech support\nor take suggestions on ways you think the code quality can be improved.\n","funding_links":[],"categories":["View Helper","视图"],"sub_categories":["Omniauth"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcllns%2Fsubdivision_select","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcllns%2Fsubdivision_select","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcllns%2Fsubdivision_select/lists"}