Sha256: d97a0880b266f13b4f40cfc9b5ebd3dde955bc61aa158926138582d8eb6d61c3

Contents?: true

Size: 1.68 KB

Versions: 195

Compression:

Stored size: 1.68 KB

Contents

module CabooseRets
  class OfficesController < ApplicationController  

    #=============================================================================
    # Admin functions
    #=============================================================================
    
    # GET /admin/offices
    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
    
    # GET /admin/offices/:mls_number/edit
    def admin_edit
      return if !user_is_allowed('offices', 'edit')    
      @office = Office.find(params[:id])      
      render :layout => 'caboose/admin'
    end
    
    # GET /admin/offices/:mls_number/refresh
    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
  
    # GET /admin/offices/options
    def admin_options
      options = [{
        'value' => '',
        'text' => '-- No Office --'
      }]
      Office.reorder('lo_name').all.each do |office|
        options << { 
          'value' => office.lo_code,
          'text'  => office.lo_name
        }
      end
      render :json => options 
    end
  
  end
end

Version data entries

195 entries across 195 versions & 1 rubygems

Version Path
caboose-rets-0.1.214 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.213 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.212 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.211 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.210 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.209 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.208 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.207 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.206 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.205 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.204 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.203 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.202 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.201 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.200 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.199 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.198 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.197 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.196 app/controllers/caboose_rets/offices_controller.rb
caboose-rets-0.1.195 app/controllers/caboose_rets/offices_controller.rb