Module: Admin::PostsHelper

Includes:
PostsHelper
Defined in:
lib/ecrire/app/helpers/admin/posts_helper.rb

Instance Method Summary collapse

Methods included from PostsHelper

#edit_post_link, #post_path

Instance Method Details

#post_edit_content(post) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ecrire/app/helpers/admin/posts_helper.rb', line 5

def post_edit_content(post)
   :div, id: 'PostBody', postid: @post.id,
    class: %w(content),
    as: 'Editor.Content',
    contenteditable: true,
    href: admin_post_path(@post.id) do |div|

      if Rails.application.secrets.has_key?(:s3)
        div[:bucket] = Rails.application.secrets.s3['bucket']
        div[:access_key] = Rails.application.secrets.s3['access_key']
        div[:signature] = image_form_signature(image_form_policy(@post))
        div[:policy] = image_form_policy(@post)
        if Rails.application.secrets.s3.has_key?('namespace')
          div['namespace'] = Rails.application.secrets.s3['namespace']
        end
      end

      h(post.content)
    end
end