Class: GazetteerImportsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- GazetteerImportsController
- Defined in:
- app/controllers/gazetteer_imports_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
-
#all ⇒ Object
GET /gazetteer_imports/all.json.
-
#create ⇒ Object
POST /gazetteer_imports or /gazetteer_imports.json.
-
#destroy ⇒ Object
DELETE /gazetteer_imports/1 or /gazetteer_imports/1.json.
-
#edit ⇒ Object
GET /gazetteer_imports/1/edit.
-
#gazetteer_import_params ⇒ Object
private
Only allow a list of trusted parameters through.
-
#index ⇒ Object
GET /gazetteer_imports or /gazetteer_imports.json.
-
#new ⇒ Object
GET /gazetteer_imports/new.
-
#set_gazetteer_import ⇒ Object
private
Use callbacks to share common setup or constraints between actions.
-
#show ⇒ Object
GET /gazetteer_imports/1 or /gazetteer_imports/1.json.
-
#update ⇒ Object
PATCH/PUT /gazetteer_imports/1 or /gazetteer_imports/1.json.
Methods included from RedirectHelper
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
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
Methods included from TokenAuthentication
#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate
Instance Method Details
#all ⇒ Object
GET /gazetteer_imports/all.json
61 62 63 64 65 66 67 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 61 def all @import_jobs = GazetteerImport .joins('JOIN users ON gazetteer_imports.created_by_id = users.id') .select('gazetteer_imports.*, users.name AS submitted_by') .where(project_id: sessions_current_project_id) .order(created_at: :desc) end |
#create ⇒ Object
POST /gazetteer_imports or /gazetteer_imports.json
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 23 def create @gazetteer_import = GazetteerImport.new(gazetteer_import_params) respond_to do |format| if @gazetteer_import.save format.html { redirect_to gazetteer_import_url(@gazetteer_import), notice: "Gazetteer import was successfully created." } format.json { render :show, status: :created, location: @gazetteer_import } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @gazetteer_import.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /gazetteer_imports/1 or /gazetteer_imports/1.json
51 52 53 54 55 56 57 58 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 51 def destroy @gazetteer_import.destroy! respond_to do |format| format.html { redirect_to gazetteer_imports_url, notice: "Gazetteer import was successfully destroyed." } format.json { head :no_content } end end |
#edit ⇒ Object
GET /gazetteer_imports/1/edit
19 20 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 19 def edit end |
#gazetteer_import_params ⇒ Object (private)
Only allow a list of trusted parameters through.
76 77 78 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 76 def gazetteer_import_params params.fetch(:gazetteer_import, {}) end |
#index ⇒ Object
GET /gazetteer_imports or /gazetteer_imports.json
5 6 7 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 5 def index @gazetteer_imports = GazetteerImport.all end |
#new ⇒ Object
GET /gazetteer_imports/new
14 15 16 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 14 def new @gazetteer_import = GazetteerImport.new end |
#set_gazetteer_import ⇒ Object (private)
Use callbacks to share common setup or constraints between actions.
71 72 73 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 71 def set_gazetteer_import @gazetteer_import = GazetteerImport.find(params[:id]) end |
#show ⇒ Object
GET /gazetteer_imports/1 or /gazetteer_imports/1.json
10 11 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 10 def show end |
#update ⇒ Object
PATCH/PUT /gazetteer_imports/1 or /gazetteer_imports/1.json
38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/gazetteer_imports_controller.rb', line 38 def update respond_to do |format| if @gazetteer_import.update(gazetteer_import_params) format.html { redirect_to gazetteer_import_url(@gazetteer_import), notice: "Gazetteer import was successfully updated." } format.json { render :show, status: :ok, location: @gazetteer_import } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @gazetteer_import.errors, status: :unprocessable_entity } end end end |