Giter Club home page Giter Club logo

refinerycms-snippets's Introduction

Snippets engine for Refinery CMS.

About

Snippets allows you to relate one or more html blocks to any page in Refinery. These blocks are attached to the page parts, before or after the its html body.

Requirements

  • RefineryCMS with 'Pages' engine (refinerycms-pages >= 0.9.9.1)

TODO

to 1.0

  • Snippet selector in page administration. -- done
  • Save and Continue button -- done
  • Attaching snippet to page part directly through administration, without overriding view template -- done
  • Documentation
  • Tests

to 2.0

  • custom attributes for snippet (id, classes etc)
  • support for dynamic snippets (erb templates, forms etc)
  • improve UI
  • inheritance and clone

Install

Add this line to your applications Gemfile

gem 'refinerycms-snippets', '~> 0.4.1'

Next run

bundle install
rails g refinerycms_snippets
rake db:migrate

Usage

  • Create Snippet on /refinery/snippets
  • Now you can attach snippet to page when you click Edit this page on /refinery/pages. In the Snippets tab you can select the part to which you want to attach the block and add it after and/or before the html body of the part.
  • Next you can use content_of(@page, :part) to print the body of the part and the snippets attached to it in the pages views.
  • You have some other interesting methods to work with snippets:
    • page.snippets: returns all the snippets attached to all the parts of page.
    • part.after: returns all the snippets attached after the html body of part.
    • part.before: returns all the snippets attached before the html body of part.
    • snippet.pages: returns all pages to whose parts is snippet attached.
    • snippet.before?(part): returns true if snippet is attached before part body.
    • snippet.after?(part): return true if snippet is attached after part body.

Screenshots

![Create/Edit Snippet] (http://farm3.static.flickr.com/2150/5702424159_a688bfd7dd_b.jpg)

Donate

Feel free buy me some gift ;-) http://www.amazon.com/gp/registry/wishlist/1BBMUW9DDYXFF

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.