Add menu_enabled_for: the page can be shown even if there's no link in the menu
This commit is contained in:
1 parent
8b61314cc4
commit
8a3f0b9bdc
4 files changed
+12
-1
No files matched your search
+2
-1
@@ -8,6 +8,7 @@ class Item
|
||||
field :position, :type => Integer
|
||||
field :is_published, :type => Boolean, :default => false, :index => true
|
||||
field :enabled_for, :type => Array, :default => nil
|
||||
field :menu_enabled_for, :type => Array, :default => nil
|
||||
|
||||
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
|
||||
validates :name, :exclusion => { :in => LIST[:forbidden_item_names] }
|
||||
@@ -46,7 +47,7 @@ class Item
|
||||
a = []
|
||||
if objects
|
||||
objects.each do |object|
|
||||
a << object if object.enabled_for.nil? ? true : object.enabled_for.include?(I18n.locale.to_s)
|
||||
a << object if object.menu_enabled_for.nil? ? true : object.menu_enabled_for.include?(I18n.locale.to_s)
|
||||
end
|
||||
end
|
||||
a
|
||||
|
||||
Reference in new issue
Block a user