Sha256: 5c2cb8d088cd268a131b45cd2bc200d109f084a6bf79b5d5356485353cd21887

Contents?: true

Size: 864 Bytes

Versions: 43

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # Custom helpers used in meetings views
    module MeetingsHelper
      include Decidim::ApplicationHelper
      include Decidim::TranslationsHelper
      include Decidim::ResourceHelper

      # Public: truncates the meeting description
      #
      # meeting - a Decidim::Meeting instance
      # max_length - a number to limit the length of the description
      #
      # Returns the meeting's description truncated.
      def meeting_description(meeting, max_length = 120)
        link = resource_locator(meeting).path
        description = translated_attribute(meeting.description)
        tail = "... #{link_to(t("read_more", scope: "decidim.meetings"), link)}".html_safe
        CGI.unescapeHTML html_truncate(description, max_length: max_length, tail: tail)
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
decidim-meetings-0.11.2 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.11.1 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.11.0.pre1 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.10.1 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.10.0 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.9.3 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.9.2 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.9.1 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.9.0 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.8.4 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.8.3 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.8.2 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.8.1 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.8.0 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.7.4 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.7.3 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.7.2 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.7.1 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.7.0 app/helpers/decidim/meetings/meetings_helper.rb
decidim-meetings-0.6.8 app/helpers/decidim/meetings/meetings_helper.rb