Prepare SDG tag list component to render list with or without links
Now the tag list can render tags with or without links, so we need to adapt the styles slightly. We want to use the same text color for tags without links. The hover style is only needed when using tags with links.
This commit is contained in:
committed by
taitus
parent
cc2ce38d13
commit
bb1315def1
@@ -1,4 +1,4 @@
|
||||
<div class="sdg-tag-list">
|
||||
<%= render SDG::Goals::TagListComponent.new(record, limit: limit) %>
|
||||
<%= render SDG::Targets::TagListComponent.new(record, limit: limit) %>
|
||||
<%= goals_list %>
|
||||
<%= targets_list %>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
class SDG::TagListComponent < ApplicationComponent
|
||||
attr_reader :record, :limit
|
||||
attr_reader :record, :limit, :linkable
|
||||
|
||||
def initialize(record, limit: nil)
|
||||
def initialize(record, limit: nil, linkable: true)
|
||||
@record = record
|
||||
@limit = limit
|
||||
@linkable = linkable
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def goals_list
|
||||
if linkable
|
||||
render SDG::Goals::TagListComponent.new(record, limit: limit)
|
||||
else
|
||||
render SDG::Goals::PlainTagListComponent.new(record, limit: limit)
|
||||
end
|
||||
end
|
||||
|
||||
def targets_list
|
||||
if linkable
|
||||
render SDG::Targets::TagListComponent.new(record, limit: limit)
|
||||
else
|
||||
render SDG::Targets::PlainTagListComponent.new(record, limit: limit)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user