enable/disable plugins by config option
This commit is contained in:
parent
6d98be6d22
commit
64bb8e043d
21 changed files with 65 additions and 15 deletions
|
|
@ -3,4 +3,9 @@ require "foodsoft_messages/user_link"
|
|||
require "deface"
|
||||
|
||||
module FoodsoftMessages
|
||||
# Return whether messages are used or not.
|
||||
# Enabled by default since it used to be part of the foodsoft core.
|
||||
def self.enabled?
|
||||
FoodsoftConfig[:use_messages] != false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
module FoodsoftMessages
|
||||
class Engine < ::Rails::Engine
|
||||
def navigation(primary, context)
|
||||
return unless FoodsoftMessages.enabled?
|
||||
return if primary[:foodcoop].nil?
|
||||
sub_nav = primary[:foodcoop].sub_navigation
|
||||
sub_nav.items <<
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ module FoodsoftMessages
|
|||
|
||||
# modify user presentation link to writing a message for the user
|
||||
def show_user_link(user=@current_user)
|
||||
if user.nil?
|
||||
if user.nil? or not FoodsoftMessages.enabled?
|
||||
show_user user
|
||||
else
|
||||
link_to show_user(user), new_message_path('message[mail_to]' => user.id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue