Class: Decidim::QrController

Inherits:
ApplicationController
  • Object
show all
Includes:
OrganizationHelper, QrCodeHelper
Defined in:
app/controllers/decidim/qr_controller.rb

Instance Method Summary collapse

Methods included from QrCodeHelper

#local_params, #qr_code, #qr_code_image, #resource_name, #resource_url

Methods included from ShortLinkHelper

#short_url

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#attachment?, #default_locale?

Instance Method Details

#current_componentObject

needs to be public so that short link works



25
# File 'app/controllers/decidim/qr_controller.rb', line 25

def current_component = resource.try(:component)

#current_participatory_spaceObject

needs to be public so that short link works



28
29
30
31
32
# File 'app/controllers/decidim/qr_controller.rb', line 28

def current_participatory_space
  return resource if resource.is_a?(Decidim::Participable)

  resource.try(:participatory_space)
end

#showObject



17
18
19
20
21
22
# File 'app/controllers/decidim/qr_controller.rb', line 17

def show
  respond_to do |format|
    format.html
    format.png { send_data(qr_code.as_png(size: 500), filename: "qr-#{organization_name}-#{parametrized_title}.png") }
  end
end