Sha256: 143867a10b153309d49240ec8ed2b21d484ec5ad2f5be13cc1cffa15e7370451

Contents?: true

Size: 710 Bytes

Versions: 4

Compression:

Stored size: 710 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Blogs
    module Admin
      # 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_admin(post, max_length = 100)
          body = translated_attribute(post.body)
          CGI.unescapeHTML html_truncate(body, max_length: max_length)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-blogs-0.11.2 app/helpers/decidim/blogs/admin/posts_helper.rb
decidim-blogs-0.12.0.pre app/helpers/decidim/blogs/admin/posts_helper.rb
decidim-blogs-0.11.1 app/helpers/decidim/blogs/admin/posts_helper.rb
decidim-blogs-0.11.0.pre1 app/helpers/decidim/blogs/admin/posts_helper.rb