Fix menu_enabled_for
This commit is contained in:
parent
f2508e79cb
commit
36ddbf68e0
|
@ -43,7 +43,7 @@ class Admin::LinksController < Admin::ItemsController
|
||||||
m = {}
|
m = {}
|
||||||
m["public"] = link.is_published ? 1 : 0
|
m["public"] = link.is_published ? 1 : 0
|
||||||
m["link"] = @site_valid_locales.inject([]) do |result, locale|
|
m["link"] = @site_valid_locales.inject([]) do |result, locale|
|
||||||
result << [locale, (link.enabled_for && link.enabled_for.include?(locale)) ? 1 : 0, (link.menu_enabled_for && link.menu_enabled_for[locale]) ? 1 :0]
|
result << [locale, (link.enabled_for && link.enabled_for.include?(locale)) ? 1 : 0, (link.menu_enabled_for && link.menu_enabled_for[locale].eql?("true")) ? 1 :0]
|
||||||
end
|
end
|
||||||
render json: JSON.pretty_generate(m)
|
render json: JSON.pretty_generate(m)
|
||||||
rescue
|
rescue
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Admin::PagesController < Admin::ItemsController
|
||||||
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1]
|
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1]
|
||||||
m["public"] = page.is_published ? 1 : 0
|
m["public"] = page.is_published ? 1 : 0
|
||||||
m["link"] = @site_valid_locales.inject([]) do |link, locale|
|
m["link"] = @site_valid_locales.inject([]) do |link, locale|
|
||||||
link << [locale, (page.enabled_for && page.enabled_for.include?(locale)) ? 1 : 0, (page.menu_enabled_for && page.menu_enabled_for[locale]) ? 1 :0]
|
link << [locale, (page.enabled_for && page.enabled_for.include?(locale)) ? 1 : 0, (page.menu_enabled_for && page.menu_enabled_for[locale].eql?('true')) ? 1 :0]
|
||||||
end
|
end
|
||||||
m["count"] = page.frontend_data_count
|
m["count"] = page.frontend_data_count
|
||||||
render json: JSON.pretty_generate({design: design, module: m})
|
render json: JSON.pretty_generate({design: design, module: m})
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Item
|
||||||
a = []
|
a = []
|
||||||
if objects
|
if objects
|
||||||
objects.each do |object|
|
objects.each do |object|
|
||||||
a << object if object.menu_enabled_for.nil? ? true : object.menu_enabled_for.include?(I18n.locale.to_s)
|
a << object if object.menu_enabled_for.nil? ? true : object.menu_enabled_for[I18n.locale.to_s].eql?("true")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
a
|
a
|
||||||
|
|
Loading…
Reference in New Issue