-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Binda is a CMS with an intuitive out-of-the-box interface to manage and customize page components.
Binda is based on structures. A structure is the core element on which you can build any component. Every structure can have one or more field groups which can be populated with several field settings. A field setting is an instance of a field type that you can customise.
Let's say your website needs a set of pages with a description and a excerpt. You can create a simple-page
structure and add a field group to it. At that point you can set a description
and excerpt
field settings based both on a Text
field type. Once done you will see the Simple Page tab in your menu which will contain all your simple pages.
TODO - add gif to explain interface.
By default Binda creates an administration panel in /admin_panel
route. You can change it in your config/route.rb
file.
The first thing you might do is to create a Structure
for you first set of components. Once created you will be able to add as many istances as you need. Every Structure
has a list of categories that can be applied to your components. This list is available only for this specific Structure
.
Let's say you created a Structure
which called My first component, to retrieve the list of components use the following line:
# if you have installed friendly_id gem in your application you can do:
@components = Binda:Structure.friendly.find('my-first-component').components
# if you don't want to install it you can do:
@components = Binda:Structure.where("slug = 'my-first-component'").first.components
Components
are instances of a Structure
.
To retrieve a Components
you can:
# if you have installed friendly_id gem in your application you can do:
@component = Binda:Component.friendly.find('my-first-component')
# if you don't want to install it you can do:
@component = Binda:Component.where("slug = 'my-first-component'").first
Every field setting is based on a field type. You can create several field settings based on a single field type. Here below a list of field types available:
Field setting | Details |
---|---|
String | Store a string. No formatting options available. |
Text | Store a text. TinyMCE let's you format the text as you like. |
Asset | Store image. (TODO store file). |
Gallery (TODO) | Create a collection of images. |
Radio (TODO) | Store a value based on a list of elements. |
Select (TODO) | Store one or multiple values based on a list of elements. |
Color (TODO) | Store an RGB color. |
Date | Store a date. |
Time | Store a time. |
Repeater | Store multiple instances of a field or a collection of fields |
Every field setting has a unique slug
. The default slug
is made of the * structure name + field group name + field setting name *. If it's a child of a repeater
the slug will include the repeater
slug as well. You can customise the slug
as you like keeping in mind that there every slug
can be attach to only one field setting.
In order to retrieve a field content you can use a component helper.
In your controller you can access the component
instance (at the moment component
is named page
, but it will change to component
in the upcoming release):
# controller
@component = Binda:Component.find(1)
# view
@component.get_text('description')
# => 'Hellow world'
Here below a list of helpers. These helpers are methods of the Binda:Component
and the must be called on an instance in order to work. See How to get field content.
String | |
---|---|
has_text( slug ) |
Returns 'true/false' |
get_text( slug ) |
Returns the text. Use simple_format to maintain HTML tags. |
Text | |
---|---|
has_text( slug ) |
Returns 'true/false'. |
get_text( slug ) |
Returns the text. Use simple_format to maintain HTML tags. |
Asset | |
---|---|
has_image( slug ) |
Returns true/false . |
get_image_url( slug ) |
Returns the url of the image. |
get_image_path( slug ) |
Returns the path of the image. |
Date | |
---|---|
has_date( slug ) |
Returns true/false
|
get_date( slug ) |
Returns the date in datetime format. Use strftime to change date format. |
TODO add info
TODO add info