Edit/Update dynamic data like best in place by Phrasing-
Bundle the Gemfile
Run the install script which will create a migration file and a config file.
Migrate your database
For example:
Include the phrasing html initializer at the top of your application layout file.
Include the required javascript file:
Include the required stylesheet file:
or Follow https://github.com/infinum/phrasing
Installation
Include the gem in your Gemfilegem "phrasing"
bundle install
rake phrasing:install
rake db:migrate
Setup
The rake task will also generate phrasing_helper.rb in your app/helpers folder. Here you will need to implement the can_edit_phrases? method. Use this to hook-up your existing user authentication system to work with Phrasing.For example:
module PhrasingHelper
def can_edit_phrases?
current_user.is_admin?
end
end
= render 'phrasing/initializer'
//= require phrasing
*= require phrasing
How to use phrasing?
You can start adding new phrases by simply adding them in your view file:= phrase('my-first-phrase')
Aside 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:= phrase(@post, :title)
In the above example, @post is the record with a title attribute.or Follow https://github.com/infinum/phrasing
No comments:
Post a Comment