diff options
| author | Zog | 2018-04-06 14:46:19 +0200 |
|---|---|---|
| committer | cedricnjanga | 2018-04-10 23:28:47 -0700 |
| commit | 03b4010981f5d47fbd8dd468bbe5fc320fd7a9e4 (patch) | |
| tree | 842e1a5ae9e28274b991f49cf335e2debb959c7e /lib | |
| parent | 9f374650488fdbfd86fbbdc66cfebda4e9f5a551 (diff) | |
| download | chouette-core-03b4010981f5d47fbd8dd468bbe5fc320fd7a9e4.tar.bz2 | |
Refs #6426; Disable "Create opposite route" action instead of hiding it
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/af83/decorator/link.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/af83/decorator/link.rb b/lib/af83/decorator/link.rb index ee09f80dc..9bf6c1ed9 100644 --- a/lib/af83/decorator/link.rb +++ b/lib/af83/decorator/link.rb @@ -85,6 +85,10 @@ class AF83::Decorator::Link in_group_for_action? :secondary end + def disabled? + !!disabled + end + def enabled? enabled = false if @options[:_if].nil? @@ -131,9 +135,9 @@ class AF83::Decorator::Link out[:class] = extra_class out.delete(:link_class) out.delete(:link_method) - out[:class] += " disabled" if disabled + out[:class] += " disabled" if disabled? out[:class].strip! - out[:disabled] = !!disabled + out[:disabled] = disabled? out end @@ -150,7 +154,7 @@ class AF83::Decorator::Link html_options ).to_html else - context.h.link_to content, href, html_options + context.h.link_to content, (disabled? ? "#" : href), html_options end end end |
