Class: SAFT::V2::HTML::CompanyCard

Inherits:
Object
  • Object
show all
Defined in:
lib/saft/v2/html.rb

Instance Method Summary collapse

Constructor Details

#initialize(company) ⇒ CompanyCard

Returns a new instance of CompanyCard.



278
279
280
# File 'lib/saft/v2/html.rb', line 278

def initialize(company)
  @company = company
end

Instance Method Details

#to_tubbyObject



282
283
284
285
286
287
288
289
290
291
292
# File 'lib/saft/v2/html.rb', line 282

def to_tubby
  Tubby.new { |t|
    t.div(class: "min-w-[20rem] max-w-[20rem] mr-8 mb-2") {
      t.div(class: "pl-2 border-l-2") {
        t.span("Supplier", class: "font-semibold") if @company.is_a?(Types::Supplier)
        t.span("Customer", class: "font-semibold") if @company.is_a?(Types::Customer)
        t << RenderHash.new(@company.attributes)
      }
    }
  }
end