aboutsummaryrefslogtreecommitdiffstats
path: root/lib/af83/decorator.rb
diff options
context:
space:
mode:
authorZog2018-01-17 10:16:55 +0100
committerZog2018-01-25 17:18:00 +0100
commitfc462f368bc45143b9f0b8649e5bec1f69e414c7 (patch)
tree568369ff753ff1b2e7d74ad884d580d65d86671e /lib/af83/decorator.rb
parentb802b16973bbf760aa8af720856c4127656c2e07 (diff)
downloadchouette-core-fc462f368bc45143b9f0b8649e5bec1f69e414c7.tar.bz2
Refs #5586 @1h; Refactor ReferentialDecorator
Plus: - Fix a bug on `html_options` in AF83::Decorator::Link - Add a `t` helper in AF83::Decorator to handle i18n
Diffstat (limited to 'lib/af83/decorator.rb')
-rw-r--r--lib/af83/decorator.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/af83/decorator.rb b/lib/af83/decorator.rb
index d2e049857..ba9a46cb0 100644
--- a/lib/af83/decorator.rb
+++ b/lib/af83/decorator.rb
@@ -226,7 +226,7 @@ class AF83::Decorator < ModelDecorator
def html_options
out = {}
options.each do |k, v|
- out[k] = v unless k == :content || k == :href || k.to_s =~ /^_/
+ out[k] = self.send(k) unless k == :content || k == :href || k.to_s =~ /^_/
end
out[:class] = extra_class
out.delete(:link_class)
@@ -241,7 +241,15 @@ class AF83::Decorator < ModelDecorator
yield link
return link.bind_to_context(context, @action).to_html
end
- context.h.link_to content, href, html_options
+ if type&.to_sym == :button
+ HTMLElement.new(
+ :button,
+ content,
+ html_options
+ ).to_html
+ else
+ context.h.link_to content, href, html_options
+ end
end
end