Skip to content

Commit

Permalink
Update cards
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Sep 12, 2024
1 parent 22e6f1b commit d348933
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/cells/decidim/plans/plan_l/data.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>

<div class="card__info__item">
<%= creation_date_status %>
<%# <%= creation_date_status %>
</div>

<% if has_category? %>
Expand Down
2 changes: 1 addition & 1 deletion app/cells/decidim/plans/plan_m/data.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div class="card__info">
<div class="card__info__item">
<%= creation_date_status %>

</div>

<% if has_category? %>
Expand Down
24 changes: 12 additions & 12 deletions app/cells/decidim/plans/plan_m_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module Decidim
module Plans
# This cell renders a plan with its M-size card.
class PlanMCell < Decidim::ViewModel
class PlanMCell < Decidim::CardLCell
include PlanCellsHelper
include Decidim::Plans::CellContentHelper

Expand Down Expand Up @@ -97,34 +97,34 @@ def has_footer?
def badge_classes
return super unless options[:full_badge]

state_classes.push("label", "idea-status").join(" ")
state_classes.push(["label", "idea-status"]).join(" ")
end

def statuses
return [] if preview?
return [:comments_count] if model.draft?

[:comments_count, :favorites_count]
[:comments_count, :favoriting_count]
end

def comments_count_status
render_comments_count
end

def creation_date_status
l(model.published_at.to_date, format: :decidim_short)
end
# def creation_date_status
# l(model.published_at.to_date, format: :decidim_short)
# end

def favorites_count_status
cell("decidim/favorites/favorites_count", model)
def favoriting_count_status
cell("decidim/favorites/favoriting_count", model)
end

def category_icon
cat = icon_category
return unless cat

content_tag(:span, class: "card__category__icon", "aria-hidden": true) do
image_tag(cat.attached_uploader(:category_icon).url, alt: full_category)
image_tag(cat.attached_uploader(:category_icon).path, alt: full_category)
end
end

Expand Down Expand Up @@ -181,11 +181,11 @@ def plan_image
end

def default_plan_image
Decidim::Plans.config.default_card_image
Decidim::Plans.default_card_image
end

def resource_image_path
return plan_image.attached_uploader(:file).variant_url(resource_image_variant) if has_image?
return plan_image.attached_uploader(:file).path(variant: resource_image_variant) if has_image?

if has_category?
path = category_image_path(category)
Expand All @@ -207,7 +207,7 @@ def category_image_path(cat)
return unless cat.category_image
return unless cat.category_image.attached?

cat.attached_uploader(:category_image).variant_url(category_image_variant)
cat.attached_uploader(:category_image).path(variant: category_image_variant)
end

def category_image_variant
Expand Down

0 comments on commit d348933

Please sign in to comment.