Sha256: fe122eea168e921495fdbf502dd39828983ef2ffda9d8953f5dc86d6e58241a1

Contents?: true

Size: 520 Bytes

Versions: 7

Compression:

Stored size: 520 Bytes

Contents

module Storytime
  module StorytimeHelpers
    def storytime_snippet(name)
      snippet = Storytime::Snippet.find_by(name: name, site: current_storytime_site)

      if snippet.nil?
        content = I18n.exists?(name) ? I18n.t(name).html_safe : "Lorem ipsum dolor sit amet, consectetur adipiscing elit..."
        snippet = Storytime::Snippet.create(name: name, content: content, site: current_storytime_site)
      end

      render partial: "storytime/snippets/snippet", locals: {snippet: snippet}
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
storytime-2.1.6 lib/storytime/storytime_helpers.rb
storytime-2.1.5 lib/storytime/storytime_helpers.rb
storytime-2.1.4 lib/storytime/storytime_helpers.rb
storytime-2.1.3 lib/storytime/storytime_helpers.rb
storytime-2.1.2 lib/storytime/storytime_helpers.rb
storytime-2.1.1 lib/storytime/storytime_helpers.rb
storytime-2.1.0 lib/storytime/storytime_helpers.rb