Class: Curate::OrganizationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Blacklight::Catalog, Hydra::AccessControlsEnforcement, Hydra::CollectionsControllerBehavior, Sufia::Noid
Defined in:
app/controllers/curate/organizations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/curate/organizations_controller.rb', line 28

def create
  @organization = Organization.new(params[:organization])
  @organization.(current_user.user_key)
  if @organization.save
    flash[:notice] = "Organization created successfully."
    redirect_to organizations_path
  else
    flash[:error] = "Organization was not created."
    render action: :new
  end
end

#destroyObject



51
52
53
54
55
56
# File 'app/controllers/curate/organizations_controller.rb', line 51

def destroy
  @organization = Organization.find(params[:id])
  title = @organization.to_s
  @organization.destroy
  after_destroy_response(title)
end

#indexObject



20
21
22
# File 'app/controllers/curate/organizations_controller.rb', line 20

def index
  super
end

#newObject



24
25
26
# File 'app/controllers/curate/organizations_controller.rb', line 24

def new
  @organization = Organization.new
end

#updateObject



40
41
42
43
44
45
46
47
48
49
# File 'app/controllers/curate/organizations_controller.rb', line 40

def update
  @orgnization = Organization.find(params[:id])
  if @organization.update_attributes(params[:organization])
    flash[:notice] = "Ogranization updated successfully."
    redirect_to organization_path(@organization)
  else
    flash[:error] = "Organization was not updated."
    render action: :edit
  end
end