theam / spree_hideable_taxons

Spree extension to hide taxons from menus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SpreeHideableTaxons

This extension adds a hidden field to Spree::Taxon and hides taxons with hidden == true from the default menus. It also shows an additional "Hidden" checkbox in the admin panel.

This is a reimplementation of the great work done by @markalinn updated for Spree 3.1+

Installation

  1. Add this extension to your Gemfile with this line:
gem 'spree_hideable_taxons', github: 'theam/spree_hideable_taxons', branch: 'X-Y-stable'

(Replace X-Y-stable with the version of Spree you're using)

  1. Install the gem using Bundler:
bundle install
  1. Copy & run migrations
bundle exec rails g spree_hideable_taxons:install
  1. Restart your server

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

TODO

  • Add tests for:
    • Check that the admin controller saves the hidden field
    • Check that a taxonomy is not shown when its root taxon is hidden
    • Check that a taxon is not shown when it's hidden
  • Current implementation extends the Spree::FrontendHelper module, which is not the best for extensibility. I think that helper should be transformed in a partial in Spree so it can be extended via Deface.
  • Check compatibility with Spree 3.2.0+

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_hideable_taxons/factories'

Contributing

Follow the classical "Thanks for being awesome methodology": Fork, improve and send your pull requests!

Copyright (c) 2017 The Agile Monkeys, released under the New BSD License

About

Spree extension to hide taxons from menus

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Ruby 94.2%Language:CSS 2.9%Language:JavaScript 2.9%