summaryrefslogtreecommitdiff
path: root/new/lib/crys/processors/mixins/common_parts.rb
blob: a6c2dc16224c5a119ddad55b2e94c6cfebec3994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Crys
  module CommonParts
    def webbutton(file:, url:, alt:)
      full_path = "#{image_dir}/buttons/#{file}"

      image = ::Crys::ImageProcessor.new(path: full_path, filename: file, width: 88)
      assets << image

      code = ERB.new <<~EOF
        <a href="<%=url%>"><img src="<%=image.relative_path%>" width="88" height="31" class="webbutton" alt="<%=alt%>"></a>
      EOF

      code.result(binding)
    end
  end
end