Sha256: 2e0483a1e26def4653b78b9c198c4ed6da73619ac139f9d6906992ab5783c238

Contents?: true

Size: 740 Bytes

Versions: 24

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

module Decidim
  class FlagModalCell < Decidim::ViewModel
    include ActionView::Helpers::FormOptionsHelper

    def flag_user
      render
    end

    def cache_hash
      hash = []
      hash.push(I18n.locale)
      hash.push(current_user.try(:id))
      hash.push(model.reported_by?(current_user) ? 1 : 0)
      hash.push(model.class.name.gsub("::", ":"))
      hash.push(model.id)
      hash.join(Decidim.cache_key_separator)
    end

    private

    def user_report_form
      Decidim::ReportForm.from_params(reason: "spam")
    end

    def modal_id
      options[:modal_id] || "flagModal"
    end

    def report_form
      @report_form ||= Decidim::ReportForm.new(reason: "spam")
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.8 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.7 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.6 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.10 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.9 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.5 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.8 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.4 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.3 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.7 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.5 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.2 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.1 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.4 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.0 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.3 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.0.rc2 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.27.0.rc1 app/cells/decidim/flag_modal_cell.rb
decidim-core-0.26.2 app/cells/decidim/flag_modal_cell.rb