Giter Site home page Giter Site logo

content_blocks's Introduction

Content Blocks

Content Blocks aims to be a tiny set of reusable AR models for site fragments. Currently it consists of only one model: Snippet. The following usage example will tell you more.

Installation

As a gem in your Gemfile:

gem 'content_blocks'

Usage

Given:

ContentBlocks::Snippet.create :label => :label_for_snippet, :content => 'h2. Title'
ContentBlocks::Snippet[:label_for_snippet].publish!

When:

<%= ContentBlocks::Snippet[:label_for_snippet].content %>

Then it will render textilized content column from Snippet model:

<h2>Title</h2>

I you’d rather like to access content without textilization, use:

<%= ContentBlocks::Snippet[:label_for_snippet].raw_content %>

You can have multiple snippets with the same label, only one can be published at the same time though. Snippets are also automatically created on first access if they don’t exist.

Copyright © 2010 Paweł Pacana. Released under MIT license.

content_blocks's People

Contributors

mostlyobvious avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

netconstructor

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.