Class: AhoyCaptain::SourceDecorator

Inherits:
ApplicationDecorator show all
Defined in:
app/decorators/ahoy_captain/source_decorator.rb

Instance Attribute Summary

Attributes inherited from ApplicationDecorator

#object

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationDecorator

#initialize, to_csv

Constructor Details

This class inherits a constructor from AhoyCaptain::ApplicationDecorator

Class Method Details

.csv_map(params = {}) ⇒ Object



3
4
5
6
7
8
# File 'app/decorators/ahoy_captain/source_decorator.rb', line 3

def self.csv_map(params = {})
  {
    "Domain" => :referring_domain,
    "Total" => :unit_amount
  }
end

Instance Method Details

#display_nameObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/decorators/ahoy_captain/source_decorator.rb', line 10

def display_name
  display = %Q(
    <div class='flex justify-start space-x-8 col-span-1 items-center'>
      <img class='transparent w-5 h-5'
        src='https://www.google.com/s2/favicons?domain=#{object.referring_domain}&sz=32'
      />
      <span>#{object.referring_domain}</span>
    </div>
  ).html_safe
  path = search_query(ref_domain_eq: object.referring_domain)
  frame_link(display, path)
end

#unit_amountObject



23
24
25
# File 'app/decorators/ahoy_captain/source_decorator.rb', line 23

def unit_amount
  object.count
end