enable/disable plugins by config option
This commit is contained in:
parent
6d98be6d22
commit
64bb8e043d
21 changed files with 65 additions and 15 deletions
|
|
@ -14,5 +14,8 @@ gem 'acts_as_versioned', git: 'git://github.com/technoweenie/acts_as_versioned.g
|
|||
gem 'foodsoft_wiki', path: 'lib/foodsoft_wiki'
|
||||
```
|
||||
|
||||
This plugin introduces the foodcoop config option `use_wiki`, which can be set
|
||||
to `false` to disable the wiki. May be useful in multicoop deployments.
|
||||
|
||||
This plugin is part of the foodsoft package and uses the GPL-3 license (see
|
||||
foodsoft's LICENSE for the full license text).
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# encoding: utf-8
|
||||
class PagesController < ApplicationController
|
||||
before_filter -> { require_plugin_enabled FoodsoftWiki }
|
||||
|
||||
skip_before_filter :authenticate, :only => :all
|
||||
before_filter :only => :all do
|
||||
|
|
|
|||
|
|
@ -5,4 +5,9 @@ require 'content_for_in_controllers'
|
|||
require 'foodsoft_wiki/engine'
|
||||
|
||||
module FoodsoftWiki
|
||||
# Return whether the wiki is used or not.
|
||||
# Enabled by default since it used to be part of the foodsoft core.
|
||||
def self.enabled?
|
||||
FoodsoftConfig[:use_wiki] != false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
module FoodsoftWiki
|
||||
class Engine < ::Rails::Engine
|
||||
def navigation(primary, ctx)
|
||||
return unless FoodsoftWiki.enabled?
|
||||
primary.item :wiki, I18n.t('navigation.wiki.title'), '#', id: nil do |subnav|
|
||||
subnav.item :wiki_home, I18n.t('navigation.wiki.home'), ctx.wiki_path, id: nil
|
||||
subnav.item :all_pages, I18n.t('navigation.wiki.all_pages'), ctx.all_pages_path, id: nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue