Sha256: 1c6e046df10b3cbd16154e801b2475934a9cf2c197e63af702a5d0bc2abbe008
Contents?: true
Size: 780 Bytes
Versions: 75
Compression:
Stored size: 780 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 = 600) link = post_path(post) body = translated_attribute(post.body) tail = "... <br/> #{link_to(t("read_more", scope: "decidim.blogs"), link)}".html_safe CGI.unescapeHTML html_truncate(body, max_length: max_length, tail: tail) end end end end
Version data entries
75 entries across 75 versions & 1 rubygems