Sha256: 0115bec7912ccee161fe3f903e1ab7c8b52d993c6ad7f501bfb1573baa7603e0

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

module Storytime
  module Dashboard
    module MediaHelper
      def show_media_insert_button?
        controller = params[:controller].split("/").last
        %w{pages posts}.include?(controller) || (request.referrer && (request.referrer.include?("pages") || request.referrer.include?("posts")))
      end

      def full_media_file_url(media, size = nil)
        if media.file_url.starts_with?("http")
          media.file_url(size)
        else
          storytime_root_url[0..-2]+media.file_url(size)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
storytime-0.0.4 app/helpers/storytime/dashboard/media_helper.rb
storytime-0.0.2 app/helpers/storytime/dashboard/media_helper.rb