Class: Decidim::AddressCell

Inherits:
ViewModel
  • Object
show all
Includes:
Cell::ViewModel::Partial
Defined in:
app/cells/decidim/address_cell.rb

Overview

This cell renders the address of a meeting.

Instance Method Summary collapse

Instance Method Details

#addressObject



32
33
34
# File 'app/cells/decidim/address_cell.rb', line 32

def address
  decidim_sanitize_translated(model.address) if model.respond_to?(:address) && model.address.present?
end

#display_online_meeting_url?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
61
# File 'app/cells/decidim/address_cell.rb', line 56

def display_online_meeting_url?
  return true unless model.respond_to?(:online?)
  return true unless model.respond_to?(:iframe_access_level_allowed_for_user?)

  model.online? && model.iframe_access_level_allowed_for_user?(current_user)
end

#display_start_and_end_time?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/cells/decidim/address_cell.rb', line 40

def display_start_and_end_time?
  model.respond_to?(:start_time) && model.respond_to?(:end_time)
end

#has_location?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/cells/decidim/address_cell.rb', line 14

def has_location?
  model.respond_to?(:location)
end

#has_location_hints?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/cells/decidim/address_cell.rb', line 18

def has_location_hints?
  model.respond_to?(:location_hints)
end

#locationObject



26
27
28
29
30
# File 'app/cells/decidim/address_cell.rb', line 26

def location
  return pending_location_text if model.respond_to?(:pending_location?) && model.pending_location?

  decidim_sanitize_translated(model.location)
end

#location_hintsObject



22
23
24
# File 'app/cells/decidim/address_cell.rb', line 22

def location_hints
  decidim_sanitize_translated(model.location_hints)
end

#online_meeting_urlObject



52
53
54
# File 'app/cells/decidim/address_cell.rb', line 52

def online_meeting_url
  URI::Parser.new.escape(model.online_meeting_url)
end

#pending_location_textObject



36
37
38
# File 'app/cells/decidim/address_cell.rb', line 36

def pending_location_text
  t("show.pending_address", scope: "decidim.meetings.meetings")
end

#showObject



8
9
10
11
12
# File 'app/cells/decidim/address_cell.rb', line 8

def show
  return render :online if options[:online]

  render
end

#start_and_end_timeObject



44
45
46
47
48
49
50
# File 'app/cells/decidim/address_cell.rb', line 44

def start_and_end_time
  <<~HTML
    #{with_tooltip(l(model.start_time, format: :tooltip)) { start_time }}
    -
    #{with_tooltip(l(model.end_time, format: :tooltip)) { end_time }}
  HTML
end