https://github.com/solidusio-contrib/solidus_static_content
:page_facing_up: Content management for your Solidus store.
https://github.com/solidusio-contrib/solidus_static_content
cms content content-management extension solidus static
Last synced: about 1 year ago
JSON representation
:page_facing_up: Content management for your Solidus store.
- Host: GitHub
- URL: https://github.com/solidusio-contrib/solidus_static_content
- Owner: solidusio-contrib
- License: bsd-3-clause
- Created: 2016-07-29T17:29:52.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-04-01T18:42:50.000Z (about 1 year ago)
- Last Synced: 2025-04-02T10:14:32.289Z (about 1 year ago)
- Topics: cms, content, content-management, extension, solidus, static
- Language: Ruby
- Homepage:
- Size: 675 KB
- Stars: 22
- Watchers: 12
- Forks: 43
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Solidus Static Content
[](https://circleci.com/gh/solidusio-contrib/solidus_static_content)
A fork of the [Spree extension](https://github.com/spree-contrib/spree_static_content) for
compatibility with [Solidus](https://solidus.io).
Good, clean content management of pages for Solidus. You can use it to:
- Add and manage static pages such as an About page.
- Show a static page instead of existing dynamic pages such as the home page, products pages, and
taxon pages.
## Installation
Add solidus_static_content to your Gemfile:
### Starter Frontend
Bundle your dependencies and run the installation generator:
```shell
bundle
bin/rails generate solidus_static_content:install --frontend=starter
```
Please, be aware that the installation only works with the default
implementation of the starter frontend. Any customization to the files that
will be modified by the installer might break the installation procedure.
If that happens, try to adapt the installed code on top of the customizations
of the store.
### Legacy Frontend
If you are using the legacy `solidus_frontend` gem, please run this command instead:
```shell
bin/rails generate solidus_static_content:install
```
## Usage
Using the 'Pages' option in the admin tab, you can add static pages to your Solidus store. The page
content can be pulled directly from the database, be a separate layout file or be rendered as a
partial.
In the admin tab, use the 'New page' option to create a new static page.
The title, slug, body, and meta fields will replace their respective page elements on load. The
title, slug and body element are all required fields.
Body text provided without a layout/partial being specified will be loaded in the
`spree_application` layout after it is pulled from the database.
### Layout and partial rendering
To render an entire page without the `spree_application` layout, specify a relative path to the
layout file (e.g. `spree/layouts/layout_file_name`). Note that the name of this file will not be
prefixed with an underscore as it is a layout, not a partial.
To render a partial, specify the path in the layout file name and check the 'Render layout as
partial' option. The path specified in the layout area will not have an underscore, but it will be
required in the filename.
Also note the availability of the `render_snippet` helper which finds a page by its slug and renders
the raw page body anywhere in your view.
### Options
Use the 'Show in' checkboxes to specify whether to display the page links in the header, footer or
sidebar. The position setting alters the order in which they appear.
Finally, toggle the visibility using the 'Visible' checkbox. If it is unchecked, the page will not
be available.
## Development
### Testing the extension
First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
app if it does not exist, then it will run specs. The dummy app can be regenerated by using
`bin/rake extension:test_app`.
```shell
bundle
bin/rake
```
To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
```shell
bundle exec rubocop
```
When testing your application's integration with this extension you may use its factories.
Simply add this require statement to your spec_helper:
```ruby
require 'solidus_static_content/factories'
```
### Running the sandbox
To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
`sandbox/bin/rails`.
Here's an example:
```shell
$ bin/rails server
=> Booting Puma
=> Rails 6.0.2.1 application starting in development
* Listening on tcp://127.0.0.1:3000
Use Ctrl-C to stop
```
### Releasing new versions
Your new extension version can be released using `gem-release` like this:
```shell
bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release
```
## License
Copyright (c) 2014 [Peter Berkenbosch](https://github.com/peterberkenbosch) and
[contributors](https://github.com/solidusio-contrib/solidus_static_content/graphs/contributors),
released under the New BSD License.