Add documents (merges foodcoops/foodsoft#353)
This commit is contained in:
parent
33c9b23e2f
commit
8bb58c5519
18 changed files with 310 additions and 0 deletions
9
plugins/documents/lib/foodsoft_documents.rb
Normal file
9
plugins/documents/lib/foodsoft_documents.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
require 'foodsoft_documents/engine'
|
||||
|
||||
module FoodsoftDocuments
|
||||
# Return whether the documents are used or not.
|
||||
# Enabled by default in {FoodsoftConfig} since it used to be part of the foodsoft core.
|
||||
def self.enabled?
|
||||
FoodsoftConfig[:use_documents]
|
||||
end
|
||||
end
|
||||
15
plugins/documents/lib/foodsoft_documents/engine.rb
Normal file
15
plugins/documents/lib/foodsoft_documents/engine.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module FoodsoftDocuments
|
||||
class Engine < ::Rails::Engine
|
||||
def navigation(primary, context)
|
||||
return unless FoodsoftDocuments.enabled?
|
||||
return if primary[:foodcoop].nil?
|
||||
sub_nav = primary[:foodcoop].sub_navigation
|
||||
sub_nav.items <<
|
||||
SimpleNavigation::Item.new(primary, :documents, I18n.t('navigation.documents'), context.documents_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
|
||||
end
|
||||
end
|
||||
3
plugins/documents/lib/foodsoft_documents/version.rb
Normal file
3
plugins/documents/lib/foodsoft_documents/version.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module FoodsoftDocuments
|
||||
VERSION = "0.0.1"
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue