Module: Decidim::Surveys::PublishResponsesHelper
- Defined in:
- decidim-surveys/app/helpers/decidim/surveys/publish_responses_helper.rb
Instance Method Summary collapse
-
#chart_for_question(question_id) ⇒ Object
Renders the chart for the given question.
- #question_response_is_publicable(question_type) ⇒ Object
Instance Method Details
#chart_for_question(question_id) ⇒ Object
Renders the chart for the given question. Uses chartkick to render the chart.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'decidim-surveys/app/helpers/decidim/surveys/publish_responses_helper.rb', line 16 def chart_for_question(question_id) question = Decidim::Forms::Question.includes(responses: { choices: [:response_option, :matrix_row] }).find(question_id) Chartkick. = { library: { animation: { easing: "easeOutQuart" } }, colors: colors_list } case question.question_type when "single_option", "multiple_option" (question) when "matrix_single", "matrix_multiple" matrix_stack_chart_wrapper(question) when "sorting" sorting_stack_chart_wrapper(question) else "Unknown question type" end end |
#question_response_is_publicable(question_type) ⇒ Object
6 7 8 9 10 |
# File 'decidim-surveys/app/helpers/decidim/surveys/publish_responses_helper.rb', line 6 def question_response_is_publicable(question_type) ignored_question_types = %w(short_response long_response separator files).freeze ignored_question_types.exclude?(question_type) end |