Class: Hydramata::GroupsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Blacklight::Catalog, Hydra::AccessControlsEnforcement, Hydra::Controller::ControllerBehavior, GroupMembershipActionParser, Sufia::Noid
Defined in:
app/controllers/hydramata/groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/hydramata/groups_controller.rb', line 32

def create
  @group_membership = Hydramata::GroupMembershipForm.new( Hydramata::GroupMembershipActionParser.convert_params(params, current_user) )
  if @group_membership.save
    flash[:notice] = "Group created successfully."
    redirect_to hydramata_groups_path
  else
    flash[:error] = "Group was not created."
    render action: :new
  end
end

#destroyObject



60
61
62
63
64
# File 'app/controllers/hydramata/groups_controller.rb', line 60

def destroy
  title = @group.to_s
  @group.destroy
  after_destroy_response(title)
end

#editObject



43
44
45
46
47
# File 'app/controllers/hydramata/groups_controller.rb', line 43

def edit
  @group = Hydramata::Group.find( params[:id] )
  setup_form
  respond_with(@group)
end

#indexObject



23
24
25
# File 'app/controllers/hydramata/groups_controller.rb', line 23

def index
  super
end

#newObject



27
28
29
30
# File 'app/controllers/hydramata/groups_controller.rb', line 27

def new
  @group = Hydramata::Group.new
  setup_form
end

#updateObject



49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/hydramata/groups_controller.rb', line 49

def update
  @group_membership = Hydramata::GroupMembershipForm.new( Hydramata::GroupMembershipActionParser.convert_params(params, current_user) )
  if @group_membership.save
    flash[:notice] = "Group updated successfully."
    redirect_to hydramata_group_path( params[:id] )
  else
    flash[:error] = "Group was not updated."
    render action: :edit
  end
end