Class: Decidim::QrController

Inherits:
ApplicationController show all
Includes:
OrganizationHelper, QrCodeHelper
Defined in:
decidim-core/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?

Methods inherited from ApplicationController

#store_share_token

Methods included from UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from Headers::HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#current_componentObject

needs to be public so that short link works



25
# File 'decidim-core/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 'decidim-core/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 'decidim-core/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