Class: AreasController

Inherits:
ApplicationController show all
Includes:
Applicat::Mvc::Controller::Resource
Defined in:
app/controllers/areas_controller.rb

Instance Method Summary collapse

Methods included from Applicat::Mvc::Controller::Resource

included

Methods inherited from ApplicationController

#current_ability

Methods included from Voluntary::V1::BaseController

#parent, #voluntary_application_javascripts, #voluntary_application_stylesheets

Methods included from Applicat::Mvc::Controller

included

Instance Method Details

#createObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/areas_controller.rb', line 30

def create
  @area = Area.new(params[:area])
  
  if @area.save
    redirect_to @area, notice: t('general.form.successfully_created')
  else
    render :new
  end
end

#destroyObject



51
52
53
54
# File 'app/controllers/areas_controller.rb', line 51

def destroy
  @area.destroy
  redirect_to areas_url, notice: t('general.form.destroyed')
end

#editObject



40
41
# File 'app/controllers/areas_controller.rb', line 40

def edit
end

#indexObject



12
13
14
15
16
17
18
19
# File 'app/controllers/areas_controller.rb', line 12

def index
  @areas = Area.roots
    
  respond_to do |format|
    format.html
    format.json { render json: @areas.tokens(params[:q]) }
  end
end

#newObject



26
27
28
# File 'app/controllers/areas_controller.rb', line 26

def new
  @area = Area.new(params[:area])
end

#resourceObject



56
57
58
# File 'app/controllers/areas_controller.rb', line 56

def resource
  @area
end

#showObject



21
22
23
24
# File 'app/controllers/areas_controller.rb', line 21

def show
  @areas = @area.children
  @projects = @area.projects
end

#updateObject



43
44
45
46
47
48
49
# File 'app/controllers/areas_controller.rb', line 43

def update
  if @area.update_attributes(params[:area])
    redirect_to @area, notice: t('general.form.successfully_updated')
  else
    render :edit
  end
end