aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZog2018-01-22 11:39:34 +0100
committerZog2018-01-22 11:39:34 +0100
commitecbaa89f572ae22bde893662a46f8fba403dd6ee (patch)
tree99b945dfd3f6966ae6b992beac24680dd74ef980
parentdc7a11ef33e9f1762c695ac41cfa23ef21ce5e79 (diff)
downloadchouette-core-ecbaa89f572ae22bde893662a46f8fba403dd6ee.tar.bz2
Refs #5586; CR #2
-rw-r--r--app/assets/stylesheets/components/_buttons.sass4
-rw-r--r--app/decorators/line_decorator.rb6
-rw-r--r--lib/af83/decorator/link.rb16
-rw-r--r--spec/lib/af83/decorator/decorator_link_spec.rb8
4 files changed, 18 insertions, 16 deletions
diff --git a/app/assets/stylesheets/components/_buttons.sass b/app/assets/stylesheets/components/_buttons.sass
index a7010ae09..93f9907a5 100644
--- a/app/assets/stylesheets/components/_buttons.sass
+++ b/app/assets/stylesheets/components/_buttons.sass
@@ -153,8 +153,10 @@ table, .table
line-height: $line-height
display: block
font-size: 14px
- &:hover
+ &:hover, &:focus
text-decoration: none
+ background-color: whitesmoke
+ outline: none
&:not(:first-child)
position: relative
diff --git a/app/decorators/line_decorator.rb b/app/decorators/line_decorator.rb
index 7d247a99c..9171a6310 100644
--- a/app/decorators/line_decorator.rb
+++ b/app/decorators/line_decorator.rb
@@ -50,7 +50,7 @@ class LineDecorator < AF83::Decorator
l.href { h.deactivate_line_referential_line_path(context[:line_referential], object) }
l.method :put
l.data confirm: h.t('lines.actions.deactivate_confirm')
- l.extra_class "delete-action"
+ l.add_class "delete-action"
end
instance_decorator.action_link policy: :activate, secondary: :show, footer: :index do |l|
@@ -58,14 +58,14 @@ class LineDecorator < AF83::Decorator
l.href { h.activate_line_referential_line_path(context[:line_referential], object) }
l.method :put
l.data confirm: h.t('lines.actions.activate_confirm')
- l.extra_class "delete-action"
+ l.add_class "delete-action"
end
instance_decorator.destroy_action_link do |l|
l.content { h.destroy_link_content('lines.actions.destroy') }
l.href { h.line_referential_line_path(context[:line_referential], object) }
l.data confirm: h.t('lines.actions.destroy_confirm')
- l.extra_class "delete-action"
+ l.add_class "delete-action"
end
end
end
diff --git a/lib/af83/decorator/link.rb b/lib/af83/decorator/link.rb
index b1958532f..55db3f5bb 100644
--- a/lib/af83/decorator/link.rb
+++ b/lib/af83/decorator/link.rb
@@ -111,14 +111,14 @@ class AF83::Decorator::Link
"Missing attributes: #{@missing_attributes.to_sentence}"
end
- def extra_class val=nil
- if val.present?
- @options[:link_class] ||= []
- @options[:link_class] << val
- @options[:link_class].flatten!
- else
- (options[:link_class] || []).join(' ')
- end
+ def add_class val
+ @options[:link_class] ||= []
+ @options[:link_class] << val
+ @options[:link_class].flatten!
+ end
+
+ def extra_class
+ (options[:link_class] || []).join(' ')
end
def html_options
diff --git a/spec/lib/af83/decorator/decorator_link_spec.rb b/spec/lib/af83/decorator/decorator_link_spec.rb
index 4e2726be9..0b2939421 100644
--- a/spec/lib/af83/decorator/decorator_link_spec.rb
+++ b/spec/lib/af83/decorator/decorator_link_spec.rb
@@ -31,18 +31,18 @@ RSpec.describe AF83::Decorator::Link, type: :decorator do
end
end
- describe "#extra_class" do
+ describe "#add_class" do
let(:link){
AF83::Decorator::Link.new(href: "foo", content: "foo", class: "initial_class")
}
it "should add to exisiting class" do
expect(link.html_options[:class]).to eq "initial_class"
- link.extra_class "new_class"
+ link.add_class "new_class"
expect(link.html_options[:class]).to eq "initial_class new_class"
- link.extra_class = "another_class"
+ link.add_class "another_class"
expect(link.html_options[:class]).to eq "initial_class new_class another_class"
- link.extra_class = %w(foo bar)
+ link.add_class %w(foo bar)
expect(link.html_options[:class]).to eq "initial_class new_class another_class foo bar"
end
end