Sha256: 7cda640205e6c69297ae751ce1332cba060a0090bd71493eaac1c28eda79252f
Contents?: true
Size: 1.69 KB
Versions: 7
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true module Decidim module Meetings # # Decorator for meetings # class MeetingPresenter < SimpleDelegator include Decidim::TranslationsHelper include Decidim::ResourceHelper def meeting __getobj__ end def title(links: false, all_locales: false) return unless meeting handle_locales(meeting.title, all_locales) do |content| renderer = Decidim::ContentRenderers::HashtagRenderer.new(content) renderer.render(links: links).html_safe end end def description(links: false, all_locales: false) return unless meeting handle_locales(meeting.description, all_locales) do |content| renderer = Decidim::ContentRenderers::HashtagRenderer.new(content) renderer.render(links: links).html_safe end end # Next methods are used for present a Meeting As Proposal Author def name title end def nickname "" end def badge "" end def profile_path resource_locator(meeting).path end def avatar_url ActionController::Base.helpers.asset_path("decidim/meetings/icon.svg") end def deleted? false end def can_be_contacted? false end def has_tooltip? false end private def handle_locales(content, all_locales) if all_locales content.each_with_object({}) do |(locale, string), parsed_content| parsed_content[locale] = yield(string) end else yield(translated_attribute(content)) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems