Class: Pageflow::InternalLinks::PageLink

Inherits:
Struct
  • Object
show all
Defined in:
app/helpers/pageflow/internal_links/page_links.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#custom_thumbnail_image_idObject

Returns the value of attribute custom_thumbnail_image_id

Returns:

  • (Object)

    the current value of custom_thumbnail_image_id



48
49
50
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 48

def custom_thumbnail_image_id
  @custom_thumbnail_image_id
end

#optional_descriptionObject

Returns the value of attribute optional_description

Returns:

  • (Object)

    the current value of optional_description



48
49
50
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 48

def optional_description
  @optional_description
end

#page_transitionObject

Returns the value of attribute page_transition

Returns:

  • (Object)

    the current value of page_transition



48
49
50
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 48

def page_transition
  @page_transition
end

#positionObject

Returns the value of attribute position

Returns:

  • (Object)

    the current value of position



48
49
50
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 48

def position
  @position
end

#target_pageObject

Returns the value of attribute target_page.



55
56
57
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 55

def target_page
  @target_page
end

#target_page_idObject

Returns the value of attribute target_page_id

Returns:

  • (Object)

    the current value of target_page_id



48
49
50
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 48

def target_page_id
  @target_page_id
end

#templateObject

Returns the value of attribute template

Returns:

  • (Object)

    the current value of template



48
49
50
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 48

def template
  @template
end

Class Method Details

.nullObject



85
86
87
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 85

def self.null
  new(nil, nil, nil, nil)
end

Instance Method Details

#css_classObject



70
71
72
73
74
75
76
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 70

def css_class
  [
    'page_link',
    custom_thumbnail_file ? 'custom_thumbnail' : 'no_custom_thumbnail',
    optional_description.present? ? 'own_description' : 'no_own_description'
  ].compact.join(' ')
end

#data_attributesObject



78
79
80
81
82
83
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 78

def data_attributes
  {}.tap do |result|
    result[:page] = target_page.perma_id if target_page
    result[:page_transition] = page_transition if page_transition.present?
  end
end

#descriptionObject



61
62
63
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 61

def description
  optional_description.presence || target_page_description
end

#thumbnail_fileObject



65
66
67
68
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 65

def thumbnail_file
  custom_thumbnail_file ||
    (target_page && template.page_thumbnail_file(target_page))
end

#titleObject



57
58
59
# File 'app/helpers/pageflow/internal_links/page_links.rb', line 57

def title
  target_page ? target_page.configuration['title'] : ''
end