Sha256: afd994605f252b05decd91e1aec39521ad0206f2752d7aa34d7fe219627a8ce5
Contents?: true
Size: 632 Bytes
Versions: 13
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true module Decidim module Blogs # Custom helpers used in posts views module PostsHelper include Decidim::ApplicationHelper include Decidim::TranslationsHelper include Decidim::ResourceHelper # Public: truncates the post body # # post - a Decidim::Blog instance # max_length - a number to limit the length of the body # # Returns the post's body truncated. def post_description(post, max_length = 300) body = translated_attribute(post.body) CGI.unescapeHTML html_truncate(body, max_length:) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems