Sha256: a09e037b4e467689a8fc1224eec88529310362879ba94133f3722a1e64ac7855

Contents?: true

Size: 1 KB

Versions: 24

Compression:

Stored size: 1 KB

Contents

# frozen-string_literal: true

module Decidim
  module Meetings
    # This module is used to be included in events triggered by comments.
    #
    module MeetingEvent
      extend ActiveSupport::Concern
      include Decidim::Events::MachineTranslatedEvent

      included do
        def resource_text
          translated_attribute(resource.description)
        end

        def translatable_resource
          resource
        end

        def translatable_text
          resource.description
        end

        def safe_resource_text
          locale = resource.respond_to?(:content_original_language) ? resource.content_original_language : I18n.locale
          I18n.with_locale(locale) { translated_attribute(resource.description).to_s.html_safe }
        end

        def safe_resource_translated_text
          return safe_resource_text unless perform_translation?

          I18n.with_locale(I18n.locale) { translated_attribute(resource.description, nil, true).to_s.html_safe }
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.8 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.7 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.6 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.10 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.9 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.5 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.8 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.4 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.3 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.7 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.5 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.2 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.1 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.4 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.0 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.3 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.0.rc2 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.27.0.rc1 app/events/decidim/meetings/meeting_event.rb
decidim-meetings-0.26.2 app/events/decidim/meetings/meeting_event.rb