Sha256: c21d76abb12df3620ebcc938d9b1d6810c4eff421901e85b206d991cc15aa105
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 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::ApplicationHelper 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_user context[:current_user] 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.16.1 | app/cells/decidim/pad_iframe_cell.rb |
decidim-core-0.16.0 | app/cells/decidim/pad_iframe_cell.rb |