Sha256: c1fa0c5b9f8bb4c51def8966a6ea0baec8357d411d1b59b1583476e036c6ca9b
Contents?: true
Size: 873 Bytes
Versions: 2
Compression:
Stored size: 873 Bytes
Contents
# frozen_string_literal: true require 'rails' require 'action_view' module Thredded class PushoverNotifier class ContentHelper include ActionView::Helpers::TextHelper attr_reader :post, :root_url def initialize(root_url, post) @root_url = root_url @post = post end def message_for_new_topic_post content_truncated(replace_images) end def title_for_new_topic_post "#{post.postable.title} by @#{post.user.thredded_display_name} [#{post.messageboard.name}]" end def post_url "#{root_url}#{post_permalink_path(post.id)}" end protected def replace_images post.content.gsub(/!\[[^\]]*?\]\(([^)]*?)\)/, '[IMAGE]') end def content_truncated(content) truncate(content, length: 100, separator: ' ') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thredded-pushover-notifier-1.0.0 | lib/thredded/pushover_notifier/content_helper.rb |
thredded-pushover-notifier-0.1.0 | lib/thredded/pushover_notifier/content_helper.rb |