comfortable-mexican-sofa
ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine
Top Related Projects
An open source eCommerce platform giving you full control and customizability. Modular and API-first. Build any eCommerce solution that your business requires. Developed by @vendo-dev
🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
A Rails engine that helps you put together a super-flexible admin dashboard.
The administration framework for Ruby on Rails applications.
A platform to create, publish and edit sites
Quick Overview
Comfortable Mexican Sofa (ComfortableMexicanSofa) is a powerful, open-source Content Management System (CMS) for Ruby on Rails. It provides a flexible and customizable solution for managing content in Rails applications, offering features like page templating, file management, and a user-friendly admin interface.
Pros
- Easy integration with existing Ruby on Rails applications
- Highly customizable and extendable through plugins and custom functionality
- User-friendly admin interface for content management
- Supports multiple sites within a single Rails application
Cons
- Learning curve for developers new to the CMS ecosystem
- Limited themes and templates available out of the box
- May be overkill for simple websites or applications
- Documentation could be more comprehensive for advanced use cases
Code Examples
- Creating a new page in ComfortableMexicanSofa:
Comfy::Cms::Page.create!(
site: Comfy::Cms::Site.first,
layout: Comfy::Cms::Layout.find_by(identifier: 'default'),
label: 'My New Page',
slug: 'my-new-page',
fragments_attributes: [
{ identifier: 'content', content: 'Hello, World!' }
]
)
- Rendering a CMS page in a Rails controller:
class PagesController < ApplicationController
def show
@cms_page = Comfy::Cms::Page.find_by(slug: params[:slug])
render inline: @cms_page.content(parse_textile: true)
end
end
- Creating a custom form builder for ComfortableMexicanSofa:
class MyFormBuilder < ComfortableMexicanSofa::FormBuilder
def custom_field(label, options = {})
default_options = { class: 'form-control' }
options = default_options.merge(options)
form_group label: label do
text_field_tag(name, value, options)
end
end
end
Getting Started
To get started with ComfortableMexicanSofa, follow these steps:
-
Add the gem to your Rails application's Gemfile:
gem 'comfortable_mexican_sofa', '~> 2.0.0'
-
Run bundle install:
bundle install
-
Run the installer:
rails generate comfy:cms
-
Run migrations:
rails db:migrate
-
Start your Rails server and navigate to
/admin
to access the CMS admin panel.
Competitor Comparisons
An open source eCommerce platform giving you full control and customizability. Modular and API-first. Build any eCommerce solution that your business requires. Developed by @vendo-dev
Pros of Spree
- Full-featured e-commerce platform with extensive functionality
- Large, active community and ecosystem of extensions
- Robust inventory management and order processing capabilities
Cons of Spree
- Steeper learning curve due to complexity
- Can be overkill for simple e-commerce needs
- Requires more server resources to run efficiently
Code Comparison
Spree (Ruby on Rails e-commerce):
Spree::Config.configure do |config|
config.allow_guest_checkout = false
config.currency = "USD"
config.mails_from = "store@example.com"
end
Comfortable Mexican Sofa (CMS for Ruby on Rails):
ComfortableMexicanSofa.configure do |config|
config.cms_title = "My CMS Site"
config.admin_auth = 'ComfyAdminAuthentication'
config.public_cms_path = ''
end
Key Differences
- Spree focuses on e-commerce, while Comfortable Mexican Sofa is a CMS
- Spree has more complex setup and configuration options
- Comfortable Mexican Sofa is lighter and easier to integrate into existing Rails apps
- Spree offers more built-in features for online stores
- Comfortable Mexican Sofa provides more flexibility for general content management
Both projects are open-source and built on Ruby on Rails, but they serve different primary purposes. Choose based on your specific needs: e-commerce platform vs. content management system.
🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
Pros of Solidus
- Full-featured e-commerce platform with extensive functionality
- Large and active community, providing better support and resources
- More comprehensive documentation and guides for developers
Cons of Solidus
- Steeper learning curve due to its complexity
- Potentially overkill for simple content management needs
- Requires more server resources to run efficiently
Code Comparison
Solidus (Ruby on Rails e-commerce):
Spree::Core::Engine.add_routes do
namespace :admin do
resources :products do
resources :variants
end
end
end
Comfortable Mexican Sofa (CMS):
ComfortableMexicanSofa::AccessControl::AdminAuthentication.class_eval do
def authenticate
unless current_user.try(:admin?)
redirect_to root_path
end
end
end
Summary
Solidus is a robust e-commerce platform with a wide range of features, while Comfortable Mexican Sofa is a simpler content management system. Solidus offers more extensive functionality for online stores but comes with increased complexity. Comfortable Mexican Sofa is more lightweight and easier to set up for basic content management needs. The choice between the two depends on the specific requirements of the project, with Solidus being better suited for full-fledged e-commerce sites and Comfortable Mexican Sofa for simpler content-driven websites.
A Rails engine that helps you put together a super-flexible admin dashboard.
Pros of Administrate
- More flexible and customizable for complex admin interfaces
- Better suited for larger applications with diverse data models
- Offers a clean, modern UI out of the box
Cons of Administrate
- Steeper learning curve for beginners
- Requires more setup and configuration
- Less suitable for simple content management needs
Code Comparison
Administrate dashboard configuration:
class ProductDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
id: Field::Number,
name: Field::String,
price: Field::Number.with_options(prefix: "$", decimals: 2),
created_at: Field::DateTime,
updated_at: Field::DateTime,
}
# ... more configuration
end
Comfortable Mexican Sofa page configuration:
ComfortableMexicanSofa::Content::Tag.register_tag(:product_name, ProductNameTag)
class Comfy::Cms::Page < ActiveRecord::Base
cms_is_mirrored
cms_has_revisions_for :blocks_attributes
# ... more configuration
end
Summary
Administrate is better suited for complex admin interfaces in larger applications, offering more flexibility and customization options. However, it has a steeper learning curve and requires more setup. Comfortable Mexican Sofa is simpler to use and better for content management, but may be less flexible for diverse data models. The code comparison shows that Administrate focuses on defining attribute types for admin dashboards, while Comfortable Mexican Sofa emphasizes content management and page structure.
The administration framework for Ruby on Rails applications.
Pros of Active Admin
- More comprehensive admin interface generation with less configuration
- Extensive customization options for views, forms, and actions
- Larger community and ecosystem with more plugins and extensions
Cons of Active Admin
- Steeper learning curve due to its DSL and extensive features
- Can be overkill for simpler projects or smaller admin needs
- Performance can be impacted with large datasets or complex configurations
Code Comparison
Active Admin:
ActiveAdmin.register Post do
permit_params :title, :body, :published_at
index do
selectable_column
column :title
column :published_at
actions
end
end
Comfortable Mexican Sofa:
ComfortableMexicanSofa::AccessControl::AdminAuthentication.class_eval do
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == 'username' && password == 'password'
end
end
end
Active Admin provides a more declarative approach to defining admin interfaces, while Comfortable Mexican Sofa focuses on content management and typically requires more custom code for admin functionality. Active Admin is better suited for complex admin needs, while Comfortable Mexican Sofa excels in content-focused applications with simpler admin requirements.
A platform to create, publish and edit sites
Pros of Locomotive CMS Engine
- More extensive theming and templating capabilities
- Better support for multi-site management
- More active development and community support
Cons of Locomotive CMS Engine
- Steeper learning curve for beginners
- Less straightforward integration with existing Rails applications
- Requires more server resources due to its comprehensive feature set
Code Comparison
Comfortable Mexican Sofa:
ComfortableMexicanSofa::AccessControl::AdminAuthentication.class_eval do
def authenticate
unless current_user.try(:admin?)
redirect_to main_app.root_path
end
end
end
Locomotive CMS Engine:
module Locomotive
class CustomAuthenticationGuard < Locomotive::Steam::AuthenticationGuard
def authenticate
if current_user.nil? || !current_user.admin?
redirect_to main_app.root_path
end
end
end
end
Both CMSs offer authentication mechanisms, but Locomotive CMS Engine provides more flexibility in customizing the authentication process. Comfortable Mexican Sofa's approach is simpler, while Locomotive CMS Engine allows for more complex authentication scenarios.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ComfortableMexicanSofa
ComfortableMexicanSofa is a powerful Ruby on Rails 5.2+ CMS (Content Management System) Engine
Features
- Simple drop-in integration with Rails 5.2+ apps with minimal configuration
- CMS stays away from the rest of your application
- Powerful page templating capability using Content Tags
- Multiple Sites from a single installation
- Multi-Language Support (i18n) (ca, cs, da, de, en, es, fi, fr, gr, hr, it, ja, nb, nl, pl, pt-BR, ru, sv, tr, uk, zh-CN, zh-TW) and page localization.
- CMS Seeds for initial content population
- Revision History to revert changes
- Extendable Admin Area built with Bootstrap 4 (responsive design). Using CodeMirror for HTML and Markdown highlighing and Redactor as the WYSIWYG editor.
Dependencies
- File attachments are handled by ActiveStorage. Make sure that you can run appropriate migrations by running:
rails active_storage:install
- Image resizing is done with with ImageMagick, so make sure it's installed.
- Pagination is handled by kaminari or will_paginate. Please add one of those to your Gemfile.
Installation
Add gem definition to your Gemfile:
gem "comfortable_mexican_sofa", "~> 2.0.0"
Then from the Rails project's root run:
bundle install
rails generate comfy:cms
rake db:migrate
Now take a look inside your config/routes.rb
file. You'll see where routes attach for the admin area and content serving. Make sure that content serving route appears as a very last item or it will make all other routes to be inaccessible.
comfy_route :cms_admin, path: "/admin"
comfy_route :cms, path: "/"
Quick Start Guide
After finishing installation you should be able to navigate to http://localhost:3000/admin
Default username and password is 'username' and 'password'. You probably want to change it right away. Admin credentials (among other things) can be found and changed in the cms initializer: /config/initializers/comfortable_mexican_sofa.rb
Before creating pages and populating them with content we need to create a Site. Site defines a hostname, content path and its language.
After creating a Site, you need to make a Layout. Layout is the template of your pages; it defines some reusable content (like header and footer, for example) and places where the content goes. A very simple layout can look like this:
<html>
<body>
<h1>{{ cms:text title }}</h1>
{{ cms:wysiwyg content }}
</body>
</html>
Once you have a layout, you may start creating pages and populating content. It's that easy.
Documentation
For more information on how to use this CMS please refer to the Wiki. Section that might be of interest is the entry on Content Tags.
Comfy Demo App also can be used as an example of a default Rails app with CMS installed.
Add-ons
If you want to add a Blog functionality to your app take a look at ComfyBlog.
Old Versions
CMS for Rails 5.1 doesn't have published gem, but you may use rails 5.1 branch directly.
If you want to use CMS version 1.12 on Rails 5.2 use 1.13 branch directly.
With Rails 4.2 and 5.0 use gem version 1.12.10
With Rails 3.0 use gem version 1.8.5
CHANGELOG is documented in Github releases.
Contributing
ComfortableMexicanSofa repository can be ran like a regular Rails application in development environment. It's as easy to work on as any other Rails app out there. For more detail take a look at CONTRIBUTING
Help and Contact
Gitter: https://gitter.im/comfy/comfortable-mexican-sofa
Twitter: @GroceryBagHead
Acknowledgements
Thanks to Roman Almeida for contributing OEM License for Redactor Text Editor
Copyright 2010-2019 Oleg Khabarov. Released under the MIT license
Top Related Projects
An open source eCommerce platform giving you full control and customizability. Modular and API-first. Build any eCommerce solution that your business requires. Developed by @vendo-dev
🛒 Solidus, the open-source eCommerce framework for industry trailblazers.
A Rails engine that helps you put together a super-flexible admin dashboard.
The administration framework for Ruby on Rails applications.
A platform to create, publish and edit sites
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot