Sha256: 74d56855c472de371cbc4fc341334bce3d27a43777519c90b206695d58dcd342

Contents?: true

Size: 752 Bytes

Versions: 14

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    class AssemblyPresenter < SimpleDelegator
      include Rails.application.routes.mounted_helpers
      include ActionView::Helpers::UrlHelper

      delegate :url, to: :hero_image, prefix: true
      delegate :url, to: :banner_image, prefix: true

      def hero_image_url
        return if assembly.hero_image.blank?

        URI.join(decidim.root_url(host: assembly.organization.host), assembly.hero_image_url).to_s
      end

      def banner_image_url
        return if assembly.banner_image.blank?

        URI.join(decidim.root_url(host: assembly.organization.host), assembly.banner_image_url).to_s
      end

      def assembly
        __getobj__
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-assemblies-0.24.3 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.6 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.24.2 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.5 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.24.1 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.24.0 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.24.0.rc2 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.4 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.24.0.rc1 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.3 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.2 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.1 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.1.rc1 app/presenters/decidim/assemblies/assembly_presenter.rb
decidim-assemblies-0.23.0 app/presenters/decidim/assemblies/assembly_presenter.rb