0.0
No commit activity in last 3 years
No release in over 3 years
Storage page fragments in database
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 4.0.3
 Project Readme

PageFragments

Page Fragments is gem for Ruby On Rails. PageFragments allow you to store snippets of pages in the database and edit them in the admin application.

Installation

Add this line to your application's Gemfile:

gem "page_fragments"

First, execute

$ rails generate page_fragments:install

this create config/page_fragments.rb when you write you templates

PageFragment.templates do
  #fragment :fragment_type, :fragment_key

  fragment :string, :header
  fragment :text, :about
end

After edit templates config you should execute 'rake pf:init'. This create templates in your database.

And this generator create migration for PageFragment model. Now we have to perform

$ rake db:migrate

PageFragments have standard controller and views. You can using own controller inherited from PageFragments::PageFragmentsController. After this you should to edit routes.

It will copy all views to your application:

$ rails generate page_fragments:views

Usage

In you view:

<%= render_page_fragment :key_of_fragment %>

Authors

Promakh Alexandr: s-promakh@ya.ru MyStand: http://mystand.ru/

MIT License. Copyright 2013 Promakh Alexandr.