Class: GeographicItemsController

Inherits:
ApplicationController show all
Includes:
DataControllerConfiguration::SharedDataControllerConfiguration
Defined in:
app/controllers/geographic_items_controller.rb

Constant Summary

Constants included from ProjectsHelper

ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION

Instance Method Summary collapse

Methods included from DataControllerConfiguration::SharedDataControllerConfiguration

#set_is_shared_data_model

Methods included from RedirectHelper

#destroy_redirect

Methods included from RequestType

#json_request?

Methods included from LogRecent

#log_user_recent_route

Methods included from Cookies

#digest_cookie, #digested_cookie_exists?

Methods included from Whitelist

#whitelist_constantize

Methods included from ProjectsHelper

#cumulative_gb_per_year, #document_cumulative_gb_per_year, #document_gb_per_year, #gb_per_year, #image_cumulative_gb_per_year, #image_gb_per_year, #invalid_object, #project_classification, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form, #taxonworks_classification, #week_in_review_graphs

Methods included from Api::Intercept

#intercept_api

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#editObject

GET /geographic_items/1/edit



25
26
# File 'app/controllers/geographic_items_controller.rb', line 25

def edit
end

#geographic_item_paramsObject (private)



59
60
61
62
63
64
65
66
67
68
69
70
# File 'app/controllers/geographic_items_controller.rb', line 59

def geographic_item_params
  params.require(:geographic_item).permit(
    :point,
    :line_string,
    :polygon,
    :multi_point,
    :multi_line_string,
    :multi_polygon,
    :geometry_collection,
    :shape
  )
end

#set_geographic_itemObject (private)



54
55
56
57
# File 'app/controllers/geographic_items_controller.rb', line 54

def set_geographic_item
  @geographic_item = GeographicItem.find(params[:id])
  @recent_object = @geographic_item
end

#showObject

GET /geographic_items/1 GET /geographic_items/1.json GET /geographic_items/1.wkt



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/geographic_items_controller.rb', line 10

def show
  respond_to do |format|
    format.html {}
    format.json {}
    format.wkt {
      render plain: @geographic_item.to_wkt, layout: false
    }
    format.geojson {
      render json: @geographic_item.to_geo_json, layout: false
    }
  end

end

#updateObject

PATCH/PUT /geographic_items/1 PATCH/PUT /geographic_items/1.json



30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/geographic_items_controller.rb', line 30

def update
  respond_to do |format|
    if @geographic_item.update(geographic_item_params)
      format.html { redirect_to @geographic_item.metamorphosize, notice: 'Geographic item was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: 'edit' }
      format.json { render json: @geographic_item.errors, status: :unprocessable_entity }
    end
  end
end