Class: Decidim::Core::StatisticType

Inherits:
Api::Types::BaseObject show all
Defined in:
decidim-core/lib/decidim/api/types/statistic_type.rb

Instance Method Summary collapse

Methods inherited from Api::Types::BaseObject

allowed_to?, authorized?, determine_subject_name, local_admin_context, local_context, permission_chain

Instance Method Details

#descriptionObject



37
38
39
40
41
42
43
# File 'decidim-core/lib/decidim/api/types/statistic_type.rb', line 37

def description
  organization.available_locales.to_h do |locale|
    I18n.with_locale(locale) do
      [locale, I18n.t(stat[:tooltip_key], scope: "decidim.statistics")]
    end
  end
end

#keyObject



21
22
23
# File 'decidim-core/lib/decidim/api/types/statistic_type.rb', line 21

def key
  stat[:name]
end

#nameObject



29
30
31
32
33
34
35
# File 'decidim-core/lib/decidim/api/types/statistic_type.rb', line 29

def name
  organization.available_locales.to_h do |locale|
    I18n.with_locale(locale) do
      [locale, I18n.t(key, scope: "decidim.statistics")]
    end
  end
end

#organizationObject



13
14
15
# File 'decidim-core/lib/decidim/api/types/statistic_type.rb', line 13

def organization
  object[0]
end

#statObject



17
18
19
# File 'decidim-core/lib/decidim/api/types/statistic_type.rb', line 17

def stat
  object[1]
end

#valueObject



25
26
27
# File 'decidim-core/lib/decidim/api/types/statistic_type.rb', line 25

def value
  stat[:data][0]
end