Module: ApplicationHelper

Defined in:
lib/generators/tmatt_cms/templates/helpers/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#aws_s3_json(directory) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/tmatt_cms/templates/helpers/application_helper.rb', line 16

def aws_s3_json(directory)
  aws_s3_hash = {
      bucket: ENV['AWS_S3_BUCKET'],
      region: ENV['AWS_S3_REGION'],
      key_start: "#{ENV['AWS_S3_KEY_START']}#{directory}",
      acl: ENV['AWS_S3_ACL'],
      access_id: ENV['AWS_S3_ACCESS_ID'],
      signature: aws_s3_signature(directory),
      policy: aws_s3_policy(directory),
  }

  @aws_s3_json = aws_s3_hash.to_json
end

#flash_tagObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/tmatt_cms/templates/helpers/application_helper.rb', line 2

def flash_tag
  return '' if flash.blank?
  html = ''
  flash.each do |name, msg|
    if msg.is_a?(String)
      html << "<div class='action-alert alert alert-#{name} text-center m-c'>"
      html << "<button type='button' class='close action-alert-close'>&times;</button>"
      html << "#{msg}"
      html << '</div>'
    end
  end
  raw html
end

#froala_keyObject



30
31
32
# File 'lib/generators/tmatt_cms/templates/helpers/application_helper.rb', line 30

def froala_key
  ENV['FROALA_KEY'];
end