Class: CabooseRets::OfficesController
- Inherits:
-
ApplicationController
- Object
- Caboose::ApplicationController
- ApplicationController
- CabooseRets::OfficesController
- Defined in:
- app/controllers/caboose_rets/offices_controller.rb
Instance Method Summary collapse
-
#admin_edit ⇒ Object
GET /admin/offices/:mls_number/edit.
-
#admin_index ⇒ Object
GET /admin/offices.
-
#admin_options ⇒ Object
GET /admin/offices/options.
-
#admin_refresh ⇒ Object
GET /admin/offices/:mls_number/refresh.
Instance Method Details
#admin_edit ⇒ Object
GET /admin/offices/:mls_number/edit
28 29 30 31 32 |
# File 'app/controllers/caboose_rets/offices_controller.rb', line 28 def admin_edit return if !user_is_allowed('offices', 'edit') @office = Office.find(params[:id]) render :layout => 'caboose/admin' end |
#admin_index ⇒ Object
GET /admin/offices
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/caboose_rets/offices_controller.rb', line 10 def admin_index return if !user_is_allowed('offices', 'view') @gen = Caboose::PageBarGenerator.new(params, { 'lo_mls_id' => '', 'lo_name_like' => '' },{ 'model' => 'CabooseRets::Office', 'sort' => 'lo_name', 'desc' => false, 'base_url' => '/admin/offices', 'use_url_params' => false }) @offices = @gen.items render :layout => 'caboose/admin' end |
#admin_options ⇒ Object
GET /admin/offices/options
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/caboose_rets/offices_controller.rb', line 42 def = [{ 'value' => '', 'text' => '-- No Office --' }] Office.reorder('lo_name').all.each do |office| << { 'value' => office.lo_code, 'text' => office.lo_name } end render :json => end |
#admin_refresh ⇒ Object
GET /admin/offices/:mls_number/refresh
35 36 37 38 39 |
# File 'app/controllers/caboose_rets/offices_controller.rb', line 35 def admin_refresh office = Office.find(params[:id]) RetsImporter.import('Office', "(Matrix_Unique_ID=#{office.matrix_unique_id})") render :json => Caboose::StdClass.new({ 'success' => "The office's info has been updated from MLS." }) end |