Git Product home page Git Product logo

refinerycms-copywriting's Introduction

Copywriting engine for Refinery CMS

Build Status

How do you manage your string in RefineryCMS?

Extended copywriting management: extract all your strings and leave no human word behind + i18n.

Do like this

<%= copywriting('phone number', { :scope => 'header', :default => '1-800-888-5555' }) %>

Or using block

<%= copywriting('slogan', { :scope => 'header' }) do %>
  Insert a slogan here
<% end %>

Just give it a name anyway

<%= copywriting('note1') %>

When it get more complex, avoid redundant options hash with options block

<% copywriting_options({ :scope => 'header', :phrase_type => 'wysiwyg' }) do %>
  ...
  <%= copywriting('contact information').html_safe do %>
    ...
  <% end %>
  ...
  <%= copywriting('phone number', { :phrase_type => 'string', :default => '1-800-888-5555' }) %>
  ...
<% end %>

Then edit the copywriting from the backend:

screenshot

Okay, but now, what if you want to have a string that change on every page, like a slogan?

Pass the @page object in the options hash:

<%= copywriting('slogan', { :scope => 'header', :page => @page }) do %>
  Insert a slogan here
<% end %>

screenshot

Install

# Gemfile
gem 'refinerycms-copywriting'
bundle
rails generate refinery:copywriting
rake db:migrate

Pull request?

Yes.

Helper method

copywriting('name', options) { ... optional block ... }

{
  :default => 'string...',        # if no block is given
  :page => @page,                 # the string will be scoped to the page, if no page_id option is provided
  :page_id => 1                   # using integer instead of page object
  :phrase_type => "wysiwyg"       # default is "text". Sets the type of field this is when editing. "string" gives you a single line text field. "text" gives you a multiline textarea. "wysiwyg" gives you the default Refinery visual editor.
}

copywriting_options(options) { ... use copywriting helper with default options hash ... }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.