Sha256: c17dd2247b1b9876cf2c472f72f71459fdf6c2ea994075bad5e6866c94d6df2d
Contents?: true
Size: 581 Bytes
Versions: 6
Compression:
Stored size: 581 Bytes
Contents
# -*- coding: utf-8 -*- description 'Download aspect' Aspect.create(:download) do def accepts?(page); !page.content.empty?; end def call(context, page) name = page.root? ? :root.t : page.name.gsub(/[^\w.\-_]/, '_') context.header['Content-Disposition'] = %{attachment; filename="#{name}"} context.header['Content-Length'] = page.content.bytesize.to_s page.content end end __END__ @@ locale.yml cs: aspect_download: 'Stažení (neupraveno)' de: aspect_download: 'Herunterladen' en: aspect_download: 'Download' fr: aspect_download: "Téléchargement"
Version data entries
6 entries across 6 versions & 1 rubygems