Module: Nquery::ChartActions
- Extended by:
- ActiveSupport::Concern
- Included in:
- ChartsController, Dashboard::ChartsController
- Defined in:
- app/controllers/concerns/nquery/chart_actions.rb
Instance Method Summary collapse
Instance Method Details
#archive ⇒ Object
44 45 46 47 |
# File 'app/controllers/concerns/nquery/chart_actions.rb', line 44 def archive @chart.archive! redirect_to after_chart_action_path, notice: "Chart archived." end |
#destroy ⇒ Object
39 40 41 42 |
# File 'app/controllers/concerns/nquery/chart_actions.rb', line 39 def destroy @chart.destroy redirect_to after_chart_action_path, notice: "Chart removed." end |
#edit ⇒ Object
19 20 21 22 |
# File 'app/controllers/concerns/nquery/chart_actions.rb', line 19 def edit load_chart_builder_assigns render "nquery/charts/edit" end |
#embed ⇒ Object
49 50 51 52 53 |
# File 'app/controllers/concerns/nquery/chart_actions.rb', line 49 def @embed_token = EmbedToken.active.find_by(resource_type: "Nquery::Chart", resource_id: @chart.id) @embed_url = @embed_token ? (token: EmbedTokenService.signed_token_for(@embed_token)) : nil render "nquery/charts/embed" end |
#show ⇒ Object
14 15 16 17 |
# File 'app/controllers/concerns/nquery/chart_actions.rb', line 14 def show @result = chart_result(@chart) render "nquery/charts/show" end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/concerns/nquery/chart_actions.rb', line 24 def update if @chart.update(chart_params) respond_to do |format| format.html { redirect_to after_chart_save_path, notice: "Chart updated." } format.turbo_stream do flash.now[:notice] = "Chart updated." render template: "nquery/charts/update" end end else load_chart_builder_assigns render "nquery/charts/edit", status: :unprocessable_content end end |