Module: Openseadragon::OpenseadragonHelper
- Defined in:
- app/helpers/openseadragon/openseadragon_helper.rb
Instance Method Summary collapse
-
#openseadragon_picture_tag(*sources) ⇒ Object
Generate a
tag ready to be parsed by the rails javascript and transformed into an openseadragon viewer. -
#picture_tag(*sources) ⇒ Object
Generate a
tag containing the given sources.
Instance Method Details
#openseadragon_picture_tag(*sources) ⇒ Object
Generate a
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/openseadragon/openseadragon_helper.rb', line 46 def openseadragon_picture_tag(*sources) = sources..symbolize_keys = sources..symbolize_keys sources.flatten! tile_sources = sources.map { |thing| extract_openseadragon_picture_tilesource(thing) } [:data] ||= {} [:data][:openseadragon] = osd_asset_defaults.merge([:data][:openseadragon] || {}).to_json picture_tag [tile_sources], { media: 'openseadragon' }.merge(), end |
#picture_tag(*sources) ⇒ Object
Generate a
The last hash is intepreted as optional arguments for the
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/openseadragon/openseadragon_helper.rb', line 16 def picture_tag *sources = sources..symbolize_keys = sources..symbolize_keys sources.flatten! content_tag :picture, do safe_join(sources.map do |source| = if source.is_a? Hash src, = source.first ||= {} .merge(.merge(src: src)) else .merge(src: source) end yield if block_given? tag :source, end) end end |