Class: LinksController

Inherits:
EventCalendar::ApplicationController show all
Defined in:
app/controllers/links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/links_controller.rb', line 47

def create
  load_resources
  begin
    event.save!(:without_revision => true)
    flash[:notice] = "Link successfully created." unless request.xhr?
    respond{ redirect_to_event }
  rescue ActiveRecord::RecordInvalid
    respond{ render 'events/show' and return }
  end
end

#destroyObject



57
58
59
60
61
# File 'app/controllers/links_controller.rb', line 57

def destroy
  link.destroy
  flash[:notice] = "Link successfully deleted."
  redirect_to_event
end

#editObject



34
35
36
# File 'app/controllers/links_controller.rb', line 34

def edit
  load_resources
end

#newObject



28
29
30
# File 'app/controllers/links_controller.rb', line 28

def new
  load_resources
end

#showObject



31
32
33
# File 'app/controllers/links_controller.rb', line 31

def show
  load_resources
end

#updateObject



37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/links_controller.rb', line 37

def update
  if link.update_attributes(params[:link])
    flash[:notice] = "Link successfully updated." unless request.xhr?
    event if request.xhr?
    respond{ redirect_to_event }
  else
    event
    respond{ render :edit and return }
  end
end