Class: Backend::MapEditorsController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/map_editors_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#uploadObject


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/backend/map_editors_controller.rb', line 3

def upload
  file_parsed = false
  geometries = {}

  uploaded = params[:import_file]
  unless uploaded.blank?
    format = params[:importer_format]
    geometries = import_shapes(uploaded, format)
  end

  if geometries.is_a?(Hash) && geometries.key?(:error)
    flash.now[:alert] = geometries[:error].tl
  end

  respond_to do |format|
    format.json { render json: { alert: flash.alert } } unless flash.now[:alert].nil?
    format.json { render json: geometries.to_json }
  end
end