Fix menu_enabled_for

This commit is contained in:
chris 2013-10-29 14:39:23 +08:00
parent f2508e79cb
commit 36ddbf68e0
3 changed files with 3 additions and 3 deletions

View File

@ -43,7 +43,7 @@ class Admin::LinksController < Admin::ItemsController
m = {}
m["public"] = link.is_published ? 1 : 0
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
render json: JSON.pretty_generate(m)
rescue

View File

@ -64,7 +64,7 @@ class Admin::PagesController < Admin::ItemsController
m["tags"] = page.tag.present? ? [0, page.tag.map{|c| c.to_s}] : [1]
m["public"] = page.is_published ? 1 : 0
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
m["count"] = page.frontend_data_count
render json: JSON.pretty_generate({design: design, module: m})

View File

@ -38,7 +38,7 @@ class Item
a = []
if objects
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
a