lib/attachy/models/attachy/viewer.rb in attachy-0.1.1 vs lib/attachy/models/attachy/viewer.rb in attachy-0.1.2

- old
+ new

@@ -15,12 +15,12 @@ def button_label_options { text: '...' } end - def button_label(html: button_label_options) - html = htm(:button).merge(html) + def button_label(html: htm(:button)) + html = button_label_options.merge(html) @view.content_tag :span, html.delete(:text), html end def content(html: {}) @@ -101,11 +101,11 @@ def link_options { class: :attachy__link } end def link(file = criteria, t: transform, tl: { crop: :none }, html: {}) - html = html.reverse_merge(link_options.merge(data: tl)) + html = link_options.merge(data: tl).merge(html) return yield(html, attachments) if block_given? @view.link_to image(file, t: t), file.url(tl), html end @@ -153,18 +153,18 @@ def default? attachments.size == 1 && attachments.last.public_id == Attachy::File.default.public_id end - def htm(resource_type = :image) - @options.dig(resource_type, :html) || {} + def htm(path = []) + @options.dig(*[path, :html].flatten) || {} end def metadata @metadata ||= @object.send("#{@method}_metadata") end - def transform(path = [:t]) - @options.dig(*path) || {} + def transform(path = []) + @options.dig(*[path, :t].flatten) || {} end end end