Skip to content

Commit

Permalink
Converted Service node to use its decorator for icons/image
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Jan 10, 2017
1 parent 63a79a6 commit 814d3be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/presenters/tree_node/service.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
module TreeNode
class Service < Node
set_attribute(:image) { @object.picture ? "/pictures/#{@object.picture.basename}" : '100/service.png' }
set_attributes(:image, :icon) do
if @object.picture
image = @object.decorate.listicon_image
else
icon = 'product product-service'
end
[image, icon]
end
end
end
2 changes: 1 addition & 1 deletion spec/presenters/tree_node/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
let(:object) { FactoryGirl.create(:service) }

include_examples 'TreeNode::Node#key prefix', 's-'
include_examples 'TreeNode::Node#image', '100/service.png'
include_examples 'TreeNode::Node#icon', 'product product-service'
end

0 comments on commit 814d3be

Please sign in to comment.