Skip to content

public-market/spree_pages

Repository files navigation

Abundance Labds

Spree Pages

Build Status Maintainability Test Coverage

Simplified version of spree_static_pages without localisation overhead

Installation

  1. Add this extension to your Gemfile with this line:

    gem 'spree_pages', github: 'public-market/spree_pages'
  2. Install the gem using Bundler:

    bundle install
  3. Copy & run migrations

    bundle exec rails g spree_pages:install
  4. Restart your server

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

Adding WYSIWYG (example: ckeditor)

  1. Install ckeditor:

    https://github.com/galetahub/ckeditor#installation

  2. Add ckeditor to js:

    In our case it's vendor/assets/javascripts/spree/backend/all.js

    Add this line before //= require_tree .

    //= require ckeditor/init
  3. Add ckeditor to necessary fields in forms:

    Create new js file ckeditorInit.js in vendor/assets/javascripts/spree/backend

    $(function() {
      var editableIds = ['page_content']
      editableIds.forEach(function(id) {
        if ($("#" + id).length) {
          CKEDITOR.replace(id);
        }
      })
    });

    This script will add ckeditor to all fields with ids from editableIds array. In this case it's page_content

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

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) 2018 Abundance Labs, Inc., released under the New BSD License