Class: Decidim::OpenDataController

Inherits:
ApplicationController show all
Defined in:
decidim-core/app/controllers/decidim/open_data_controller.rb

Instance Method Summary collapse

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 TranslatableAttributes

#attachment?, #default_locale?

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#downloadObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'decidim-core/app/controllers/decidim/open_data_controller.rb', line 9

def download
  resource = params[:resource] || nil

  if open_data_file_for_resource(resource)
    file = open_data_file_for_resource(resource)
    send_data file.download, filename: file.blob.filename.to_s, type: file.blob.content_type
  else
    schedule_open_data_generation(resource)
    flash[:alert] = t("decidim.open_data.not_available_yet")
    redirect_back fallback_location: open_data_path
  end
end

#indexObject



7
# File 'decidim-core/app/controllers/decidim/open_data_controller.rb', line 7

def index; end