Class: Decidim::Geo::Admin::ShapefilesController
- Inherits:
-
Decidim::Geo::ApplicationController
- Object
- Components::BaseController
- Decidim::Geo::ApplicationController
- Decidim::Geo::Admin::ShapefilesController
- Defined in:
- app/controllers/decidim/geo/admin/shapefiles_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/decidim/geo/admin/shapefiles_controller.rb', line 20 def create :create, :shapefile @form = form(Decidim::Geo::Admin::ShapefileForm).from_params(params) return Admin::CreateShapefile.call(@form) do on(:invalid) do || flash.now[:alert] = || @form.errors..join(',') || "Can not upload this shapefile" render action: "new" end on(:ok) do flash[:notice] = I18n.t("shapefiles.actions.create.success", scope: "decidim.geo.admin") redirect_to shapefiles_path end end end |
#index ⇒ Object
10 11 12 13 |
# File 'app/controllers/decidim/geo/admin/shapefiles_controller.rb', line 10 def index #enforce_permission_to :list @shapefiles = Decidim::Geo::Shapefile.all end |
#new ⇒ Object
15 16 17 18 |
# File 'app/controllers/decidim/geo/admin/shapefiles_controller.rb', line 15 def new :new, :shapefile @form = Decidim::Geo::Admin::ShapefileForm.new end |