Sha256: 88ee2c5bbe413077a0a3264e45136aa26b0e59d2cb2446da500ed96b0aac7d1e

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # This cell renders the Small (:s) meeting card
    # for an given instance of a Meeting
    class MeetingSCell < MeetingMCell
      def meeting_path
        resource_locator(model).path
      end

      def participatory_space_class_name
        model.component.participatory_space.class.model_name.human
      end

      def participatory_space_title
        decidim_escape_translated model.component.participatory_space.title
      end

      def participatory_space_path
        resource_locator(model.component.participatory_space).path
      end

      private

      def cache_hash
        hash = []
        hash << I18n.locale.to_s
        hash << model.cache_key_with_version
        hash << Digest::MD5.hexdigest(model.component.cache_key_with_version)
        hash << Digest::MD5.hexdigest(resource_image_path) if resource_image_path
        hash << model.comments_count
        hash << model.follows_count
        hash << render_space? ? 1 : 0

        if current_user
          hash << current_user.cache_key_with_version
          hash << current_user.follows?(model) ? 1 : 0
        end
        hash << Digest::MD5.hexdigest(model.author.cache_key_with_version)
        hash << (model.must_render_translation?(current_organization) ? 1 : 0) if model.respond_to?(:must_render_translation?)

        hash.join(Decidim.cache_key_separator)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-meetings-0.27.9 app/cells/decidim/meetings/meeting_s_cell.rb
decidim-meetings-0.27.8 app/cells/decidim/meetings/meeting_s_cell.rb
decidim-meetings-0.27.7 app/cells/decidim/meetings/meeting_s_cell.rb
decidim-meetings-0.27.6 app/cells/decidim/meetings/meeting_s_cell.rb