Coder Social home page Coder Social logo

copy's Introduction

Copy is a simple, Sinatra-based CMS (Copy Management System).

$ gem install copy and then generate a new site $ copy -n mynewsite

mynewsite/
├── Gemfile              <- Uncomment the gems you need for storage.
├── config.ru            <- Configure storage, user, and password here.
├── public               <- The public root of your new site.
│   ├── favicon.ico      <- A blank favicon, replace with your own.
│   ├── images
│   ├── javascripts
│   │   └── main.js      <- A good place for your basic scripts.
│   ├── robots.txt       <- Read file for details.
│   └── stylesheets
│       └── main.css     <- Toss some CSS styles in here.
└── views                <- Your views, layouts, and partials live here.
    ├── index.html.erb
    └── layout.html.erb  <- Optional global layout file.

Copy automatically maps URLs to files in your views directory.

  • /index.html.erb
  • /aboutabout.html.erb or about/index.html.erb
  • /about/usabout/us.html.erb

Copy lets you define blocks of editable text in your views.

<% copy :contact do %>
  1 _Infinite_ Loop
  Cupertino, CA 95014
  408.996.1010
<% end %>

The text provided in the block will be saved and can then be edited live on the site. All content is formatted with Markdown. See demo for a live example or view the source.

Single line blocks will be rendered in a span (by default). Perfect for headlines.

<h1><% copy :title do %>Like a boss!<% end %></h1>

Partials can be rendered from any view with the partial helper. Their filenames are always prefixed with an underscore.

  • <%= partial 'nav' %> renders _nav.html.erb
  • <%= partial 'shared/details' %> renders shared/_details.html.erb

Storage

Copy supports multiple backends for storage: redis, mongodb, mysql, postgres, and sqlite.

Choosing and configuring your storage option is done in one line in your config.ru file by providing a connection URI.

Examples:

  • set :storage, 'mongodb://user:pass@host:port/database'
  • set :storage, 'postgres://user:pass@host/database'

Editing copy on your live site

Browse to /_copy and drag the "Edit Copy" link to your bookmarks bar. Return to your site, click the bookmark (you'll be prompted for your username and password) and then click on the highlighted text to edit it. That's it!


Build Status — © 2011 Javan Makhmali

copy's People

Contributors

javan avatar levibrown avatar

Watchers

James Cloos avatar

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.