Class: Decidim::NavigationMaps::Admin::BlueprintsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/decidim/navigation_maps/admin/blueprints_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/decidim/navigation_maps/admin/blueprints_controller.rb', line 19

def create
  save_settings
  parse_blueprints
  @form = form(BlueprintForms).from_params(params).with_context(current_organization: current_organization)
  SaveBlueprints.call(@form) do
    on(:ok) do
      render plain: I18n.t("navigation_maps.create.success", scope: "decidim")
    end

    on(:invalid) do
      render plain: I18n.t("navigation_maps.create.error", scope: "decidim"), status: :unprocessable_entity
    end
  end
end

#indexObject



11
12
13
# File 'app/controllers/decidim/navigation_maps/admin/blueprints_controller.rb', line 11

def index
  render json: organization_blueprints
end

#showObject



15
16
17
# File 'app/controllers/decidim/navigation_maps/admin/blueprints_controller.rb', line 15

def show
  render json: organization_blueprints.find(params[:id]).to_json(except: :image)
end