Module: Workarea::Admin::ContentBlockIconHelper
- Defined in:
- app/helpers/workarea/admin/content_block_icon_helper.rb
Instance Method Summary collapse
-
#content_block_icon(filename, transform_params = {}) ⇒ Object
This is a direct copy from the ‘inline_svg` helper, in order to give us better control over the `rescue` state.
Instance Method Details
#content_block_icon(filename, transform_params = {}) ⇒ Object
This is a direct copy from the ‘inline_svg` helper, in order to give us better control over the `rescue` state. github.com/jamesmartin/inline_svg/blob/v1.2.1/lib/inline_svg/action_view/helpers.rb
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/helpers/workarea/admin/content_block_icon_helper.rb', line 7 def content_block_icon(filename, transform_params={}) begin svg_file = if InlineSvg::IOResource === filename InlineSvg::IOResource.read filename else configured_asset_file.named filename end rescue InlineSvg::AssetFile::FileNotFound return inline_svg('workarea/admin/content_block_types/custom_block.svg', transform_params) end InlineSvg::TransformPipeline.generate_html_from(svg_file, transform_params).html_safe end |