Skip to content
Spree extension for administrable embedded content.
Branch: master
Clone or download
Pull request Compare This branch is 8 commits ahead of moneyspyder:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
db/migrate
gemfiles
lib
spec
.gitignore
.rspec
.rubocop.yml
.travis.yml
Appraisals
Gemfile
LICENSE
README.md
Rakefile
spree_snippets.gemspec

README.md

SpreeSnippets

Build Status

Admin configurable chunks of content that can be rendered in any view via the SnippetsHelper#render_text_snippet method.

Synopsis

Within a view:

<%= render_text_snippet('slug-name') %>

... or ...

<%= render_text_snippet(@snippet_object) %>

... or ...

<% snippet_id = 26 %>
<%= render_text_snippet(snippet_id) %>

Snippets Admin

  1. Login to the Administration Console
  2. Click on the Snippets link in the sidebar
  3. Click "New Snippet" to add a snippet

Settings


To enable exceptions on missing snippets, set:

Spree::Config.snippets_raise_on_missing = true

Installation

  1. Add this extension to your Gemfile with this line:
gem 'spree_snippets', github: 'stefansenk/spree_snippets'
  1. Install the gem using Bundler:
bundle install
  1. Copy & run migrations
bundle exec rails g spree_snippets:install
  1. Restart your server

If your server was running, restart it so that it can find the assets properly.

Testing

First bundle your dependencies, then run rake. 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 rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_snippets/factories'

Contributing

If you'd like to contribute, please take a look at the instructions for installing dependencies and crafting a good pull request.

Copyright (c) 2019 [name of extension creator], released under the New BSD License

You can’t perform that action at this time.