Move plugins to separate directory.
This commit is contained in:
parent
6e990fed4c
commit
6aa8ee7968
59 changed files with 4 additions and 4 deletions
19
plugins/messages/lib/foodsoft_messages/engine.rb
Normal file
19
plugins/messages/lib/foodsoft_messages/engine.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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 <<
|
||||
SimpleNavigation::Item.new(primary, :messages, I18n.t('navigation.messages'), context.messages_path)
|
||||
# move to right before tasks item
|
||||
if i = sub_nav.items.index(sub_nav[:tasks])
|
||||
sub_nav.items.insert(i, sub_nav.items.delete_at(-1))
|
||||
end
|
||||
end
|
||||
|
||||
def default_foodsoft_config(cfg)
|
||||
cfg[:use_messages] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
26
plugins/messages/lib/foodsoft_messages/user_link.rb
Normal file
26
plugins/messages/lib/foodsoft_messages/user_link.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
module FoodsoftMessages
|
||||
|
||||
module UserLink
|
||||
def self.included(base) # :nodoc:
|
||||
base.class_eval do
|
||||
|
||||
# modify user presentation link to writing a message for the user
|
||||
def show_user_link(user=@current_user)
|
||||
if user.nil? or not FoodsoftMessages.enabled?
|
||||
show_user user
|
||||
else
|
||||
link_to show_user(user), new_message_path('message[mail_to]' => user.id),
|
||||
:title => I18n.t('helpers.messages.write_message')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# modify existing helper
|
||||
ActiveSupport.on_load(:after_initialize) do
|
||||
ApplicationHelper.send :include, FoodsoftMessages::UserLink
|
||||
end
|
||||
3
plugins/messages/lib/foodsoft_messages/version.rb
Normal file
3
plugins/messages/lib/foodsoft_messages/version.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module FoodsoftMessages
|
||||
VERSION = "0.0.1"
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue