module Hancock::Seo::Models::SitemapData

Constants

SITEMAP_CHANGEFREQ_ARRAY

Public Class Methods

admin_cannot_add_actions() click to toggle source

def self.admin_can_default_actions

[:show, :read, :edit, :update].freeze

end def self.manager_can_default_actions

[:show, :read, :edit, :update].freeze

end

# File lib/hancock/seo/models/sitemap_data.rb, line 42
def self.admin_cannot_add_actions
  [:new, :create].freeze
end
clear_empty_objects() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 66
def self.clear_empty_objects
  Hancock::Seo::SitemapData.where(:id.in => with_empty_objects).delete_all
end
goto_hancock() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 24
def self.goto_hancock
  self.where(sitemap_data_field_type: /^Enjoy/).all.map { |s|
    unless s.sitemap_data_field.blank?
      s.sitemap_data_field_type = s.sitemap_data_field_type.sub("Enjoy", "Hancock");
      s.sitemap_data_field_type = "Hancock::Pages::Page" if s.sitemap_data_field_type == "Hancock::Page"
      s.sitemap_data_field_type = "Hancock::Catalog::Category" if s.sitemap_data_field_type == "Hancock::Catalog::ItemCategory"
      s.sitemap_data_field_type = "Hancock::News::Category" if s.sitemap_data_field_type == "Hancock::News::NewsCategory"
    end
    s.save
  }
end
manager_can_add_actions() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 49
def self.manager_can_add_actions
  ret = [:sitemap_for_model]
  # ret += [:multiple_file_upload, :sort_embedded] if Hancock::Seo.mongoid?
  ret << :model_settings if Hancock::Seo.config.model_settings_support
  # ret << :model_accesses if Hancock::Seo.config.user_abilities_support
  ret += [:comments, :model_comments] if Hancock::Seo.config.ra_comments_support
  ret.freeze
end
manager_cannot_add_actions() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 45
def self.manager_cannot_add_actions
  [:new, :create].freeze
end
rails_admin_add_visible_actions() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 57
def self.rails_admin_add_visible_actions
  ret = [:sitemap_for_model]
  # ret += [:multiple_file_upload, :sort_embedded] if Hancock::Seo.mongoid?
  ret << :model_settings if Hancock::Seo.config.model_settings_support
  ret << :model_accesses if Hancock::Seo.config.user_abilities_support
  ret += [:comments, :model_comments] if Hancock::Seo.config.ra_comments_support
  ret.freeze
end
rails_admin_name() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 20
def self.rails_admin_name
  self.name.gsub("::", "~").underscore
end
with_empty_objects() click to toggle source
# File lib/hancock/seo/models/sitemap_data.rb, line 70
def self.with_empty_objects
  Hancock::Seo::SitemapData.all.select { |s|
    !s.sitemap_data_field.nil? rescue true
  }.map(&:id)
end