Class: GraphStarter::AssetPresenter

Inherits:
ApplicationPresenter show all
Defined in:
app/presenters/graph_starter/asset_presenter.rb

Instance Method Summary collapse

Methods inherited from ApplicationPresenter

#h, #initialize

Constructor Details

This class inherits a constructor from GraphStarter::ApplicationPresenter

Instance Method Details

#assetObject



3
4
5
# File 'app/presenters/graph_starter/asset_presenter.rb', line 3

def asset
  @object
end

#display_column_widthsObject



7
8
9
10
11
12
13
# File 'app/presenters/graph_starter/asset_presenter.rb', line 7

def display_column_widths
  if main_column_exists?
    left_sidebar_exists? ? %w(three ten three) : [nil, 'thirteen', 'three']
  else
    ['eight', nil, 'eight']
  end
end

Returns:

  • (Boolean)


15
16
17
# File 'app/presenters/graph_starter/asset_presenter.rb', line 15

def left_sidebar_exists?
  @left_sidebar_exists ||= asset.class.authorized_associations.size > 2
end

#main_column_exists?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/presenters/graph_starter/asset_presenter.rb', line 19

def main_column_exists?
  @main_column_exists ||= asset.class.has_images? && asset.images.present? || asset.body.present?
end