Skip to content

Commit

Permalink
Merge pull request #28 from AjuntamentdeBarcelona/fix/resource-icon-w…
Browse files Browse the repository at this point in the history
…ith-component-or-manifest-nil

Fix resource_icon with component or manifest nil
  • Loading branch information
fblupi authored Nov 16, 2022
2 parents 2e904af + cd6b318 commit f4cf37e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions decidim-core/app/helpers/decidim/icon_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def component_icon(component, options = {})
#
# Returns an HTML tag with the icon.
def manifest_icon(manifest, options = {})
if manifest.icon
if manifest.respond_to?(:icon) && manifest.icon.present?
external_icon manifest.icon, options
else
icon "question-mark", options
Expand All @@ -42,9 +42,9 @@ def manifest_icon(manifest, options = {})
def resource_icon(resource, options = {})
if resource.class.name == "Decidim::Comments::Comment"
icon "comment-square", options
elsif resource.respond_to?(:component)
elsif resource.respond_to?(:component) && resource.component.present?
component_icon(resource.component, options)
elsif resource.respond_to?(:manifest)
elsif resource.respond_to?(:manifest) && resource.manifest.present?
manifest_icon(resource.manifest, options)
elsif resource.is_a?(Decidim::User)
icon "person", options
Expand Down

0 comments on commit f4cf37e

Please sign in to comment.