Static Content
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.
- Test if everything is running ok;
- Change version of the gem on
VERSIONconstant; - Add the release date on the
CHANGELOG; - Do a commit "Bump version x.x.x", follow the semantic version;
- Run
$ rake release, this will send the gem to the rubygems; - Check if the gem is on the rubygems and the tags are correct on the github;
Credits
Static Content is maintained and funded by HE:labs. Thank you to all the contributors.




