Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource_icon with component or manifest nil #28

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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