Class: RequestsController

Inherits:
ApplicationController show all
Includes:
PrefixHelper
Defined in:
public/app/controllers/requests_controller.rb

Constant Summary

Constants included from Searchable

Searchable::ABSTRACT

Instance Method Summary collapse

Methods included from PrefixHelper

app_prefix, #app_prefix, app_prefix_js, #app_prefix_js

Methods inherited from ApplicationController

#archivesspace, can_access?, permission_mappings, set_access_control

Methods included from JsonHelper

#merge_notes, #process_json_notes

Methods included from Searchable

#default_search_opts, #get_filter_years, #handle_results, #html_notes, #process_results, #process_search_results, #repo_context, #search_terms, #set_up_advanced_search, #set_up_and_run_search, #set_up_search, #strip_facet_fields

Methods included from HandleFaceting

#fetch_only_facets, #get_pretty_facet_value, #strip_facets

Methods included from ManipulateNode

#inheritance, #process_mixed_content, #strip_mixed_content

Instance Method Details

#make_requestObject

send a request



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'public/app/controllers/requests_controller.rb', line 6

def make_request
  @request = RequestItem.new(params)
  errs = @request.validate
  if params["comment"].present?
    errs << I18n.t('request.failed')
  end
  if errs.blank?
    flash[:notice] = I18n.t('request.submitted')

    RequestMailer.request_received_staff_email(@request).deliver
    RequestMailer.request_received_email(@request).deliver

    redirect_to params.fetch('base_url', app_prefix(request[:request_uri]))
  else
    flash[:error] = errs
    redirect_back(fallback_location: app_prefix(request[:request_uri])) and return
  end
end