Rails Content Blocks

#Content Blocks

Content Blocks are pre-made, resuable chunks of HTML that are styled to give you ready to use components that drop onto your page. Content Blocks can be copied into your project and customized to display whatever you want.
!warning Customizing Content Blocks. If you want to customize a content block, it's best to copy it first into another directory that is more relevant to the context you want to use the content block. This is not only more logical, but it saves your customizations from being overwritten by future Rapid Rails Themes updates.
Content blocks primarily drop in View partials that provide pre-made content for landing pages and so on, although there are some internal App type content blocks. They are currently grouped into 5 areas:
  • Basic blocks
  • App Navs
  • Landing Navs
  • Headers
  • General
All of the content blocks seen on the online demo are available to you for reference in your projects. Simply render them as partials:
  <%= render "content_blocks/app_navs/1" %>
The number matches the number on the online demo, so if you want Basic Block 5 from the online demo, just append 5 onto the basic path:
  <%= render "content_blocks/basic/5" %>
All of these view partials are automatically picked up from the Rapid Rails Themes engine, but you can, of course, generate all of the view partials into your own project so that you can customize them further. Simply run the content_blocks generator:
bin/rails g rrt:content_blocks
All of the content blocks will be generated into your project under the app/views/content_blocks path.