Class: Decidim::AddressCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::AddressCell
- 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
- #address ⇒ Object
- #display_online_meeting_url? ⇒ Boolean
- #display_start_and_end_time? ⇒ Boolean
- #has_location? ⇒ Boolean
- #has_location_hints? ⇒ Boolean
- #location ⇒ Object
- #location_hints ⇒ Object
- #online_meeting_url ⇒ Object
- #pending_location_text ⇒ Object
- #show ⇒ Object
- #start_and_end_time ⇒ Object
Instance Method Details
#address ⇒ Object
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
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
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
14 15 16 |
# File 'app/cells/decidim/address_cell.rb', line 14 def has_location? model.respond_to?(:location) end |
#has_location_hints? ⇒ Boolean
18 19 20 |
# File 'app/cells/decidim/address_cell.rb', line 18 def has_location_hints? model.respond_to?(:location_hints) end |
#location ⇒ Object
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_hints ⇒ Object
22 23 24 |
# File 'app/cells/decidim/address_cell.rb', line 22 def location_hints decidim_sanitize_translated(model.location_hints) end |
#online_meeting_url ⇒ Object
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_text ⇒ Object
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 |
#show ⇒ Object
8 9 10 11 12 |
# File 'app/cells/decidim/address_cell.rb', line 8 def show return render :online if [:online] render end |
#start_and_end_time ⇒ Object
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 |