Class: Forge::CountriesController

Inherits:
ForgeController show all
Defined in:
lib/forge/app/controllers/forge/countries_controller.rb

Instance Method Summary collapse

Methods inherited from ForgeController

#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor

Methods inherited from ApplicationController

#app_init

Instance Method Details

#get_active_countriesObject



25
26
27
28
29
30
# File 'lib/forge/app/controllers/forge/countries_controller.rb', line 25

def get_active_countries
  @countries = Country.active.all.map {|country| country.title}
  respond_to do |format|
    format.js {render :json => @countries}
  end
end

#get_provincesObject



16
17
18
19
20
21
22
23
# File 'lib/forge/app/controllers/forge/countries_controller.rb', line 16

def get_provinces
  if params[:id]
    @provinces = Country.find(params[:id]).province_options_for_select(:add_blank => true)
    respond_to do |format|
      format.js {render :json => @provinces}
    end
  end
end

#indexObject



4
5
6
7
# File 'lib/forge/app/controllers/forge/countries_controller.rb', line 4

def index
  @active_countries = Country.active.all
  @countries = Country.alphabetical.all
end

#updateObject



9
10
11
12
13
14
# File 'lib/forge/app/controllers/forge/countries_controller.rb', line 9

def update
  @country.update_attributes(params[:country])
  respond_to do |format|
    format.js { render :nothing => true}
  end
end