Class: ShortcutPage

Inherits:
Page
  • Object
show all
Defined in:
app/models/shortcut_page.rb

Overview

Schema Information

Table name: pages

 id               :integer(4)      not null, primary key
 title            :string(255)
 parent_id        :integer(4)
 starttime        :datetime
 endtime          :datetime
 sorting          :integer(4)
            :boolean(1)      default(TRUE)
 hidden_in_menu   :boolean(1)      default(FALSE)
 subtitle         :string(255)
 navigation_title :string(255)
 description      :text
 abstract         :text
 author           :string(255)
 author_email     :string(255)
 target           :string(255)
 type             :string(255)     default("ContentPage")
 shortcut_page_id :integer(4)
 shortcut_mode    :string(255)     default("first_subpage")
 ext_url          :string(255)
 created_by       :integer(4)
 created_at       :datetime
 updated_at       :datetime
 deleted_at       :datetime
 ancestry         :string(255)
 template_id      :integer(4)
 tags             :string(255)
 url              :string(255)

available modes(shortcut_modes):

  • external url
  • internal page(via id)
  • first subpage
  • random subpage

Instance Method Summary

Methods inherited from Page

#absolute_url, #dummy_type, #dummy_type=, find_by_path, #icon, #is_leaf?, #link, #path, #text, #update_sorting

Instance Method Details

- (Object) edit_fields

the labels will be used as locale keys required attributes:

  • label
  • field_type
  • value

optional attributes:

  • options

available field types:

  • text_field
  • text_area

returns the input fields and labels, that should be displayed in the "settings" tab, as an hash



63
64
65
66
67
68
69
70
# File 'app/models/shortcut_page.rb', line 63

def edit_fields
  [ { :label => "shortcut_mode", :field_type => "select_box", 
      :value => { :options => { I18n.t('admin.pages.shortcut_page.external_page') => "external_page", I18n.t('admin.pages.shortcut_page.internal_page') => "internal_page", 
                                I18n.t('admin.pages.shortcut_page.first_subpage') => "first_subpage", I18n.t('admin.pages.shortcut_page.random_subpage') => "random_subpage"  } , 
      :selected => mode } },
    { :label => "ext_url", :field_type => "text_field", :value => ext_url },
    { :label => "shortcut_page_id", :field_type => "text_field", :value => shortcut_page_id }]
end

- (Object) mode

alias for shortcut_mode



48
49
50
# File 'app/models/shortcut_page.rb', line 48

def mode
  shortcut_mode
end