Skip to content
This repository

Static Content provides a simple way to embed static content on your application that can be later edited through an admin interface.

branch: master
README.md

Static Content

RubyGems Travis CI Coveralls Code Climate Gemnasium

:warning: This gem is deprecated and will not be maintained anymore. Instead, use phrasing that does the same with some plus. :warning:

Static Content provides an easy way of defining static content in your application.

Installation

Add this line to your application's Gemfile:

gem 'static_content'

And then execute:

$ bundle

Or install it yourself as:

$ gem install static_content

After install the gem, you just need run the install generator:

$ rails g static_content:install

Usage

Creating content

The content we create can be normal text or a markdown. Let`s see the way we can create a content.

Use the StaticContent::Content.from_slug like:

StaticContent::Content.from_slug(:about_title, default: "My awesome about page")

as this uses find_or_initialize, if is a new slug its create, if a old one its only return the value not raising a error.

So you can use this on a seed for example to create the default things.

Showing content

content

Show your content as html converted from markdown, in your view, just add:

<%= c :about_title, default: "# My awesome about page" %>

to be converted into

<h1>My awesome about page</h1>

Please note that a default option is required. If it hasn't been created, it will be created upon the first request.

raw content

Show your raw content, in your view, just add:

<%= rc :about_title, default: "# My awesome about page" %>

no change the value as

# My awesome about page

Please note that a default option is required. If it hasn't been created, it will be created upon the first request.

Versioning

Static Content follow the Semantic Versioning.

Issues

If you have problems, please create a Github Issue.

Contributing

Please see CONTRIBUTING.md for details.

Release

Follow this steps to release a new version of the gem.

  1. Test if everything is running ok;
  2. Change version of the gem on VERSION constant;
  3. Add the release date on the CHANGELOG;
  4. Do a commit "Bump version x.x.x", follow the semantic version;
  5. Run $ rake release, this will send the gem to the rubygems;
  6. Check if the gem is on the rubygems and the tags are correct on the github;

Maintainers

Credits

Static Content is maintained and funded by HE:labs. Thank you to all the contributors.

Something went wrong with that request. Please try again.