ComfyArchive is a management engine for chronologically & categorically archived sections for Comfortable Mexican Sofa 2.x. You can select one or more Comfortable Mexican Sofa pages to act as an index for child pages, which will then be organized both cronologically, by year and month, and by category.
Make sure that you have ComfortableMexicanSofa installed first.
-
Add gem definition to your Gemfile:
gem "comfy_archive", "~> 0.3.0"
-
From your Rails project's root run:
bundle install rails generate comfy:archive rake db:migrate
-
Add the following lines to your
config/routes.rbfile, after the "comfy_route :cms_admin" line and before the "comfy_route :cms" line:comfy_route :archive_admin comfy_route :archive
-
You should also find view templates in your
/app/views/comfy/archivefolder. Feel free to adjust them as you see fit
-
Add a
datetimetag to the layout used by any page which will be ordered chronologically under an index page, then set the field to a valid date & time in the pages themselves -
Add a new Archive Index, selecting the parent page (Important: can not be the root page!) which will act as an index for child pages and enter the name of the
datetimetag you created in Step 1 -
Optionally, create a
config/initializers/comfy_archive.rbfile to override default configuration options
ComfyArchive: Rails Engine which manages configuration, adds scopes & associations toComfy::Cms::Site&Comfy::Cms::Pagemodels, and adds route matching methodsComfy::ArchiveHelper: Helper methods for generating links to chronological & category archive pagesComfy::Archive::Index: A model which represents pages which will become chronological archive pages, it has aComfy::Cms::Pageassociation and also the name of the page'sdatetimefragment to use for chronological orderingComfy::Admin::Archive::IndicesController: A Comfortable Mexican Sofa admin controller for managingComfy::Archive::IndexmodelsComfy::Archive::IndexController: A controller for renderingComfy::Archive::Indexpages, plus chronological & categorical archive pages
Copyright (c) 2019-2022 Discovery Map International, Inc.