Sha256: 7ac2447ab8e620fe640a0ea7f00cdf32bff0692286dbcaf6c9ef272aadcae12f
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Decidim # This cell is used to render an iframe to embed an Etherpad from a # Paddable model. class PadIframeCell < Decidim::ViewModel include Decidim::Core::Engine.routes.url_helpers def show return unless current_user return unless paddable.pad_is_visible? return if blank_read_only_pad? render end def iframe_id "etherpad-#{paddable.id}" end def iframe_url @iframe_url ||= [base_iframe_url, "?", url_options].join end def url_options URI.encode_www_form( userName: current_user.nickname, showControls: true, showLineNumbers: true, lang: current_user.locale ) end def base_iframe_url return paddable.pad_public_url if paddable.pad_is_writable? paddable.pad_read_only_url end def paddable model end def current_organization current_user.organization end def blank_read_only_pad? paddable.pad_is_visible? && !paddable.pad_is_writable? && paddable.pad.text.blank? end end end
Version data entries
6 entries across 6 versions & 1 rubygems