Class: OrganizationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- OrganizationsController
- Defined in:
- app/controllers/organizations_controller.rb
Constant Summary
Constants included from ProjectsHelper
ProjectsHelper::CLASSIFIER, ProjectsHelper::CLASSIFIER_ANNOTATION
Instance Method Summary collapse
-
#autocomplete ⇒ Object
Meh- term/query_string needs unification.
-
#create ⇒ Object
POST /organizations POST /organizations.json.
-
#destroy ⇒ Object
DELETE /organizations/1 DELETE /organizations/1.json.
-
#edit ⇒ Object
GET /organizations/1/edit.
-
#index ⇒ Object
GET /organizations GET /organizations.json.
- #list ⇒ Object
-
#new ⇒ Object
GET /organizations/new.
- #organization_params ⇒ Object private
- #set_organization ⇒ Object private
-
#show ⇒ Object
GET /organizations/1 GET /organizations/1.json.
-
#update ⇒ Object
PATCH/PUT /organizations/1 PATCH/PUT /organizations/1.json.
Methods included from DataControllerConfiguration::SharedDataControllerConfiguration
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
#autocomplete ⇒ Object
Meh- term/query_string needs unification
75 76 77 |
# File 'app/controllers/organizations_controller.rb', line 75 def autocomplete @organizations = Queries::Organization::Autocomplete.new(params.require(:term)).autocomplete end |
#create ⇒ Object
POST /organizations POST /organizations.json
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/organizations_controller.rb', line 36 def create @organization = Organization.new(organization_params) respond_to do |format| if @organization.save format.html { redirect_to @organization, notice: 'Organization was successfully created.' } format.json { render :show, status: :created, location: @organization } else format.html { render :new } format.json { render json: @organization.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /organizations/1 DELETE /organizations/1.json
66 67 68 69 70 71 72 |
# File 'app/controllers/organizations_controller.rb', line 66 def destroy @organization.destroy respond_to do |format| format.html { redirect_to organizations_url, notice: 'Organization was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /organizations/1/edit
31 32 |
# File 'app/controllers/organizations_controller.rb', line 31 def edit end |
#index ⇒ Object
GET /organizations GET /organizations.json
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/organizations_controller.rb', line 8 def index respond_to do |format| format.html do @recent_objects = Organization.created_this_week.order(updated_at: :desc).limit(10) render '/shared/data/all/index' end format.json { # @organizations = Queries::Organization::Filter.new(filter_params).all.with_project_id(sessions_current_project_id) } end end |
#list ⇒ Object
79 80 81 |
# File 'app/controllers/organizations_controller.rb', line 79 def list @organizations = Organization.page(params[:page]) end |
#new ⇒ Object
GET /organizations/new
26 27 28 |
# File 'app/controllers/organizations_controller.rb', line 26 def new @organization = Organization.new end |
#organization_params ⇒ Object (private)
89 90 91 92 93 94 95 |
# File 'app/controllers/organizations_controller.rb', line 89 def organization_params params.require(:organization).permit( :name, :alternate_name, :description, :disambiguating_description, :same_as_id, :address, :email, :telephone, :duns, :global_location_number, :legal_name, :area_served_id, :department_id, :parent_organization_id ) end |
#set_organization ⇒ Object (private)
85 86 87 |
# File 'app/controllers/organizations_controller.rb', line 85 def set_organization @organization = Organization.find(params[:id]) end |
#show ⇒ Object
GET /organizations/1 GET /organizations/1.json
22 23 |
# File 'app/controllers/organizations_controller.rb', line 22 def show end |
#update ⇒ Object
PATCH/PUT /organizations/1 PATCH/PUT /organizations/1.json
52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/organizations_controller.rb', line 52 def update respond_to do |format| if @organization.update(organization_params) format.html { redirect_to @organization, notice: 'Organization was successfully updated.' } format.json { render :show, status: :ok, location: @organization } else format.html { render :edit } format.json { render json: @organization.errors, status: :unprocessable_entity } end end end |