Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.
/ komposer Public archive

Collection of generators to create admin dashboard.

License

Notifications You must be signed in to change notification settings

komposable/komposer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Komposer

Installation

gem 'komposer'

In order to use Komposer in your administration panel, you need to require some dependencies.

// app/assets/javascripts/administration.js

//= require komposer
// app/assets/stylesheets/administration.scss

@import 'komposer';

Block

Usage

Generate new block with:

rails generate komposer:block title_block title:string

The previous command generates:

  • frontend/components/title_blocks/_block_form.html.slim
  • frontend/components/title_blocks/_title_block.html.slim
  • frontend/components/title_blocks/title_block.js
  • frontend/components/title_blocks/title_block.css
  • append to frontend/components/index.js

A block is very similar to component, but they have a form representation to be administrable.

To administrate the block since a back-office, you need to declare presence of blocks in model.

# app/models/article.rb

class Article < ApplicationRecord
  has_blocks([:title_blocks])
end
# app/views/articles/_form.html.slim

= bootstrap_form_for @article do |f|
  = f.blocks_form

Now in your frontend pages, you can just render blocks like normal Rails partials.

= render @article.blocks

About

Collection of generators to create admin dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •