Class: Avo::ChartsController

Inherits:
BaseController show all
Defined in:
app/controllers/avo/charts_controller.rb

Constant Summary

Constants included from Avo::Concerns::FindAssociationField

Avo::Concerns::FindAssociationField::ASSOCIATIONS

Instance Method Summary collapse

Methods inherited from BaseController

#create, #destroy, #edit, #index, #new, #preview, #search, #show, #update

Methods included from Avo::Concerns::SafeCall

#safe_call

Methods included from Avo::Concerns::AssociationQueryScope

#association_query_scope, #association_summary?, #build_association_scope_from_params

Methods included from Avo::Concerns::FiltersSessionHandler

#fetch_filters, #filters_from_params, #filters_from_session, #filters_session_key, #reset_filters, #save_filters_to_session

Methods inherited from BaseApplicationController

#exception_logger, #turbo_frame_request?

Methods included from Avo::Concerns::FindAssociationField

#find_association_field

Methods included from Avo::Concerns::Breadcrumbs

#add_breadcrumb, #avo_breadcrumbs

Methods included from UrlHelpers

#edit_resource_path, #new_resource_path, #preview_resource_path, #related_resources_path, #resource_attach_path, #resource_detach_path, #resource_path, #resource_view_path, #resources_path

Methods included from ApplicationHelper

#a_button, #a_link, #body_classes, #button_classes, #chart_color, #container_classes, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #manual_frame_cookie_name, #manual_frame_remembered?, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_header_menu_items, #render_license_warning, #root_path_without_url, #rtl?, #safe_blob_path, #safe_blob_representation_url, #safe_blob_url, #text_direction, #ui, #wrap_in_modal

Methods included from SummaryChartHelper

#summary_chart_params_for

Methods included from ResourcesHelper

#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table

Methods included from CommonController

#default_url_options, #extra_default_url_options

Methods included from InitializesAvo

#_current_user, #context, #init_app, #load_appearance_settings

Instance Method Details

#distribution_chartObject



13
14
15
16
17
# File 'app/controllers/avo/charts_controller.rb', line 13

def distribution_chart
  compute_summary_data

  render "avo/partials/distribution_chart", layout: "avo/blank"
end

#distribution_chart_fullObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/avo/charts_controller.rb', line 19

def distribution_chart_full
  compute_summary_data

  @page_title = "#{@resource.plural_name.humanize}#{@field_id.to_s.humanize} summary"
  @container_size = :small

  index_params = {
    encoded_filters: params[:encoded_filters],
    scope: params[:scope],
    q: params[:q]
  }
  if defined?(Avo::DynamicFilters)
    dynamic_filters_key = Avo::DynamicFilters.configuration.param_key
    index_params[dynamic_filters_key] = params[dynamic_filters_key]&.to_unsafe_h
  end
  index_params.compact!

  @back_path = if associated_summary?
    resource_path(record: @parent_record, resource: @parent_resource)
  else
    resources_path(resource: @resource, **index_params)
  end

  add_via_breadcrumbs
  add_breadcrumb title: "#{@field_id.to_s.humanize} summary"

  render "avo/partials/distribution_chart_full"
end