{"id":13880318,"url":"https://github.com/infinum/phrasing","last_synced_at":"2025-07-16T16:31:32.201Z","repository":{"id":9582263,"uuid":"11498533","full_name":"infinum/phrasing","owner":"infinum","description":"Edit phrases inline for your Ruby on Rails applications!","archived":false,"fork":false,"pushed_at":"2021-12-23T08:21:55.000Z","size":2153,"stargazers_count":546,"open_issues_count":2,"forks_count":85,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-07-10T09:58:55.361Z","etag":null,"topics":["open-source","ruby"],"latest_commit_sha":null,"homepage":"https://www.infinum.co/the-capsized-eight/articles/simple-ruby-on-rails-content-editing","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/infinum.png","metadata":{"files":{"readme":"README-3.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-18T08:57:51.000Z","updated_at":"2025-05-13T04:11:02.000Z","dependencies_parsed_at":"2022-07-30T01:37:52.868Z","dependency_job_id":null,"html_url":"https://github.com/infinum/phrasing","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/infinum/phrasing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fphrasing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fphrasing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fphrasing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fphrasing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infinum","download_url":"https://codeload.github.com/infinum/phrasing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infinum%2Fphrasing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265524632,"owners_count":23782016,"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":["open-source","ruby"],"created_at":"2024-08-06T08:02:56.475Z","updated_at":"2025-07-16T16:31:31.666Z","avatar_url":"https://github.com/infinum.png","language":"Ruby","readme":"# Phrasing!\n\n[![Build Status](https://travis-ci.org/infinum/phrasing.png)](https://travis-ci.org/infinum/phrasing)\n\n![Phrasing](http://www.miataturbo.net/attachments/miata-parts-sale-trade-5/74257-lots-leftovers-near-boston-archer-phrasing2-300x225-jpg?dateline=1366600534)\n\nPhrasing is a gem for live editing phrases (copy) on websites.\n\n## Installation\n\nInclude the gem in your Gemfile\n\n```ruby\ngem \"phrasing\"\n```\n\nBundle the Gemfile\n\n```ruby\nbundle install\n```\n\nRun the install script which will create a migration file and a config file.\n\n```ruby\nrake phrasing:install\n```\n\nMigrate your database\n```ruby\nrake db:migrate\n```\n\n## Setup\n\nThe rake task will also generate \u003ctt\u003ephrasing_helper.rb\u003c/tt\u003e in your \u003ctt\u003eapp/helpers\u003c/tt\u003e folder. Here you will need to implement the \u003ctt\u003ecan_edit_phrases?\u003c/tt\u003e method. Use this to hook-up your existing user authentication system to work with Phrasing.\n\nFor example:\n\n```ruby\nmodule PhrasingHelper\n\n  def can_edit_phrases?\n    current_user.is_admin?\n  end\n\nend\n```\nInclude the phrasing **html** initializer at the top of your application layout file.\n\n```haml\n= render 'phrasing/initializer'\n```\n\nInclude the required **javascript** file:\n\n```javascript\n//= require phrasing\n```\n\nInclude the required **stylesheet** file:\n\n```css\n*= require phrasing\n```\n\n## How to use phrasing?\n\nYou can start adding new phrases by simply adding them in your view file:\n\n  = phrase('my-first-phrase')\n\nAside from editing phrases (basically, Rails translations) you can also edit model attributes inline. Use the same `phrase` method, with the first attribute being the record in question, and the second one the attribute you wish to make editable:\n\n    = phrase(@post, :title)\n\nIn the above example, \u003ctt\u003e@post\u003c/tt\u003e is the record with a \u003ctt\u003etitle\u003c/tt\u003e attribute.\n\n## Security\n\nSince Phrasing can be used to update any attribute in any table (using the model_phrase method), special care must be taken into consideration from a security standpoint.\n\nBy default, Phrasing doesn't allow updating of any attribute apart from \u003ctt\u003ePhrasingPhrase.value\u003c/tt\u003e. To be able to work with other attributes, you need to whitelist them.\n\nIn the \u003ctt\u003econfig/initializers/phrasing.rb\u003c/tt\u003e file you can whitelist your model attributes like this:\n\n```ruby\nPhrasing.white_list = [\"Post.title\", \"Post.body\"]\n```\n\nor you can whitelist all of them (not recommended) with:\n\n```ruby\nPhrasing.allow_update_on_all_models_and_attributes = true\n```\n\n## Upgrading from version 2.x to 3.x\n\nIn versions 3.0.0 and above we have added the Phrasing Versioning System which requires an additional table, so if you are upgrading to a 3.x release, run \u003ctt\u003erake phrasing:install\u003c/tt\u003e to get the additional migration file, then run \u003ctt\u003erake db:migrate\u003c/tt\u003e.\n\n## Turbolinks\n\nIf you're experiencing problems with Rails apps using Turbolinks, include the [jQuery-turbolinks](https://github.com/kossnocorp/jquery.turbolinks) gem in your application and simply require it in the following order:\n\n```javascript\n//= require jquery\n//= require jquery.turbolinks\n//= require phrasing\n//= require turbolinks\n```\n\n## Phrasing Appearance\n\nThe `phrase` view helper can take the `options` hash as the last parameter. Features:\n```ruby\nurl: custom_url # point Phrasing to other actions in other controllers\ninverse: true # change the hovered background and underline colors to better fit darker backgrounds\nclass: custom_class # add custom CSS classes to your phrases to change the appearance of phrases in your application\ninterpolation: { %min: 10 } # add variables to your translations just like w/ I18n\nscope: 'homepage.footer' # add scopes just like you would w/ I18.n. If the first argument is 'test', than the key would be 'homepage.footer.test'\n```\n\n## Credits\n\nPhrasing is maintained and sponsored by\n[Infinum] (http://www.infinum.co).\n\n![Infinum](https://www.infinum.co/assets/logo_pic-2e19713f50692ed9b0805b199676c19a.png)\n\nPhrasing leverages parts of [Copycat](https://github.com/Zorros/copycat) and [ZenPen](https://github.com/tholman/zenpen/tree/master/).\n\n## License\n\nPhrasing is Copyright © 2013 Infinum. It is free software, and may be redistributed under the terms specified in the LICENSE file.","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinum%2Fphrasing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfinum%2Fphrasing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfinum%2Fphrasing/lists"}