Class: SlotDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/slot_decorator.rb

Direct Known Subclasses

BookingDecorator, FreeSlotDecorator

Instance Method Summary (collapse)

Instance Method Details

- (Object) classes



4
5
6
# File 'app/decorators/slot_decorator.rb', line 4

def classes
  "slot #{ color.slug }"
end

- (Object) href



12
13
14
15
16
17
18
19
# File 'app/decorators/slot_decorator.rb', line 12

def href
  case context.fetch(:current_user)
  when Provider
    h.edit_free_slot_path self
  when Customer
    h.new_booking_path booking: { free_slot_id: id }
  end
end

- (Object) style



8
9
10
# File 'app/decorators/slot_decorator.rb', line 8

def style
  "left: #{ left }px; top: #{ top }px; width: #{ width }px; height: #{ height }px;"
end