Class: Goldencobra::Articletype

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/goldencobra/articletype.rb

Constant Summary collapse

ArticleFieldOptions =
[
  :global_sorting_id, :title, :subtitle, :content,
  :teaser, :summary, :tag_list, :frontend_tag_list, :active,
  :active_since, :context_info, :metatags, :metatag_title_tag,
  :metatag_meta_description, :metatag_open_graph_title,
  :metatag_open_graph_description, :metatag_open_graph_type,
  :metatag_open_graph_url, :metatag_open_graph_image, :breadcrumb,
  :url_name, :parent_id, :canonical_url, :enable_social_sharing,
  :robots_no_index, :cacheable, :commentable, :dynamic_redirection,
  :external_url_redirect, :redirect_link_title, :redirection_target_in_new_window,
  :author, :permissions, :widgets, :article_images, :index__display_index_articles,
  :index__article_for_index_id, :index__article_descendents_depth,
  :index__display_index_types, :index__display_index_articletypes,
  :index__index_of_articles_tagged_with, :index__not_tagged_with, :index__sorter_limit,
  :index__sort_order, :index__reverse_sort, :state, :creator
]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.reset_to_defaultObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/models/goldencobra/articletype.rb', line 36

def self.reset_to_default
  if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") &&
     ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
    Goldencobra::Article.article_types_for_select.each do |at|
      if Goldencobra::Articletype.find_by_name(at).blank?
        Goldencobra::Articletype.create(name: at, default_template_file: "application")
      end
    end

    if ActiveRecord::Base.connection.table_exists?("goldencobra_articletype_groups")
      Goldencobra::Articletype.all.each do |at|
        # Install basic set of fieldgroups and fields if none are set up
        reset_field_blocks_for(at)
      end
    end
  end
end

Instance Method Details

#set_defaultsObject



32
33
34
# File 'app/models/goldencobra/articletype.rb', line 32

def set_defaults
  Goldencobra::Articletype.reset_to_default
end