parent
f36bcb8801
commit
17ac564fbb
|
@ -1,4 +1,4 @@
|
||||||
class Admin::SubRolesController < RolesController
|
class Admin::SubRolesController < Admin::RolesController
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Item
|
||||||
field :enabled_for, :type => Array, :default => nil
|
field :enabled_for, :type => Array, :default => nil
|
||||||
field :menu_enabled_for, :type => Array, :default => nil
|
field :menu_enabled_for, :type => Array, :default => nil
|
||||||
field :title, localize: true
|
field :title, localize: true
|
||||||
field :sitemap_enabled, :type => Hash
|
field :sitemap_enabled, :type => Hash, :default => {}
|
||||||
|
|
||||||
|
|
||||||
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
|
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
|
||||||
|
@ -57,7 +57,7 @@ class Item
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_in_sitemap_for(locale)
|
def show_in_sitemap_for(locale)
|
||||||
if sitemap_enabled && !sitemap_enabled[locale].blank?
|
if !sitemap_enabled.blank? && !sitemap_enabled[locale].blank?
|
||||||
sitemap_enabled[locale].eql?('true') ? true : false
|
sitemap_enabled[locale].eql?('true') ? true : false
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
|
|
@ -307,7 +307,7 @@ namespace :migrate do
|
||||||
|
|
||||||
task :sitemap_i18n => :environment do
|
task :sitemap_i18n => :environment do
|
||||||
Item.all.each do |item|
|
Item.all.each do |item|
|
||||||
item.sitemap_enabled = item.sitemap_enabled ? {'en' => 'true', 'zh_tw' => 'true'} : nil
|
item.sitemap_enabled = item.sitemap_enabled ? {'en' => 'true', 'zh_tw' => 'true'} : {}
|
||||||
item.save
|
item.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue