2017 © Pedro PelĂĄez
 

library cms

image

insomnia/cms

  • Thursday, May 10, 2018
  • by insomnia-pt
  • Repository
  • 1 Watchers
  • 0 Stars
  • 81 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

INSOMNIA CMS

NOTE: This package is for Laravel 4.2, (*1)

INSTALL

Add this to composer.json and run composer update :, (*2)

{
    "require": {
        "insomnia/cms": "dev-master"
    }
}

Open config/app.php and add the following to the providers section:, (*3)

'Insomnia\Cms\CmsServiceProvider', (*4)

Configure database connection, and then run the command:, (*5)

php artisan cms:install

Access to /cms URL and login with:, (*6)

username: admin / password: admin, (*7)


PAGE TYPES EXAMPLES

Example of a page that allow config a Datasource (require a controller in the project to get the data and pass to the view)

Add a new record into pages_types table and put this JSON on config column:, (*8)


{ "areas": [ { "name":"datasource", "field": { "name":"Datasource", "description":"", "datatype":2, "size": 8, "admin":1 } }, { "name":"view", "field": { "name":"View", "description":"", "datatype":2, "size": 8, "admin":1 } }, { "name":"order", "field": { "name":"Order by", "description":"", "datatype":2, "size": 8, "admin":1 } } ] }

This allow to create a controller in the laravel project and get items from database like this:, (*9)

$items = CMS_ModelBuilder::fromTable($page->areas()->datasource)->orderBy($page->areas()->order)->paginate(6);

and return to the view:, (*10)

return View::make($page->areas()->view, compact('page','items'));

 , (*11)

Example of a page with Subtitle, Text content, Image, and allow to choose the view template

Add a new record into pages_types table and put this JSON on config column:, (*12)

{
    "areas":[
        {
            "name":"subtitle", 
            "field": {
                "name":"Sub-tĂ­tulo",
                "description":"", 
                "datatype":2, 
                "size": 8,
                "multilang": 1
            } 
        },
        {
            "name":"area1",
            "field": {
                "name":"ConteĂșdo",
                "description":"", 
                "datatype":5, 
                "size": 10,
                "multilang": 1
            }
        },
        {
            "name":"foto", 
            "field":{
                "name":"Foto",
                "description":"",
                "datatype":"10",
                "size": 10, 
                "parameters":{
                    "limit":"1", 
                    "extensions":"jpeg,jpg,png"
                }
            } 
        }
    ],
    "settings":[
        {
            "name":"view", 
            "field": {
                "name":"View",
                "description":"", 
                "datatype":8, 
                "size": 10, 
                "parameters":{
                    "values":"template.page_red, Page Red; template.page_blue, Page Blue"
                } 
            }
        }
    ]
}

Example of a page that creates a Datasource component and associates it with the page

Add a new record into pages_types table and put this JSON on config column:, (*13)






  • areas (fields listed on page edition), (*14)

    • name (field identifier - to use on frontend)
    • field (field config)
    • name (label visible in page edition)
    • description (description visible in page edition)
    • datatype (id of the field type - text / combobox / upload / ... - check datasources_fieldtypes table)
    • size (bootstrap col size)
    • multilang (if 1, the system allow translate the field)
    • admin (if 1, the field is only visible to admin)
    • parameters (in some cases, the field type require values to choose - like a combobox)
      • values
  • settings (fields listed on right side of page edition), (*15)

    • name (field identifier - to use on frontend)
    • field (field config)
    • name (label visible in page edition)
    • description (description visible in page edition)
    • datatype (id of the field type - text / combobox / upload / ... - check datasources_fieldtypes table)
    • size (bootstrap col size)
    • parameters (in some cases, the field type require values to choose - like a combobox)
      • values

OTHER CONFIGS

Show component shortcut on page edition

  • In datasource_page table add the id of the page page_id and the component id datasource_id

The Versions