Skip to content

Commit

Permalink
Update the readme with the solidus_dev_support template
Browse files Browse the repository at this point in the history
  • Loading branch information
aldesantis committed Jun 5, 2020
1 parent 8ba75d1 commit 22a65e0
Showing 1 changed file with 79 additions and 65 deletions.
144 changes: 79 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,117 @@

[![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_static_content.svg?style=svg)](https://circleci.com/gh/solidusio-contrib/solidus_static_content)

A fork of the [Spree extension][1] for compatibility with [Solidus][7].
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 Spree. You can use this to:
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.
- 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.

## Basic Installation
## Installation

Add to your `Gemfile`:
Add solidus_static_content to your Gemfile:

```ruby
gem 'solidus_static_content'
```

Run:
Bundle your dependencies and run the installation generator:

```shell
bundle
bundle exec rails g solidus_static_content:install
```
$ bundle install
$ bin/rails generate solidus_static_content:install
```

That's all!
## Usage

Using the 'Pages' option in the admin tab, you can add static pages to your Spree install. The page
content can be pulled directly from the database, be a separate layout file or rendered as a
partial.

In the admin tab, use the 'New page' option to create a new static page.

## HowTo
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.

Using the 'Pages' option in the admin tab, you can add static pages to your
Spree install. The page content can be pulled directly from the database, be a
separate layout file or rendered as a partial.
Body text provided without a layout / partial being specified will be loaded in the
spree_application layout after it is pulled from the database.

In the admin tab, use the 'New page' option to create a new static page.
### Layout and partial rendering

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.
To render an entire page without the spree_application layout, specify a relative path to the
layout file (eg. `spree/layouts/layout_file_name`). This file will not be prefixed with an
underscore as it is a layout, not a partial.

Body text provided without a layout / partial being specified will be loaded in
the spree_application layout after it is pulled from the database.
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.

### Layout and Partial Rendering
### Options

To render an entire page without the spree_application layout, specify a
relative path to the layout file (eg. `spree/layouts/layout_file_name`). This
file will not be prefixed with an underscore as it is a layout, not a partial.
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.

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.
Finally, toggle the visibility using the 'Visible' checkbox. If it is unchecked, the page will not
be available.

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.
## Development

### Options
### 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
```

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.
When testing your application's integration with this extension you may use its factories.
Simply add this require statement to your spec_helper:

Finally, toggle the visibility using the 'Visible' checkbox. If it is unchecked,
the page will not be available.
```ruby
require 'solidus_static_content/factories'
```

## Running the sandbox

## Contributing
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`.

In the spirit of [free software][2], **everyone** is encouraged to help improve
this project.
Here's an example:

Here are some ways *you* can contribute:
```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
```

* by using prerelease versions
* by reporting [bugs][3]
* by suggesting new features
* by writing translations
* by writing or editing documentation
* by writing specifications
* by writing code (*no patch is too small*: fix typos, add comments, clean up inconsistent whitespace)
* by refactoring code
* by resolving [issues][3]
* by reviewing patches
### Releasing new versions

Starting point:
Your new extension version can be released using `gem-release` like this:

* Fork the repo
* Clone your repo
* Run `bin/setup`
* Make your changes
* Ensure specs pass by running `bin/rake`
* Submit your pull request
```shell
bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release
```

Copyright (c) 2014 [Peter Berkenbosch][4] and [contributors][5], released under the [New BSD License][6]
## License

[1]: https://github.com/spree-contrib/spree_static_content/
[2]: http://www.fsf.org/licensing/essays/free-sw.html
[3]: https://github.com/solidusio-contrib/solidus_static_content/issues
[4]: https://github.com/peterberkenbosch
[5]: https://github.com/solidusio-contrib/solidus_static_content/graphs/contributors
[6]: ./LICENSE.md
[7]: https://solidus.io/
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.

0 comments on commit 22a65e0

Please sign in to comment.