├── .gitignore ├── .rbenv-version ├── .rspec ├── .rvmrc ├── .rvmrc.09.14.2012-11:22:17 ├── .rvmrc.09.28.2012-15:18:50 ├── Gemfile ├── Gemfile.lock ├── Procfile ├── README.rdoc ├── Rakefile ├── app ├── assets │ ├── csv │ │ ├── business_class.csv │ │ ├── cic_codes.csv │ │ ├── cic_codes_and_zoning_districts.csv │ │ ├── sic_codes.csv │ │ ├── zoning_and_sic_codes.csv │ │ ├── zoning_districts.csv │ │ └── zoning_districts_and_sic_codes.csv │ ├── images │ │ ├── assets-nav.png │ │ ├── handle.png │ │ ├── opencounter_logo.png │ │ ├── opencounter_logo.psd │ │ ├── planning-department-map.jpg │ │ ├── planning-department.png │ │ └── rails.png │ ├── javascripts │ │ ├── app │ │ │ ├── app.js │ │ │ ├── config.js │ │ │ ├── main.js │ │ │ ├── modules │ │ │ │ ├── answer.js │ │ │ │ ├── business.js │ │ │ │ ├── fees │ │ │ │ │ ├── parking.js │ │ │ │ │ ├── parking_non_downtown.js │ │ │ │ │ └── traffic_impact_fee.js │ │ │ │ ├── location.js │ │ │ │ ├── navigation.js │ │ │ │ ├── requirement.js │ │ │ │ ├── session.js │ │ │ │ ├── user.js │ │ │ │ └── util.js │ │ │ └── router.js │ │ ├── cic_codes.js │ │ ├── libs │ │ │ ├── almond.js │ │ │ ├── backbone.js │ │ │ ├── bootstrap-typeahead.js │ │ │ ├── jquery-ui.js │ │ │ ├── jquery.js │ │ │ ├── lodash.js │ │ │ └── require.js │ │ ├── permits.js │ │ └── plugins │ │ │ ├── backbone.layoutmanager.js │ │ │ └── backbone.localStorage.js │ ├── pdf │ │ └── city │ │ │ ├── business-license.pdf │ │ │ ├── land-use-application.pdf │ │ │ └── owner-agent.pdf │ └── stylesheets │ │ ├── admin │ │ ├── cic_code_zoning_districts.css.scss │ │ ├── cic_codes.css.scss │ │ ├── requirements.css.scss │ │ └── zoning_districts.css.scss │ │ ├── application.css.erb │ │ ├── bootstrap.css │ │ ├── colors.css │ │ └── layout.css ├── controllers │ ├── admin │ │ ├── admin_users_controller.rb │ │ ├── applications_controller.rb │ │ ├── cic_code_zoning_districts_controller.rb │ │ ├── cic_codes_controller.rb │ │ ├── requirements_controller.rb │ │ └── zoning_districts_controller.rb │ ├── answers_controller.rb │ ├── application_controller.rb │ ├── businesses_controller.rb │ ├── cic_codes_controller.rb │ ├── home_controller.rb │ ├── panels_controller.rb │ ├── permits_controller.rb │ ├── requirements_controller.rb │ ├── sessions_controller.rb │ ├── sic_controller.rb │ └── users_controller.rb ├── helpers │ ├── admin │ │ ├── admin_users_helper.rb │ │ ├── cic_code_zoning_districts_helper.rb │ │ ├── cic_codes_helper.rb │ │ ├── requirements_helper.rb │ │ └── zoning_districts_helper.rb │ ├── answers_helper.rb │ ├── application_helper.rb │ ├── business_helper.rb │ ├── cic_codes_helper.rb │ ├── home_helper.rb │ ├── permits_helper.rb │ └── users_helper.rb ├── mailers │ ├── .gitkeep │ └── planning_mailer.rb ├── models │ ├── .gitkeep │ ├── admin_user.rb │ ├── answer.rb │ ├── business.rb │ ├── cic_code.rb │ ├── cic_code_requirement.rb │ ├── cic_code_zoning_district.rb │ ├── form.rb │ ├── requirement.rb │ ├── sic_code.rb │ ├── user.rb │ └── zoning_district.rb └── views │ ├── admin │ ├── admin_users │ │ ├── _form.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── applications │ │ ├── index.html.erb │ │ └── show.html.erb │ ├── cic_codes │ │ ├── _form.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ └── new.html.erb │ ├── requirements │ │ ├── _form.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ └── new.html.erb │ └── zoning_districts │ │ ├── _form.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── new.html.erb │ │ └── show.html.erb │ ├── devise │ ├── confirmations │ │ └── new.html.erb │ ├── mailer │ │ ├── confirmation_instructions.html.erb │ │ ├── reset_password_instructions.html.erb │ │ └── unlock_instructions.html.erb │ ├── passwords │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── sessions │ │ └── new.html.erb │ ├── shared │ │ └── _links.erb │ └── unlocks │ │ └── new.html.erb │ ├── layouts │ ├── admin.html.erb │ └── application.html.erb │ ├── panels │ ├── info.html.erb │ ├── info_applicant.html.erb │ ├── info_business.html.erb │ ├── intro.html.erb │ ├── intro_big_picture.html.erb │ ├── intro_here_to_help.html.erb │ ├── location.html.erb │ ├── location_home_occ.html.erb │ ├── location_non_home_occ.html.erb │ ├── location_non_home_occ_check_site.html.erb │ ├── location_non_home_occ_choose_site.html.erb │ ├── requirement_application_for_utility_service.html.erb │ ├── requirement_building_permit.html.erb │ ├── requirement_business_license.html.erb │ ├── requirement_environmental_health_permit.html.erb │ ├── requirement_fictitious_business_name.html.erb │ ├── requirement_fictitious_business_name_statement.html.erb │ ├── requirement_incorporation.html.erb │ ├── requirement_non_city_regulations.html.erb │ ├── requirement_owner_agent_form.html.erb │ ├── requirement_payroll_tax_registration.html.erb │ ├── requirement_resellers_license.html.erb │ ├── requirement_secretary_of_state_registration.html.erb │ ├── requirement_use_permit.html.erb │ ├── requirement_zoning_clearance.html.erb │ ├── requirements.html.erb │ └── summary.html.erb │ ├── planning_mailer │ ├── application_email.html.erb │ ├── application_email.text.erb │ └── help_email.text.erb │ └── utilities │ ├── _contact.html.erb │ ├── _contact_thanks.html.erb │ ├── _credits.html.erb │ ├── _feedback.html.erb │ ├── _feedback_thanks.html.erb │ └── _profile.html.erb ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database_sample.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── airbrake.rb │ ├── backtrace_silencers.rb │ ├── devise.rb │ ├── formtastic.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── secret_token.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ ├── on_the_spot.en.yml │ └── on_the_spot.fr.yml ├── requirejs.yml └── routes.rb ├── db ├── migrate │ ├── 20120713193322_create_fields.rb │ ├── 20120713193521_create_forms.rb │ ├── 20120713193609_create_users.rb │ ├── 20120713193643_create_answers.rb │ ├── 20120713205437_create_fields_forms.rb │ ├── 20120730221215_add_jurisdiction_to_forms.rb │ ├── 20120730234125_add_phone_to_users.rb │ ├── 20120730234147_add_role_to_users.rb │ ├── 20120803223450_add_name_and_key_to_fields.rb │ ├── 20120803224303_remove_timestamps_from_form_fields.rb │ ├── 20120805180714_create_fees.rb │ ├── 20120815011951_create_businesses.rb │ ├── 20120822014908_delete_fees_table.rb │ ├── 20120822014923_add_business_id_to_answer.rb │ ├── 20120822015102_remove_user_id_from_answer.rb │ ├── 20120919214135_create_delayed_jobs.rb │ ├── 20120921215004_change_answer_and_field.rb │ ├── 20120921221142_change_phone_type.rb │ ├── 20120921225738_change_field_i_dto_field_name.rb │ ├── 20120924214233_create_cic_codes.rb │ ├── 20120924220105_create_zoning_districts.rb │ ├── 20120924221042_create_cic_code_zoning_districts.rb │ ├── 20120927020404_add_parent_id_to_cic_codes.rb │ ├── 20120928225408_create_sic_codes.rb │ ├── 20121102212652_create_requirements.rb │ ├── 20121104190433_create_cic_code_requirements.rb │ ├── 20121112181309_add_shortname_to_requirements.rb │ ├── 20121112193530_add_home_occ_to_requirements.rb │ ├── 20121112195940_create_requirement_zoning_districts.rb │ ├── 20121115180142_devise_create_admin_users.rb │ ├── 20121120213750_add_submitted_to_businesses.rb │ ├── 20121120222310_add_submitted_at_to_businesses.rb │ ├── 20121205214719_add_remember_token_to_users.rb │ ├── 20121210205959_remove_remember_token_from_users.rb │ ├── 20121220221822_add_password_digest_to_users.rb │ ├── 20121221012848_add_account_type_to_users.rb │ ├── 20121223214141_remove_field.rb │ ├── 20121223223006_add_token_to_businesses.rb │ ├── 20121224003012_add_token_index_to_users.rb │ ├── 20121224042232_add_current_business_to_user.rb │ ├── 20121224045321_change_current_business_token_to_string.rb │ └── 20130106075302_add_sort_order_to_requirements.rb ├── schema.rb └── seeds.rb ├── demo ├── css │ └── style.css ├── img │ ├── opencounter_logo.png │ ├── planning-department-map.jpg │ └── planning-department.png ├── index.html └── js │ ├── app.js │ ├── calculator.parking.js │ ├── calculator.zoning.js │ ├── data.naics.js │ ├── lib │ ├── jquery-1.7.2.min.js │ ├── jquery-ui-1.8.22.custom.min.js │ └── jquery.tinypubsub.js │ ├── location.js │ └── routing.js ├── doc ├── README_FOR_APP └── form_fields.csv ├── lib ├── assets │ └── .gitkeep ├── tasks │ ├── .gitkeep │ ├── import_cic_code_zoning_districts.rake │ ├── import_cic_codes.rake │ ├── import_cic_sic_connections.rake │ ├── import_sic_codes.rake │ └── import_zoning_districts.rake └── templates │ └── erb │ └── scaffold │ └── _form.html.erb ├── license.md ├── log └── .gitkeep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── index.html ├── robots.txt └── templates │ ├── fees │ └── parking-non-downtown.html │ ├── helpers │ ├── city │ │ ├── administrative_use_permit.txt │ │ ├── bida.txt │ │ ├── building_permit.txt │ │ ├── business_license.txt │ │ ├── ehs.txt │ │ ├── parking.txt │ │ ├── sign.txt │ │ ├── special_use_permit.txt │ │ ├── traffic_impact_fee.txt │ │ ├── utility_services.txt │ │ ├── waste_water_discharge.txt │ │ └── zoning_clearance.txt │ ├── county │ │ └── fbn.txt │ ├── federal │ │ └── irs_ein.txt │ └── state │ │ ├── abc.txt │ │ ├── incorporation.txt │ │ ├── payroll_tax.txt │ │ └── sellers_permit.txt │ ├── layouts │ └── main.html │ ├── navigation.html │ ├── panels │ ├── about.html │ ├── help.html │ ├── info.html │ ├── info │ │ ├── applicant.html │ │ └── business.html │ ├── intro │ │ ├── big_picture.html │ │ ├── here_to_help.html │ │ └── sign_in.html │ ├── location.html │ ├── location │ │ ├── check.html │ │ ├── commercial.html │ │ ├── home.html │ │ └── research.html │ ├── requirements.html │ ├── requirements │ │ ├── city │ │ │ ├── admissions_tax.html │ │ │ ├── building_permit.html │ │ │ ├── business_improvement_district.html │ │ │ ├── business_license.html │ │ │ ├── parking.html │ │ │ ├── parking_non_downtown.html │ │ │ ├── planning_permit.html │ │ │ ├── sign_permit.html │ │ │ ├── traffic_impact_fee.html │ │ │ ├── transit_occupancy_tax.html │ │ │ ├── utility_services.html │ │ │ └── waste_water_discharge.html │ │ ├── county │ │ │ ├── environmental_health_safety.html │ │ │ └── fictitious_business_name.html │ │ ├── federal │ │ │ └── irs_ein_application.html │ │ └── state │ │ │ ├── alcoholic_beverage_control.html │ │ │ ├── incorporation.html │ │ │ ├── payroll_tax.html │ │ │ └── sellers_permit.html │ ├── summary.html │ └── welcome.html │ ├── profile.html │ └── subnavigation.html ├── script ├── delayed_job └── rails ├── spec ├── controllers │ ├── admin │ │ ├── admin_users_controller_spec.rb │ │ ├── cic_code_zoning_districts_controller_spec.rb │ │ ├── cic_codes_controller_spec.rb │ │ ├── requirements_controller_spec.rb │ │ └── zoning_districts_controller_spec.rb │ ├── answers_controller_spec.rb │ ├── businesses_controller_spec.rb │ ├── cic_codes_controller_spec.rb │ ├── home_controller_spec.rb │ ├── permits_controller_spec.rb │ ├── sessions_controller_spec.rb │ └── users_controller_spec.rb ├── factories │ ├── admin_users.rb │ ├── answers.rb │ ├── businesses.rb │ ├── cic_code_requirements.rb │ ├── cic_code_zoning_districts.rb │ ├── cic_codes.rb │ ├── fields.rb │ ├── forms.rb │ ├── requirements.rb │ ├── sic_codes.rb │ ├── users.rb │ └── zoning_districts.rb ├── helpers │ ├── admin │ │ ├── admin_users_helper_spec.rb │ │ ├── cic_code_zoning_districts_helper_spec.rb │ │ ├── cic_codes_helper_spec.rb │ │ ├── requirements_helper_spec.rb │ │ └── zoning_districts_helper_spec.rb │ ├── answers_helper_spec.rb │ ├── business_helper_spec.rb │ ├── cic_codes_helper_spec.rb │ ├── home_helper_spec.rb │ ├── permits_helper_spec.rb │ └── users_helper_spec.rb ├── mailers │ └── planning_mailer_spec.rb ├── models │ ├── admin_user_spec.rb │ ├── answer_spec.rb │ ├── application_spec.rb │ ├── business_spec.rb │ ├── cic_code_requirement_spec.rb │ ├── cic_code_spec.rb │ ├── cic_code_zoning_district_spec.rb │ ├── field_spec.rb │ ├── form_spec.rb │ ├── requirement_spec.rb │ ├── sic_code_spec.rb │ ├── user_spec.rb │ └── zoning_district_spec.rb └── spec_helper.rb └── vendor ├── assets ├── javascripts │ └── .gitkeep └── stylesheets │ └── .gitkeep └── plugins └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile ~/.gitignore_global 6 | 7 | # Ignore bundler config 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | 13 | #Ignore env config 14 | .env 15 | 16 | # Ignore all logfiles and tempfiles. 17 | /log/*.log 18 | /tmp 19 | /data 20 | 21 | .DS_Store 22 | 23 | /config/database.yml 24 | 25 | # exclude ctags 26 | TAGS 27 | !TAGS/ 28 | tags 29 | !tags/ 30 | -------------------------------------------------------------------------------- /.rbenv-version: -------------------------------------------------------------------------------- 1 | 1.9.2-p320 2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This is an RVM Project .rvmrc file, used to automatically load the ruby 4 | # development environment upon cd'ing into the directory 5 | 6 | # First we specify our desired [@], the @gemset name is optional, 7 | # Only full ruby name is supported here, for short names use: 8 | # echo "rvm use 1.9.2" > .rvmrc 9 | environment_id="ruby-1.9.2-p320@opencounter" 10 | 11 | # Uncomment the following lines if you want to verify rvm version per project 12 | # rvmrc_rvm_version="1.14.5 ()" # 1.10.1 seams as a safe start 13 | # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || { 14 | # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading." 15 | # return 1 16 | # } 17 | 18 | # First we attempt to load the desired environment directly from the environment 19 | # file. This is very fast and efficient compared to running through the entire 20 | # CLI and selector. If you want feedback on which environment was used then 21 | # insert the word 'use' after --create as this triggers verbose mode. 22 | if [[ -d "${rvm_path:-$HOME/.rvm}/environments" 23 | && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] 24 | then 25 | \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" 26 | [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] && 27 | \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true 28 | else 29 | # If the environment file has not yet been created, use the RVM CLI to select. 30 | rvm --create "$environment_id" || { 31 | echo "Failed to create RVM environment '${environment_id}'." 32 | return 1 33 | } 34 | fi 35 | 36 | # If you use bundler, this might be useful to you: 37 | # if [[ -s Gemfile ]] && { 38 | # ! builtin command -v bundle >/dev/null || 39 | # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null 40 | # } 41 | # then 42 | # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n" 43 | # gem install bundler 44 | # fi 45 | # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null 46 | # then 47 | # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete' 48 | # fi 49 | -------------------------------------------------------------------------------- /.rvmrc.09.14.2012-11:22:17: -------------------------------------------------------------------------------- 1 | rvm 1.9.3@opencounter 2 | -------------------------------------------------------------------------------- /.rvmrc.09.28.2012-15:18:50: -------------------------------------------------------------------------------- 1 | rvm use 1.9.3@opencounter 2 | 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | gem 'rails', '3.2.12' 4 | 5 | # Bundle edge Rails instead: 6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' 7 | 8 | gem 'pg' 9 | 10 | gem 'thin' 11 | 12 | gem 'jquery-rails' 13 | gem 'requirejs-rails' 14 | 15 | gem 'inherited_resources' 16 | 17 | # to split up the long admin forms 18 | gem 'will_paginate', '~> 3.0' 19 | 20 | # To use Formtastic, a Rails form builder plugin 21 | gem 'formtastic' 22 | 23 | gem 'csv-mapper' 24 | gem 'fuzzy-string-match_pure' 25 | 26 | gem 'delayed_job_active_record' 27 | gem 'therubyracer', :platforms => :ruby 28 | gem 'execjs' 29 | gem 'devise' 30 | gem 'airbrake' 31 | 32 | gem 'ranked-model' 33 | gem 'newrelic_rpm' 34 | 35 | # Gems used only for assets and not required 36 | # in production environments by default. 37 | group :assets do 38 | gem 'sass-rails', '~> 3.2.3' 39 | 40 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 41 | # gem 'therubyracer', :platforms => :ruby 42 | 43 | gem 'uglifier', '>= 1.0.3' 44 | end 45 | 46 | group :test, :development do 47 | gem "rspec-rails", "~> 2.0" 48 | gem "capybara" 49 | gem "factory_girl_rails" 50 | gem "shoulda-matchers" 51 | gem "faker" 52 | 53 | # To use debugger 54 | gem 'debugger' 55 | 56 | gem 'foreman' 57 | end 58 | 59 | group :development do 60 | gem 'heroku' 61 | gem 'taps' 62 | gem 'sqlite3' #need this for taps to work 63 | end 64 | 65 | # To use ActiveModel has_secure_password 66 | # gem 'bcrypt-ruby', '~> 3.0.0' 67 | 68 | # To use Jbuilder templates for JSON 69 | # gem 'jbuilder' 70 | 71 | # Use unicorn as the app server 72 | # gem 'unicorn' 73 | 74 | # Deploy with Capistrano 75 | # gem 'capistrano' 76 | 77 | gem 'csv-mapper' 78 | gem 'fuzzy-string-match_pure' 79 | gem 'pry-rails' 80 | gem 'on_the_spot' 81 | gem 'bcrypt-ruby', '3.0.1' 82 | 83 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec thin start -p $PORT -e $RACK_ENV 2 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Opencounter::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/assets/csv/cic_codes_and_zoning_districts.csv: -------------------------------------------------------------------------------- 1 | zoning district,zoning clearance,administrative,special,prohibited,unknown, 2 | R-S,"800A, 800B",,,,, 3 | R-1,,,,,, 4 | R-L,"830, 840",,,,, 5 | R-M,"830, 840g",,,,, 6 | R-H,"830, 840, 510A","800, 810, 300C, 850E, 410B, 930, 710, 500, 510, 530, 540s ","300, 850, 410, 930, 710, 500, 510, 530, 540, 570",,, 7 | R-T(A) ,"810, 510",810,830,"300, 850, 510, 850, 840, 710, 500, 510, 530, 540, 570, 850b",, 8 | R-T(B),,"830, 800, 810","280, 850, 510, 300, 840, 940, 950, 710, 500, 510, 530, 540, 570, 850b",,, 9 | R-T(B)/PER,,,,,, 10 | R-T(C) ,"240, 300, 820, 930, 280","610, 250, 500, 570, 240B, 710, 700, 280, 510, 230, 530, 270, 240B, 830, 600, 400, 340, 860, 290 360B, 720,","280C, 550, 280H, 400, 840, 560E, 400L, 330, 200F, 830, 630, 930, 800, 860, 720, 620, 540, 400, 810, 310, 820, 510, 420, 410",,, 11 | R-T(C)/PER,"125, 230, 250, 290, 281, 000","600, 610, 300, 930, 620, 630",,,, 12 | R-T(D),"800, 810, 510A",,"850, 510, 830, 840, 710, 500, 510, 530, 540, 570, 850b",,, 13 | R-T(E),,,,,, 14 | C-C,"610, 250, 260C, 280A, 280B, 280D, 280E, 280F, 280G, 420, 320, 240A, 240C, 240D, 240E, 240F, 240G, 240H, 230, 270, 410B, 410C, 410D, 410E, 410F, 410G, 830, 600, 930, 400, 310A, 310B, 310C, 310D, 310F, 310G, 310H, 310J, 310K, 310L, 340A, 340B, 340C, 340E, 340F, 510A, 290A, 290B, 290C, 290D, 290E, 290F, 290G, 290H, 290I, 290J, 290K, 290L, 290N, 290O, 290P, 290Q, 290R, 290S, 290T, 290U, 290V, 290W, 290X, 290Y, 290Z, 620, 650","350, 280C, 340D, 220, 500, 550, 570, 710, 510, 280H, 530, 300, 260, 830, 930, 860, 290M, 700, 540, 410A","310E, 150, 155A, 100, 120, 520, 560B, 105, 840, 310I, 155, 630, 360, 860, 155C, 720, 140, 330, 200A, 200B, 200C, 200D, 210, 210E, 210F",,, 15 | C-T,,,,,, 16 | C-N,"280, 420, 320, 240, 220A, 410, 830, 930, 400, 310","610, 250, 260C, 500, 570, 510, 230, 530, 270, 830, 700, 510A, 340, 290, 410A, 650","350, 280H, 840, 930, 720, 330",,, 17 | C-B,"610, 250, 280, 420, 240, 230, 300, 560E, 830, 600, 930, 310, 400 290, 720, 620, 650","240B, 500, 510, 320, 200F, 530, 270B, 700, 340, 290","280H, 850, 840, 840, 630, 930 ",,, 18 | P-A,"420, 320, 930, 400, 310, 410, 600, 810x","500, 550, 570, 820, 510, 530, 870, 830, 930, 810, 410A ","520, 310I, 830, 410B",,, 19 | I-G,"610, 220, 420, 100, 120L, 410, 105P, 400, 310, 360, 340S, 210, 330, 200 ","350, 340D, 500, 550, 570, 280, 510, 150, 240, 010, 530, 110, 930, 155, 140, 700, 560, 540","220, 130L, 850, 830, 840, 630, 125, 720, 145, 135M",,, 20 | I-G PER ,"610, 220, 420, 100, 120, 410, 105P, 400, 310, 360, 340S, S210, 300, 200 ","350, 340D, 500, 550, 570, 280, 510, 150, 240, 010, 530, 110, 930, 155, 140, 700, 560, 540","220, 130, 850, 830, 840, 630, 125, 720, 145, 135M",,, 21 | I-G PER-2,"610, 510F, 220, 550, 420, 150, 100, 120, 410, 105, 155, 145, 135P, 400, 310, 360, 340S, 140, 330T, 210, 200","350, 280, 010, 110, 930, 540s","220, 130, 240, 530, 850, 830, 840, 125, 720M, 560",,, -------------------------------------------------------------------------------- /app/assets/csv/zoning_districts_and_sic_codes.csv: -------------------------------------------------------------------------------- 1 | "zoning district","zoning clearance","administrative","special","prohibited","unknown" 2 | R-S,"800A,800B",,,, 3 | R-1,,,,, 4 | R-L,"830,840","","",, 5 | R-M,"830,,840g",s,,, 6 | R-H,"830,840,510A","800,810, 300C, 850E, 410B, 930, 710, 500, 510, 530, 540s ","300,850,410,930,710,500, 510, 530, 540, 570",, 7 | R-T(A) ,"810,510",810,830,"300,850,510,850,840,710, 500,510, 530, 540, 570, 850b",, 8 | R-T(B),,"830,800,810","280,850,510,300,840,940, 950, 710, 500, 510, 530, 540, 570, 850b",, 9 | R-T(B)/PER,,,,, 10 | R-T(C) ,"240,300,820,930, 280","610,250, 500, 570, 240B, 710, 700, 280, 510, 230, 530, 270, 240B, 830, 600, 400, 340, 860, 290 360B, 720,","280C,,550,280H,400, 840, 560E, 400L, 330, 200F, 830, 630, 930, 800, 860, 720, 620, 540, 400, 810, 310, 820, 510, 420, 410",, 11 | R-T(C)/PER,"125,230, 250, 290,280,930 ",", P600, 610,300,O930, 620, 630",, 12 | R-T(D),"800, 810,510A","","C850,510,830,840,710,500, 510, 530, 540, 570,850b",, 13 | R-T(E),"","","",, 14 | C-C,"610,,250, 260C, 280A, 280B, 280D, 280E, 280F, 280G, 420, 320, 240A, 240C, 240D, 240E, 240F, 240G, 240H, 230, 270, 410B, 410C, 410D, 410E, 410F, 410G, 830600, 930400, 310A, 310B, 310C, 310D, 310F, 310G, 310H, 310J, 310K, 310L, 340A, 340B, 340C, 340E, 340F, 510A, 290A, 290B, 290C, 290D, 290E, 290F, 290G, 290H, 290I, 290J, 290K, 290L, 290N, 290O, 290P, 290Q, 290R, 290S, 290T, 290U, 290V, 290W, 290X, 290Y, 290Z, 620, 650","S24.12.140410B,,350, 280C, 340D, 220, 500, 550, 570, 710, 510, 280H 530, 300 260, 830930, 860290M, 700, 540, 410A","C,310E, 150, 155A, 100, 120, 520 560B, 105, 840, 310I, 155, 630, 360, 860, 155C, 720, 140, 330, 200A, 200B, 200C, 200D, 210, 210E, 210F",, 15 | C-T,"","","",, 16 | C-N,"280,420, 320, 240, 220A, 410, 830, 930, 400, 310","610, 250, 260C, 500, 570, 510, 230, 530, 270, 830, 700, 510A 340 290,410A, 650","350,280H,840, 930, 720, 330",, 17 | C-B,"610,,250, 280, 420, 240, 230, 300, 560E, 830, 600, 930, 310, 400 290, 720, 620, 650","240B, 500, 510, 320, 200F, 530, 270B, 700, 340,290","280H, 850, 840, 840, 630, 930 ",, 18 | P-A,"420,320, 930, 400, 310, 410, 600, 810x","500, 550, 570, 820, 510,530, 870, 830, 930, 810, 410A ","520, 310I, 830, 410B",, 19 | I-G,"610,,220, 420, 100, 120L, 410, 105P, 400, 310, 360, 340S S210, 330, 200 ","350, 340D, 500, 550, 570, 280, 510, 150, 240, 010, 530, 110, 930, 155, 140, 700, 560, 540","220,,130L, 850, 830, 840, 630, 125, 720, 145, 135M",, 20 | I-G PER ,"610,,220, 420, 100, 120, 410, 105P, 400, 310, 360, 340S,S210, 300, 200 ","350, 340D, 500, 550, 570, 280, 510, 150, 240, 010, 530, 110, 930, 155, 140, 700,560,540","220,,130, 850, 830, 840, 630, 125, 720, 145, 135M",, 21 | I-G PER-2,"610,510F, 220, 550, 420, 150, 100, 120, 410, 105, 155, 145, 135P, 400, 310, 360, 340S S140, 330T 210, 200","350, 280, 010, 110, 930, 540s","220,130, 240, 530, 850, 830, 840, 125, 720M 560",, 22 | -------------------------------------------------------------------------------- /app/assets/images/assets-nav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/assets-nav.png -------------------------------------------------------------------------------- /app/assets/images/handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/handle.png -------------------------------------------------------------------------------- /app/assets/images/opencounter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/opencounter_logo.png -------------------------------------------------------------------------------- /app/assets/images/opencounter_logo.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/opencounter_logo.psd -------------------------------------------------------------------------------- /app/assets/images/planning-department-map.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/planning-department-map.jpg -------------------------------------------------------------------------------- /app/assets/images/planning-department.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/planning-department.png -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/assets/javascripts/app/config.js: -------------------------------------------------------------------------------- 1 | // Set the require.js configuration for your application. 2 | require.config({ 3 | 4 | // Initialize the application with the main application file. 5 | //deps: ["main"], 6 | baseUrl: "/assets/app/", 7 | paths: { 8 | // JavaScript folders. 9 | libs: "../libs", 10 | plugins: "../plugins", 11 | 12 | // Libraries. 13 | jquery: "../libs/jquery", 14 | jqueryui: "../libs/jquery-ui", 15 | lodash: "../libs/lodash", 16 | backbone: "../libs/backbone", 17 | bootstrap_typeahead: "../libs/bootstrap-typeahead" 18 | }, 19 | 20 | shim: { 21 | // Backbone library depends on lodash and jQuery. 22 | backbone: { 23 | deps: ["lodash", "jquery"], 24 | exports: "Backbone" 25 | }, 26 | '../libs/jquery-ui': ['jquery'], 27 | '../libs/bootstrap-typeahead': ['jquery'], 28 | // Backbone.LayoutManager depends on Backbone. 29 | "plugins/backbone.layoutmanager": ["backbone"] 30 | 31 | } 32 | 33 | }); 34 | -------------------------------------------------------------------------------- /app/assets/javascripts/app/main.js: -------------------------------------------------------------------------------- 1 | require([ 2 | // Application. 3 | "app", 4 | 5 | // Main Router. 6 | "router" 7 | ], 8 | 9 | function(app, Router) { 10 | 11 | // Define your master router on the application namespace and trigger all 12 | // navigation from this instance. 13 | app.router = new Router(function() { 14 | // Trigger the initial route and enable HTML5 History API support, set the 15 | // root folder to '/' by default. Change in app.js. 16 | Backbone.history.start({ pushState: true, root: app.root }); 17 | }); 18 | 19 | // All navigation that is relative should be passed through the navigate 20 | // method, to be processed by the router. If the link has a `data-bypass` 21 | // attribute, bypass the delegation completely. 22 | $(document).on("click", "a:not([data-bypass])", function(evt) { 23 | // Get the absolute anchor href. 24 | var href = $(this).attr("href"); 25 | var protocol = this.protocol + "//"; 26 | 27 | // Ensure the protocol is not part of URL, meaning it's relative. 28 | if (href && href.slice(0, protocol.length) !== protocol && 29 | href.indexOf("javascript:") !== 0 && 30 | href.indexOf("mailto:") !== 0) { 31 | 32 | // Stop the default event to ensure the link will not cause a page 33 | // refresh. 34 | evt.preventDefault(); 35 | 36 | // `Backbone.history.navigate` is sufficient for all Routers and will 37 | // trigger the correct events. The Router's internal `navigate` method 38 | // calls this anyways. The fragment is sliced from the root. 39 | Backbone.history.navigate(href, true); 40 | } 41 | 42 | }); 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /app/assets/javascripts/app/modules/requirement.js: -------------------------------------------------------------------------------- 1 | define([ 2 | // Application. 3 | "app", 4 | "modules/answer", 5 | ], 6 | 7 | // Map dependencies from above array. 8 | function(app, answer) { 9 | 10 | // Create a new module. 11 | var Requirement = app.module(); 12 | 13 | // Default model. 14 | Requirement.Model = Backbone.Model.extend({ 15 | name: 'requirement', 16 | url: function(){ 17 | return this.id ? ('/requirements/' + this.id) : '/requirements'; 18 | } 19 | }); 20 | 21 | // Default collection. 22 | Requirement.Collection = Backbone.Collection.extend({ 23 | model: Requirement.Model, 24 | url: '/requirements', 25 | 26 | matchingIndex: function(jurisdiction, shortName) { 27 | var index = -1; 28 | for (var i = 0, len = this.length; i < len; i++) { 29 | var requirement = this.at(i); 30 | if (requirement.get("jurisdiction").toLowerCase() === jurisdiction && requirement.get("short_name").toLowerCase() === shortName) { 31 | index = i; 32 | } 33 | } 34 | return index; 35 | } 36 | }); 37 | 38 | Requirement.lookupRequirements = function() { 39 | var cic = this.answers.getAnswer("CIC_code"); 40 | if (cic) { 41 | // grab the requirements for this code 42 | var self = this; 43 | 44 | $.ajax({ 45 | url: "/api/lookup/requirements", 46 | data: {cic: cic}, 47 | dataType: "json", 48 | async: false, 49 | success: function (data){ 50 | self.requirements.reset(data); 51 | } 52 | }); 53 | } else { 54 | this.requirements.reset([]); 55 | } 56 | }; 57 | 58 | Requirement.Views.Panel = answer.Views.Panel.extend({ 59 | initialize: function(o) { 60 | this.pathInfo = window.location.pathname.toLowerCase().split("/").slice(2); 61 | this.pathInfo = { 62 | jurisdiction: this.pathInfo[0], 63 | shortName: this.pathInfo[1] 64 | }; 65 | answer.Views.Panel.prototype.initialize.call(this, o); 66 | }, 67 | 68 | serialize: function() { 69 | var result = answer.Views.Panel.prototype.serialize.call(this); 70 | var requirementIndex = this.requirements.matchingIndex(this.pathInfo.jurisdiction, this.pathInfo.shortName); 71 | result.pathInfo = this.pathInfo; 72 | result.firstRequirement = this.requirements.at(0); 73 | if ((requirementIndex + 1) < this.requirements.length) { 74 | var nextRequirement = this.requirements.at(requirementIndex + 1); 75 | result.nextRequirementHref = "/requirements/" + nextRequirement.get('jurisdiction').toLowerCase() + "/" + nextRequirement.get('short_name'); 76 | result.nextRequirementName = nextRequirement.get('name'); 77 | } else { 78 | result.nextRequirementHref = "/summary"; 79 | result.nextRequirementName = "Summary"; 80 | } 81 | return result; 82 | } 83 | }); 84 | // Return the module for AMD compliance. 85 | return Requirement; 86 | 87 | }); 88 | -------------------------------------------------------------------------------- /app/assets/javascripts/app/modules/session.js: -------------------------------------------------------------------------------- 1 | define([ 2 | // Application. 3 | "app" 4 | ], 5 | 6 | // Map dependencies from above array. 7 | function(app) { 8 | 9 | Session = Backbone.View.extend( { 10 | currentUser: function() { 11 | var user 12 | $.ajax({ 13 | url: "/sessions/show.json", 14 | dataType: "json", 15 | // TODO: make asychronous 16 | async: false, 17 | success: function(data) { 18 | user = data 19 | } 20 | }); 21 | // console.log("currentUser returning: ", user) 22 | return user; 23 | }, 24 | 25 | logout: function() { 26 | var self = this; 27 | $.ajax({ 28 | url: "/sessions/destroy.json", 29 | dataType: "json", 30 | async: false, 31 | success: function(data) { 32 | console.log("Successfully logged out") 33 | // FIXME: does not work on the home page... 34 | window.location.reload(); 35 | } 36 | }); 37 | }, 38 | 39 | login: function(email, password) { 40 | var self = this; 41 | $.ajax({ 42 | url: "/sessions/create.json", 43 | dataType: "json", 44 | async: false, 45 | type: "POST", 46 | beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, 47 | data: { 48 | "email": email, 49 | "password": password 50 | }, 51 | success: function(data) { 52 | console.log("Successfully logged in", data) 53 | window.location.pathname = "/info/applicant" 54 | }, 55 | error: function(data) { 56 | console.log("Error logging in.") 57 | $("div#errors > h4").html("We couldn't log you in") 58 | $("div#errors > span").html("Please check you have the right email address and password.") 59 | $("div#errors").removeClass("hidden") 60 | } 61 | 62 | }); 63 | }, 64 | }); 65 | 66 | return new Session(); 67 | }); 68 | -------------------------------------------------------------------------------- /app/assets/javascripts/app/modules/util.js: -------------------------------------------------------------------------------- 1 | define([ 2 | // Application. 3 | "app" 4 | ], 5 | 6 | function(app) { 7 | 8 | var Util = app.module(); 9 | 10 | Util.requirementsTypeLookup = { 11 | "100": ["food"], 12 | "200A": ["food"], 13 | "200B": ["food"], 14 | "200C": ["food"], 15 | "200F": ["food"], 16 | "200G": ["food"], 17 | "200H": ["food"], 18 | "200I": ["food"], 19 | "200J": ["food"], 20 | "200K": ["food"], 21 | "200L": ["food"], 22 | "200M": ["food", "alcohol"], 23 | "240A": ["food"], 24 | "240B": ["food"], 25 | "240C": ["food"], 26 | "240D": ["food"], 27 | "240E": ["food"], 28 | "240F": ["food"], 29 | "240G": ["food"], 30 | "240H": ["food"], 31 | "280A": ["food"], 32 | "280B": ["food"], 33 | "280C": ["food"], 34 | "280D": ["food"], 35 | "280E": ["food"], 36 | "280F": ["food"], 37 | "280G": ["food"], 38 | "280H": ["food"], 39 | "310J": ["food"] 40 | }; 41 | 42 | Util.requirementsForBusinessType = function(cicCode, businessType) { 43 | var requirements = Util.requirementsTypeLookup[cicCode] || []; 44 | 45 | if (businessType.indexOf("Trade (Wholesale and Retail)") !== -1) { 46 | requirements.push("retail") 47 | } 48 | 49 | return requirements; 50 | }; 51 | 52 | return Util; 53 | }); -------------------------------------------------------------------------------- /app/assets/javascripts/cic_codes.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/permits.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/pdf/city/business-license.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/pdf/city/business-license.pdf -------------------------------------------------------------------------------- /app/assets/pdf/city/land-use-application.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/pdf/city/land-use-application.pdf -------------------------------------------------------------------------------- /app/assets/pdf/city/owner-agent.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/assets/pdf/city/owner-agent.pdf -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/cic_code_zoning_districts.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/cic_code_zoning_districts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/cic_codes.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/cic_codes controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/requirements.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/requirements controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/zoning_districts.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the admin/zoning_districts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.erb: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /app/assets/stylesheets/colors.css: -------------------------------------------------------------------------------- 1 | /* 2 | yellow 3 | #FFFF33 4 | 5 | darker blue 6 | #1791BE 7 | 8 | lighter blue 9 | #8BC8DE 10 | 11 | gray 12 | #CCCCCC 13 | */ -------------------------------------------------------------------------------- /app/controllers/admin/admin_users_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::AdminUsersController < ApplicationController 2 | layout 'admin' 3 | before_filter :authenticate_admin_user! 4 | 5 | def index 6 | @admin_users = AdminUser.all 7 | end 8 | 9 | def edit 10 | @admin_user = AdminUser.find(params[:id]) 11 | end 12 | 13 | def update 14 | @admin_user = AdminUser.find(params[:id]) 15 | respond_to do |format| 16 | if @admin_user.update_attributes(params[:admin_user]) 17 | format.html { redirect_to admin_admin_users_url, notice: 'User was successfully updated' } 18 | else 19 | format.html { render action: "edit" } 20 | end 21 | end 22 | end 23 | 24 | def new 25 | @admin_user = AdminUser.new 26 | end 27 | 28 | def create 29 | @admin_user = AdminUser.new(params[:admin_user]) 30 | 31 | respond_to do |format| 32 | if @admin_user.save 33 | format.html { redirect_to admin_admin_users_url, notice: 'User was successfully created.' } 34 | else 35 | format.html { render action: "new" } 36 | end 37 | end 38 | end 39 | 40 | def destroy 41 | @admin_user = AdminUser.find(params[:id]) 42 | @admin_user.destroy 43 | 44 | respond_to do |format| 45 | format.html { redirect_to admin_admin_users_url } 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /app/controllers/admin/applications_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::ApplicationsController < ApplicationController 2 | layout 'admin' 3 | before_filter :authenticate_admin_user! 4 | 5 | def index 6 | @applications = Business.submitted.order("created_at desc").all 7 | end 8 | 9 | def show 10 | @application = Business.find_by_id(params[:id]) 11 | @user = @application.user 12 | end 13 | 14 | end 15 | 16 | -------------------------------------------------------------------------------- /app/controllers/admin/cic_code_zoning_districts_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::CicCodeZoningDistrictsController < ApplicationController 2 | layout 'admin' 3 | before_filter :authenticate_admin_user! 4 | 5 | def show 6 | @cic_code_zoning_district = CicCodeZoningDistrict.find(params[:id]) 7 | end 8 | 9 | def new 10 | @cic_code_zoning_district = CicCodeZoningDistrict.find(params[:id]) 11 | end 12 | 13 | def create 14 | @cic_code_zoning_district = CicCodeZoningDistrict.new(params[:cic_code_zoning_district]) 15 | 16 | respond_to do |format| 17 | if @cic_code_zoning_district.save 18 | format.html { redirect_to admin_zoning_districts_url, notice: 'CIC Code was successfully created.' } 19 | else 20 | format.html { render action: "new" } 21 | end 22 | end 23 | end 24 | 25 | def edit 26 | @cic_code_zoning_district = CicCodeZoningDistrict.find(params[:id]) 27 | end 28 | 29 | def update 30 | @cic_code_zoning_district = CicCodeZoningDistrict.find(params[:id]) 31 | @zoning_district = ZoningDistrict.find(params[:zoning_district_id]) 32 | 33 | respond_to do |format| 34 | if @cic_code_zoning_district.update_attributes(params[:cic_code_zoning_district]) 35 | format.html { redirect_to admin_zoning_district_url(@zoning_district), notice: 'Permissions were successfully updated.' } 36 | else 37 | format.html { render action: "edit" } 38 | end 39 | end 40 | end 41 | 42 | def destroy 43 | @cic_code_zoning_district = CicCodeZoningDistrict.find(params[:id]) 44 | @cic_code_zoning_district.destroy 45 | 46 | respond_to do |format| 47 | format.html { redirect_to admin_zoning_districts_url } 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /app/controllers/admin/cic_codes_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::CicCodesController < ApplicationController 2 | layout 'admin' 3 | before_filter :authenticate_admin_user! 4 | can_edit_on_the_spot 5 | 6 | def index 7 | @cic_codes = CicCode.all 8 | end 9 | 10 | def new 11 | @cic_code = CicCode.new(params[:cic_code]) 12 | end 13 | 14 | def create 15 | @cic_code = CicCode.new(params[:cic_code]) 16 | 17 | respond_to do |format| 18 | if @cic_code.save 19 | format.html { redirect_to admin_cic_codes_url, notice: 'CIC Code was successfully created.' } 20 | else 21 | format.html { render action: "new" } 22 | end 23 | end 24 | end 25 | 26 | def edit 27 | @cic_code = CicCode.find(params[:id]) 28 | @requirements = Requirement.all(:order => 'jurisdiction, name') 29 | end 30 | 31 | def update 32 | params[:cic_code][:requirement_ids] ||= [] 33 | @cic_code = CicCode.find(params[:id]) 34 | @requirements = Requirement.all(:order => 'jurisdiction, name') 35 | 36 | respond_to do |format| 37 | if @cic_code.update_attributes(params[:cic_code]) 38 | format.html { redirect_to admin_cic_codes_url, notice: 'CIC Code was successfully updated.' } 39 | else 40 | format.html { render action: "edit" } 41 | end 42 | end 43 | end 44 | 45 | def destroy 46 | @cic_code = CicCode.find(params[:id]) 47 | @cic_code.destroy 48 | 49 | respond_to do |format| 50 | format.html { redirect_to admin_cic_codes_url } 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /app/controllers/admin/requirements_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::RequirementsController < ApplicationController 2 | layout 'admin' 3 | before_filter :authenticate_admin_user!, :except => 'sort' 4 | 5 | def index 6 | @requirements = Requirement.rank(:sort_order).all 7 | end 8 | 9 | def edit 10 | @requirement = Requirement.find(params[:id]) 11 | end 12 | 13 | def update 14 | @requirement = Requirement.find(params[:id]) 15 | respond_to do |format| 16 | if @requirement.update_attributes(params[:requirement]) 17 | format.html { redirect_to admin_requirements_url, notice: 'Requirement was successfully updated' } 18 | else 19 | format.html { render action: "edit" } 20 | end 21 | end 22 | end 23 | 24 | def new 25 | @requirement = Requirement.new 26 | end 27 | 28 | def create 29 | @requirement = Requirement.new(params[:requirement]) 30 | 31 | respond_to do |format| 32 | if @requirement.save 33 | format.html { redirect_to admin_requirements_url, notice: 'Requirement was successfully created.' } 34 | else 35 | format.html { render action: "new" } 36 | end 37 | end 38 | end 39 | 40 | def destroy 41 | @requirement = Requirement.find(params[:id]) 42 | @requirement.destroy 43 | 44 | respond_to do |format| 45 | format.html { redirect_to admin_requirements_url } 46 | end 47 | end 48 | 49 | def sort 50 | id = params['requirement']['id'].gsub(/requirement_/, '') 51 | Requirement.find(id).update_attribute(:sort_order, params['requirement']['sort_order']) 52 | render :nothing => true 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /app/controllers/admin/zoning_districts_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::ZoningDistrictsController < ApplicationController 2 | layout 'admin' 3 | before_filter :authenticate_admin_user! 4 | can_edit_on_the_spot 5 | 6 | def index 7 | @zoning_districts = ZoningDistrict.all(:order => :code) 8 | end 9 | 10 | def show 11 | @zoning_district = ZoningDistrict.find(params[:id]) 12 | @cic_code_zoning_districts = @zoning_district.cic_code_zoning_districts.sorted_by_cic_code.paginate( 13 | :page => params[:page]) 14 | end 15 | 16 | def edit 17 | @zoning_district = ZoningDistrict.find(params[:id]) 18 | end 19 | 20 | def update 21 | @zoning_district = ZoningDistrict.find(params[:id]) 22 | 23 | respond_to do |format| 24 | if @zoning_district.update_attributes(params[:zoning_district]) 25 | format.html { redirect_to admin_zoning_districts_url, notice: 'Zoning District was successfully updated.' } 26 | else 27 | format.html { render action: "edit" } 28 | end 29 | end 30 | end 31 | 32 | def new 33 | @zoning_district = ZoningDistrict.new 34 | end 35 | 36 | def create 37 | 38 | end 39 | 40 | def destroy 41 | @zoning_district = ZoningDistrict.find(params[:id]) 42 | @zoning_district.destroy 43 | 44 | respond_to do |format| 45 | format.html { redirect_to admin_zoning_districts_url } 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /app/controllers/answers_controller.rb: -------------------------------------------------------------------------------- 1 | class AnswersController < InheritedResources::Base 2 | respond_to :html, :json, :xml 3 | 4 | def index 5 | if current_user 6 | @answers = current_user.current_business.answers 7 | end 8 | respond_with @answers 9 | end 10 | 11 | def create 12 | @answer = Answer.new(params[:answer]) 13 | if current_user 14 | @answer.business = current_user.current_business 15 | else 16 | # you can't save an answer without a user, so no current_user means there is a problem 17 | render({}, status: 500) 18 | end 19 | create! 20 | end 21 | 22 | def update 23 | @answer = Answer.find(params[:id]) 24 | @answer.update_attribute(:value, params[:answer][:value]) 25 | if current_user 26 | @answer.business = current_user.current_business 27 | else 28 | # you can't save an answer without a user, so no current_user means there is a problem 29 | render({}, status: 500) 30 | end 31 | @answer.save 32 | respond_with @answer 33 | # render :json => @answer 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | layout :layout_by_resource 4 | 5 | private 6 | 7 | # Can possibly cut down on code complexity by creating a temp user here if no current_user is present 8 | def current_user 9 | User.find_by_token(cookies[:token]) 10 | end 11 | helper_method :current_user 12 | 13 | def after_sign_in_path_for(resource_or_scope) 14 | admin_applications_url 15 | end 16 | 17 | def after_sign_out_path_for(resource_or_scope) 18 | root_url 19 | end 20 | 21 | def layout_by_resource 22 | if devise_controller? 23 | "admin" 24 | else 25 | "application" 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/controllers/businesses_controller.rb: -------------------------------------------------------------------------------- 1 | class BusinessesController < ApplicationController 2 | respond_to :json 3 | 4 | # # GET /business/new 5 | # def create 6 | # @biz = Business.create(params[:business]) 7 | # respond_with @biz 8 | # end 9 | 10 | # # PUT /business/1 11 | # # PUT /business/1.json 12 | # # Expected structure: 13 | # # {"business": {"name": "value"}, "answers": { "key": "value", "key": "value"}} 14 | 15 | # # TODO: change structure over to nested, make sure to copy params after pulling out answers so @biz.update_attrs doesn't fail 16 | # # OR push everything to biz and override the business.answers setter if rails does that 17 | # def update 18 | # @biz = Business.find(params[:id]) 19 | # errors = [] 20 | # errors << @biz.save_answers(params[:business][:answers]) if params[:business][:answers] 21 | # errors << @biz.update_attributes(params[:business]) if params[:business] 22 | 23 | # respond_to do |format| 24 | # if errors.empty? 25 | # # format.html { redirect_to @biz, notice: 'Business was successfully updated.' } 26 | # format.json { head :no_content } 27 | # else 28 | # # format.html { render action: "edit" } 29 | # format.json { render json: @biz.errors, status: :unprocessable_entity } 30 | # end 31 | # end 32 | 33 | # end 34 | end 35 | -------------------------------------------------------------------------------- /app/controllers/cic_codes_controller.rb: -------------------------------------------------------------------------------- 1 | require 'fuzzystringmatch' 2 | 3 | class CicCodesController < ApplicationController 4 | 5 | def index 6 | cic_codes = [] 7 | CicCode.all.each do |cic_code| 8 | cic_codes << {code: cic_code.code, industry: cic_code.industry, subindustry: cic_code.subindustry, industry_subindustry: cic_code.industry_subindustry, keywords: cic_code.search_terms} 9 | end 10 | query = params['q'].downcase 11 | query_distances = Array.new(cic_codes.length) 12 | terms = query.split(%r{\s+}) 13 | 14 | jarow = FuzzyStringMatch::JaroWinkler.create( :pure ) 15 | 16 | terms.each_with_index { |term, tindex| 17 | cic_codes.each_with_index { |cic_code, index| 18 | cic_code[:query_distance] = 0 if tindex == 0 19 | cic_code[:query_distance] +=1 unless cic_code[:keywords].try(:downcase).try(:match, term).blank? 20 | cic_code[:query_distance] += jarow.getDistance(query, cic_code[:keywords].try(:downcase)) 21 | } 22 | } 23 | 24 | cic_codes = cic_codes.sort{ |a, b| b[:query_distance] <=> a[:query_distance]} 25 | 26 | render :json => cic_codes[0...10] 27 | end 28 | 29 | 30 | end 31 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | respond_to :html 3 | 4 | def index 5 | 6 | end 7 | 8 | end 9 | -------------------------------------------------------------------------------- /app/controllers/panels_controller.rb: -------------------------------------------------------------------------------- 1 | class PanelsController < ApplicationController 2 | end -------------------------------------------------------------------------------- /app/controllers/permits_controller.rb: -------------------------------------------------------------------------------- 1 | class PermitsController < ApplicationController 2 | 3 | def show 4 | 5 | cic_code_id = CicCode.find_by_code(params['sic']).try(:id) 6 | 7 | zoning_district_id = ZoningDistrict.find_by_code(params['zoning']).try(:id) 8 | 9 | permissions = CicCodeZoningDistrict.find_by_cic_code_id_and_zoning_district_id(cic_code_id, zoning_district_id) 10 | 11 | # 1 = zoning clearance, 2 = aup, 3 = sup, 4 = prohibited, 5 = unknown 12 | permit = permissions.permission 13 | 14 | # true/false 15 | home_occ_prohibited = permissions.home_occ_prohibited 16 | 17 | # null or string 18 | notes = permissions.notes 19 | 20 | render :json => {"permit" => permit, "home_occ_prohibited" => home_occ_prohibited, "notes" => notes } 21 | 22 | end 23 | 24 | 25 | end 26 | -------------------------------------------------------------------------------- /app/controllers/requirements_controller.rb: -------------------------------------------------------------------------------- 1 | class RequirementsController < ApplicationController 2 | 3 | def index 4 | cic_code = params[:cic] 5 | if cic_code 6 | requirements = CicCode.find_by_code(cic_code).requirements 7 | else 8 | requirements = Requirement.all.order('name') 9 | end 10 | render :json => requirements 11 | end 12 | 13 | def show 14 | requirement = Requirement.find(params[:id]) 15 | render :json => requirement 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < ApplicationController 2 | respond_to :html, :json 3 | 4 | # login 5 | def create 6 | email, password = params[:email], params[:password] 7 | 8 | user = User.find_by_email( email ) 9 | if user.try(:authenticate, password) 10 | 11 | # TODO: put this somewhere more appropriate. Something like an 12 | # authentication callback (Devise does this?). 13 | # --hale 14 | if current_user.try(:account_type) == "temp" 15 | user.assign_business Business.find_by_token(current_user.current_business.token) 16 | end 17 | 18 | current_user.try(:destroy) 19 | cookies.permanent[:token] = user.token 20 | respond_with user, location: nil 21 | else 22 | respond_with({}, location: nil, status: :unauthorized) 23 | end 24 | end 25 | 26 | # current user 27 | def show 28 | if (user=User.find_by_token(cookies[:token])) 29 | respond_with user.as_json(only: ['first_name', 'last_name', 'token', 'email', 'account_type']).merge( 30 | "full_name" => user.full_name, 31 | "current_business" => { 32 | "name" => user.current_business.business_name, 33 | "token" => user.current_business.token 34 | } 35 | ) 36 | else 37 | respond_with {} 38 | end 39 | end 40 | 41 | # logout 42 | def destroy 43 | session[:user_id] = nil 44 | cookies[:token] = nil 45 | respond_with 'success' 46 | end 47 | 48 | end 49 | -------------------------------------------------------------------------------- /app/controllers/sic_controller.rb: -------------------------------------------------------------------------------- 1 | # require 'csv-mapper' 2 | # require 'fuzzystringmatch' 3 | 4 | # class SicController < ApplicationController 5 | # def index 6 | # business_class = CsvMapper.import(Rails.root + 'app/assets/csv/business_class.csv') do 7 | # start_at_row 1 8 | # [bcc, classifcation, business_type, sic] 9 | # end 10 | 11 | 12 | # results = CsvMapper.import(Rails.root + 'app/assets/csv/zoning_and_sic_codes.csv') do 13 | # start_at_row 1 14 | # [industry, subtype, code, industry_subtype, recheck, sic_name, sic_code, alternate_code, query_distance, classifcation] 15 | # end 16 | 17 | 18 | # results.each { |result| 19 | 20 | # if !result.alternate_code.nil? 21 | # result.sic_code = result.alternate_code 22 | # end 23 | # business_class.each { |bclass| 24 | # if !result.sic_code.nil? and bclass.sic.index(result.sic_code) == 0 25 | # result.classifcation = bclass.classifcation.sub("CLASS", "") 26 | # end 27 | # } 28 | # } 29 | 30 | 31 | 32 | # query = params['q'] 33 | # query_distances = Array.new(results.length) 34 | 35 | # jarow = FuzzyStringMatch::JaroWinkler.create( :pure ) 36 | 37 | # terms = query.split(%r{\s+}) 38 | 39 | # terms.each_with_index { |term, tindex | 40 | # results.each_with_index { |result, index | 41 | 42 | # if tindex ==0 43 | # result.query_distance =0 44 | # end 45 | 46 | # cmb_str = (result.sic_name ? result.sic_name : "") + " " + result.subtype + " " + result.industry 47 | # cmb_str = cmb_str.downcase 48 | # if !cmb_str.index(term).nil? 49 | # result.query_distance +=1 50 | # end 51 | 52 | # result.query_distance += jarow.getDistance(query, (result.sic_name ? result.sic_name : "") + result.subtype + result.industry) 53 | # } 54 | # } 55 | 56 | # results = results.sort{ |a, b| b.query_distance <=> a.query_distance} 57 | # @response = results[0..10] 58 | 59 | # render :json => @response 60 | # end 61 | # end 62 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | respond_to :html, :json, :xml 3 | 4 | def create 5 | user = User.new(params[:user]) 6 | 7 | # hack to bypass authentication requirements 8 | if params[:user][:account_type] == "temp" 9 | pass = SecureRandom.hex(10) 10 | user.password = pass 11 | user.password_confirmation = pass 12 | mail = SecureRandom.hex(10) 13 | user.email = "#{mail}@notarealemail.com" 14 | end 15 | 16 | user.save 17 | 18 | # inherit answers from temp account 19 | if (user.valid? && (user.account_type == "perm") && (current_user.try(:account_type) == "temp")) 20 | user.assign_business(current_user.current_business) 21 | current_user.destroy 22 | end 23 | 24 | # login (temp accounts always valid) 25 | if user.valid? || (params[:user][:account_type] == "temp") 26 | cookies.permanent[:token] = user.token 27 | end 28 | 29 | respond_with user 30 | end 31 | 32 | def add_business 33 | @user = User.find_by_token(params[:user_token]) 34 | @user.add_business() 35 | respond_with @user 36 | end 37 | 38 | # def update 39 | # @user = User.find_by_id(params[:user_id]) 40 | # # cookies.permanent[:token] = @user.token 41 | # respond_with @user.update_attributes(params[:user]) 42 | # end 43 | 44 | def application_email 45 | if current_user && PlanningMailer.application_email(current_user).deliver 46 | render :json => { :status => "sent" } 47 | else 48 | render :json => { :status => "error" } 49 | end 50 | end 51 | 52 | def help_email 53 | if PlanningMailer.help_email(params, current_user).deliver 54 | render :json => { :status => "sent" } 55 | else 56 | render :json => { :status => 'error' } 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /app/helpers/admin/admin_users_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::AdminUsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/cic_code_zoning_districts_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::CicCodeZoningDistrictsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/cic_codes_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::CicCodesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/requirements_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::RequirementsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/admin/zoning_districts_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::ZoningDistrictsHelper 2 | 3 | def check_box_helper(value) 4 | if value == true 5 | 'X' 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/helpers/answers_helper.rb: -------------------------------------------------------------------------------- 1 | module AnswersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def user_answer_value(user, key_name) 3 | if user.blank? || user.try(:current_business).try(:answers).blank? || user.current_business.answers.find_by_field_name(key_name).try(:value).blank? 4 | return '' 5 | else 6 | user.current_business.answers.find_by_field_name(key_name).value 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/helpers/business_helper.rb: -------------------------------------------------------------------------------- 1 | module BusinessHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/cic_codes_helper.rb: -------------------------------------------------------------------------------- 1 | module CicCodesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/permits_helper.rb: -------------------------------------------------------------------------------- 1 | module PermitsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/mailers/.gitkeep -------------------------------------------------------------------------------- /app/mailers/planning_mailer.rb: -------------------------------------------------------------------------------- 1 | class PlanningMailer < ActionMailer::Base 2 | default from: "planningcounter@opencounter.org" 3 | add_template_helper(ApplicationHelper) 4 | 5 | def application_email(user) 6 | @user = user 7 | 8 | @user.businesses.order("created_at DESC").first.mark_submitted 9 | 10 | to_address = Rails.application.config.PLANNING_DEPARTMENT_EMAIL 11 | mail(:to => to_address, :subject => "OpenCounter New Business Inquiry") 12 | end 13 | 14 | def help_email(params, user) 15 | @params = params 16 | @user = user 17 | to_address = Rails.application.config.PLANNING_DEPARTMENT_EMAIL 18 | mail(:to => to_address, :subject => "OpenCounter Help Request") 19 | end 20 | 21 | end 22 | -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/models/.gitkeep -------------------------------------------------------------------------------- /app/models/admin_user.rb: -------------------------------------------------------------------------------- 1 | class AdminUser < ActiveRecord::Base 2 | # Include default devise modules. Others available are: 3 | # :token_authenticatable, :confirmable, 4 | # :lockable, :timeoutable and :omniauthable 5 | devise :database_authenticatable, :recoverable, :trackable, :validatable 6 | 7 | # Setup accessible (or protected) attributes for your model 8 | attr_accessible :email, :password, :password_confirmation, :remember_me 9 | # attr_accessible :title, :body 10 | 11 | end 12 | -------------------------------------------------------------------------------- /app/models/answer.rb: -------------------------------------------------------------------------------- 1 | class Answer < ActiveRecord::Base 2 | attr_accessible :value, :field_name, :business_id 3 | 4 | belongs_to :business 5 | has_one :user, :through => :business 6 | 7 | validates_presence_of :value 8 | end 9 | -------------------------------------------------------------------------------- /app/models/business.rb: -------------------------------------------------------------------------------- 1 | class Business < ActiveRecord::Base 2 | belongs_to :user 3 | has_many :answers 4 | attr_accessible :name, :description, :submitted, :submitted_at, :user_id, :token 5 | 6 | scope :submitted, -> { where(submitted: true) } 7 | 8 | after_create :assign_token 9 | 10 | def mark_submitted 11 | update_attributes(submitted: true) 12 | update_attributes(submitted_at: Time.now) 13 | end 14 | 15 | def submitted? 16 | submitted || false 17 | end 18 | 19 | def submitted_at_s 20 | submitted_at.in_time_zone('Pacific Time (US & Canada)').strftime('%m/%d/%Y at %I:%M%p') 21 | end 22 | 23 | def business_name 24 | self.answers.find_by_field_name("business_name").try(:value) 25 | end 26 | 27 | private 28 | 29 | def assign_token 30 | update_attribute(:token, SecureRandom.hex(16)) 31 | end 32 | 33 | # answers are a hash of key/value pairs 34 | # TODO: proper error handling 35 | # def save_answers(answers) 36 | # Rails.logger.info "save_answers method called: #{answers.each{|k,v| [k,v]}}" 37 | # errors = [] 38 | # answers.each do |key, value| 39 | # p "#{key}, #{value}" 40 | # field = Field.find_by_name(key) 41 | # unless field.nil? 42 | # # unless field doesn't exist 43 | # # check if answer already exists 44 | # ans = Answer.where(business_id: self, field_id: field) 45 | # unless ans.empty? 46 | # ans[0].update_attributes(text: value) 47 | # else 48 | # # otherwise create it 49 | # ans = self.answers.create(:text => value) 50 | # field.answers << ans 51 | # end 52 | # else 53 | # errors << "Error creating answer. Key #{key} not found" 54 | # end 55 | # end 56 | # return errors 57 | # end 58 | end 59 | -------------------------------------------------------------------------------- /app/models/cic_code.rb: -------------------------------------------------------------------------------- 1 | class CicCode < ActiveRecord::Base 2 | belongs_to :parent, :class_name => "CicCode", :foreign_key => "parent_id" 3 | has_many :children, :class_name => "CicCode", :foreign_key => "parent_id" 4 | has_many :cic_code_zoning_districts, :dependent => :destroy 5 | has_many :zoning_districts, :through => :cic_code_zoning_districts, :dependent => :destroy, :order => "code ASC" 6 | has_and_belongs_to_many :sic_codes, :uniq => true 7 | has_many :cic_code_requirements, :dependent => :destroy 8 | has_many :requirements, :through => :cic_code_requirements, :order => "sort_order ASC" 9 | 10 | accepts_nested_attributes_for :requirements 11 | 12 | attr_accessible :code, :industry, :subindustry, :home_occ_prohibited, :keywords, :parent_id, :requirements, :requirement_ids, :requirements_attributes 13 | 14 | before_save :strip_code 15 | after_create :create_zoning_district_connections 16 | 17 | def permission_name(zoning_district_id) 18 | CicCodeZoningDistrict.cross_reference(self.id, zoning_district_id).try(:permission_name) 19 | end 20 | 21 | def industry_subindustry 22 | terms = '' 23 | terms += industry 24 | terms += ' - ' 25 | terms += subindustry 26 | return terms 27 | end 28 | 29 | def search_terms 30 | terms = '' 31 | terms += industry + ', ' if industry.present? 32 | terms += subindustry + ', ' if subindustry.present? 33 | terms += keywords + ', ' if keywords.present? 34 | return terms 35 | end 36 | 37 | def requirement_names 38 | requirement_names = self.requirements.collect {|x| x.name } 39 | requirement_names.join(', ') 40 | end 41 | 42 | private 43 | 44 | def strip_code 45 | self.code.strip 46 | end 47 | 48 | def create_zoning_district_connections 49 | ZoningDistrict.all.each do |zoning_district| 50 | CicCodeZoningDistrict.find_or_create_by_cic_code_id_and_zoning_district_id(self.id, zoning_district.id) 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /app/models/cic_code_requirement.rb: -------------------------------------------------------------------------------- 1 | class CicCodeRequirement < ActiveRecord::Base 2 | belongs_to :cic_code 3 | belongs_to :requirement 4 | attr_accessible :cic_code_id, :requirement_id 5 | end 6 | -------------------------------------------------------------------------------- /app/models/cic_code_zoning_district.rb: -------------------------------------------------------------------------------- 1 | class CicCodeZoningDistrict < ActiveRecord::Base 2 | belongs_to :cic_code 3 | belongs_to :zoning_district 4 | attr_accessible :cic_code_id, :home_occ_prohibited, :notes, :permission, :zoning_district_id 5 | 6 | #scope :sorted_by_cic_code, ->(cic_code) { } 7 | scope :sorted_by_cic_code, joins(:cic_code).order('cic_codes.code ASC') 8 | 9 | def self.cross_reference(cic_code_id, zoning_district_id) 10 | self.where(cic_code_id: cic_code_id, zoning_district_id: zoning_district_id).try(:first) 11 | end 12 | 13 | # Maps the integer permission field to a more human-readable string name 14 | def permission_name 15 | case permission 16 | when 1 then "Zoning Clearance" 17 | when 2 then "AUP" 18 | when 3 then "SUP" 19 | when 4 then "Prohibited" 20 | else "Unknown" 21 | end 22 | end 23 | 24 | def home_occ_prohibited_name 25 | home_occ_prohibited ? "Yes" : "No" 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /app/models/form.rb: -------------------------------------------------------------------------------- 1 | class Form < ActiveRecord::Base 2 | attr_accessible :title, :jurisdiction 3 | 4 | has_and_belongs_to_many :fields 5 | end 6 | -------------------------------------------------------------------------------- /app/models/requirement.rb: -------------------------------------------------------------------------------- 1 | class Requirement < ActiveRecord::Base 2 | include RankedModel 3 | ranks :sort_order 4 | 5 | has_many :cic_code_requirements, :dependent => :destroy 6 | has_many :cic_codes, :through => :cic_code_requirements 7 | has_many :requirement_zoning_districts, :dependent => :destroy 8 | has_many :zoning_districts, :through => :requirement_zoning_districts 9 | attr_accessible :name, :short_name, :notes, :jurisdiction, :home_occ, :commercial 10 | 11 | scope :home_occ, where(:home_occ => true) 12 | scope :commercial, where(:commercial => true) 13 | end 14 | -------------------------------------------------------------------------------- /app/models/sic_code.rb: -------------------------------------------------------------------------------- 1 | class SicCode < ActiveRecord::Base 2 | has_and_belongs_to_many :cic_codes, :uniq => true 3 | attr_accessible :code, :industry, :parent_id, :subindustry 4 | end 5 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | # FIXME: I don't think id should be exposed 3 | attr_accessible :first_name, :last_name, :email, :phone, :role, 4 | :last_state, :token, :created_at, :id, :updated_at, 5 | :remember_token, :password, :password_confirmation, 6 | :account_type, :current_business_token 7 | 8 | has_many :businesses 9 | # has_many :answers, :through => :businesses 10 | 11 | VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i 12 | validates :email, presence: true, 13 | format: { with: VALID_EMAIL_REGEX }, 14 | uniqueness: { case_sensitive: false } 15 | 16 | validates_uniqueness_of :token 17 | 18 | validates :password, presence: true, length: { minimum: 6 } 19 | validates :password_confirmation, presence: true 20 | 21 | has_secure_password 22 | 23 | after_create :assign_token, :add_business 24 | 25 | def current_business 26 | Business.find_by_token(self.current_business_token) || self.businesses.order("updated_at DESC").limit(1).first 27 | end 28 | 29 | def full_name 30 | "#{try(:first_name)} #{try(:last_name)}" 31 | end 32 | 33 | def add_business 34 | business = Business.create 35 | self.businesses << business 36 | # TODO: multiple businesses 37 | update_attribute(:current_business_token , business.token) 38 | end 39 | 40 | def assign_business(business) 41 | business.user = self 42 | business.save 43 | # TEMP: normally you would only switch the current business on UI event 44 | update_attribute(:current_business_token , business.token) 45 | end 46 | 47 | private 48 | 49 | def assign_token 50 | update_attribute(:token, SecureRandom.hex(16)) 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /app/models/zoning_district.rb: -------------------------------------------------------------------------------- 1 | class ZoningDistrict < ActiveRecord::Base 2 | has_many :requirement_zoning_districts 3 | has_many :requirements, :through => :requirement_zoning_districts, :dependent => :destroy, :order => "code ASC" 4 | has_many :cic_code_zoning_districts, :dependent => :destroy 5 | has_many :cic_codes, :through => :cic_code_zoning_districts, :dependent => :destroy, :order => "code ASC" 6 | attr_accessible :code, :description, :home_occ_prohibited, :name 7 | 8 | before_save :strip_code 9 | after_create :create_zoning_district_connections 10 | 11 | def permission_name(cic_code_id) 12 | CicCodeZoningDistrict.cross_reference(cic_code_id, self.id).try(:permission_name) 13 | end 14 | 15 | def active_cic_codes 16 | self.cic_codes.where('permission IN (?)', [1,2,3,4]) 17 | end 18 | 19 | def home_occ_prohibited_name 20 | home_occ_prohibited ? "Yes" : "No" 21 | end 22 | 23 | 24 | private 25 | 26 | def strip_code 27 | self.code.strip 28 | end 29 | 30 | def create_zoning_district_connections 31 | CicCode.all.each do |cic_code| 32 | CicCodeZoningDistrict.find_or_create_by_cic_code_id_and_zoning_district_id(cic_code.id, self.id) 33 | end 34 | end 35 | 36 | 37 | end 38 | -------------------------------------------------------------------------------- /app/views/admin/admin_users/_form.html.erb: -------------------------------------------------------------------------------- 1 | <% if @admin_user.errors.any? %> 2 |
3 |

<%= pluralize(@admin_user.errors.count, "error") %> prohibited this admin_user from being saved:

4 | 5 |
    6 | <% @admin_user.errors.full_messages.each do |msg| %> 7 |
  • <%= msg %>
  • 8 | <% end %> 9 |
10 |
11 | <% end %> 12 | 13 |
14 |
15 | <%= f.label :email %> 16 | <%= f.text_field :email %> 17 |
18 | 19 |
20 |
21 | <%= f.label :password %> 22 | <%= f.password_field :password %> 23 |
24 | 25 |
26 |
27 | <%= f.label :password_confirmation %> 28 | <%= f.password_field :password_confirmation %> 29 |
-------------------------------------------------------------------------------- /app/views/admin/admin_users/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit User

2 | 3 | <%= form_for(:admin_user, :url => admin_admin_user_path(@admin_user), :html => {:method => :put}) do |f| %> 4 | <%= render :partial => 'form', :locals => {:f => f} %> 5 | 6 |
7 |
8 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 9 |    10 | <%= link_to 'Cancel', admin_admin_users_path %> 11 |
12 | <% end %> -------------------------------------------------------------------------------- /app/views/admin/admin_users/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Admin Users

3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | <% for user in @admin_users %> 13 | "> 14 | 15 | 16 | 17 | 18 | 19 | <% end -%> 20 | 21 |
Email  
<%= user.email %><%= link_to 'Edit', edit_admin_admin_user_path(user), :class => 'btn btn-mini' %><%= button_to 'Delete', admin_admin_user_path(user), :method => :delete, :confirm => 'Delete this User?', :class => 'btn btn-mini btn-danger' %>
22 | 23 |
24 | <%= link_to 'New User', new_admin_admin_user_path, :class => 'btn btn-success' %> 25 |
26 | -------------------------------------------------------------------------------- /app/views/admin/admin_users/new.html.erb: -------------------------------------------------------------------------------- 1 |

New User

2 | 3 | <%= form_for(:admin_user, :url => admin_admin_users_path, :html => {:method => :post}) do |f| %> 4 | <%= render :partial => 'form', :locals => {:f => f} %> 5 | 6 |
7 |
8 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 9 |    10 | <%= link_to 'Cancel', admin_admin_users_path %> 11 |
12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/admin/applications/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Submitted Applications

3 |

Click on any application to see details.

4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <% for application in @applications %> 15 | "> 16 | 20 | 21 | 22 | 23 | 24 | <% end -%> 25 | 26 |
ApplicantBusinessSubmitted (Pacific Time) 
17 | <%= user_answer_value(application.user, 'applicant_first_name') %> 18 | <%= user_answer_value(application.user, 'applicant_last_name') %> 19 | <%= user_answer_value(application.user, 'business_name') %><%= application.submitted_at_s %><%= link_to 'View', admin_application_path(application), :class => 'btn btn-mini' %>
27 | -------------------------------------------------------------------------------- /app/views/admin/cic_codes/_form.html.erb: -------------------------------------------------------------------------------- 1 | <% if @cic_code.errors.any? -%> 2 |
3 |

<%= pluralize(@cic_code.errors.count, "error") -%> prohibited this county from being saved:"

4 |
    5 | <% @cic_code.errors.full_messages.each do |msg| -%> 6 |
  • <%= msg %>
  • 7 | <% end %> 8 |
9 |
10 | <% end -%> 11 | 12 | <% unless params[:requirements] %> 13 |
14 | <%= f.label :code %> 15 | <%= f.text_field :code %> 16 |
17 | 18 |
19 | <%= f.label :industry %> 20 | <%= f.text_field :industry %> 21 |
22 | 23 |
24 | <%= f.label :subindustry %> 25 | <%= f.text_field :subindustry %> 26 |
27 | 28 |
29 | <%= f.label :keywords %> 30 | <%= f.text_area :keywords, :rows => 5 %> 31 |
32 | 33 |
34 |
35 | <%= f.check_box :home_occ_prohibited %> Home Occ Prohibited? 36 |
37 |
38 | <% end %> 39 | 40 |
41 |

Requirements

42 | 43 | <% for requirement in @requirements %> 44 | 45 | 47 | 48 | 49 | <% end -%> 50 |
<%= check_box_tag "cic_code[requirement_ids][]", requirement.id, @cic_code.requirements.include?(requirement) %> 46 | <%= requirement.name %><%= requirement.jurisdiction %>
51 |
52 |
-------------------------------------------------------------------------------- /app/views/admin/cic_codes/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing CIC Code <%= @cic_code.code %>

2 | 3 | <%= form_for(:cic_code, :url => admin_cic_code_path(@cic_code), :html => {:method => :put}) do |f| %> 4 | 5 | <%= render :partial => 'form', :locals => {:f => f} %> 6 | 7 |
8 |
9 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 10 |    11 | <%= link_to 'Cancel', admin_cic_codes_path %> 12 |
13 | <% end -%> -------------------------------------------------------------------------------- /app/views/admin/cic_codes/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Santa Cruz's industry classification codes [CIC Codes]

3 |

Click on any industry, sub-industry, or keyword to edit it. Your changes will be saved when you click away or hit enter.

4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | <% for cic_code in @cic_codes %> 17 | "> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | <% end -%> 28 | 29 |
CodeIndustrySub-industryRequirementsKeywords
<%= cic_code.code %><%= cic_code.industry %><%= cic_code.subindustry %><%= cic_code.requirement_names %> <%= link_to 'add/edit', edit_admin_cic_code_path(cic_code, :requirements => true) %><%= on_the_spot_edit cic_code, :keywords %><%= link_to 'Edit', edit_admin_cic_code_path(cic_code), :class => 'btn btn-mini' %><%= button_to 'Delete', admin_cic_code_path(cic_code), :method => :delete, :confirm => 'Delete this CIC Code?', :class => 'btn btn-mini btn-danger' %>
30 | 31 |
32 | <%= link_to 'New CIC Code', new_admin_cic_code_path, :class => 'btn btn-success' %> 33 |
34 |
-------------------------------------------------------------------------------- /app/views/admin/cic_codes/new.html.erb: -------------------------------------------------------------------------------- 1 |

Editing CIC Code <%= @cic_code.code %>

2 | 3 | <%= form_for(:cic_code, :url => admin_cic_codes_path, :html => {:method => :post}) do |f| %> 4 | 5 | <%= render :partial => 'form', :locals => {:f => f} %> 6 | 7 |
8 |
9 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 10 |    11 | <%= link_to 'Cancel', admin_cic_codes_path %> 12 |
13 | <% end -%> -------------------------------------------------------------------------------- /app/views/admin/requirements/_form.html.erb: -------------------------------------------------------------------------------- 1 | <% if @requirement.errors.any? %> 2 |
3 |

<%= pluralize(@requirement.errors.count, "error") %> prohibited this requirement from being saved:

4 | 5 |
    6 | <% @requirement.errors.full_messages.each do |msg| %> 7 |
  • <%= msg %>
  • 8 | <% end %> 9 |
10 |
11 | <% end %> 12 | 13 |
14 |
15 | <%= f.label :name %> 16 | <%= f.text_field :name %> 17 |
18 | 19 |
20 |
21 | <%= f.label :short_name %> 22 | <%= f.text_field :short_name %> 23 |
24 | 25 |
26 |
27 | <%= f.label :jurisdiction %> 28 | <%= f.select :jurisdiction, options_for_select(['City', 'County', 'State', 'Federal'], selected = @requirement.jurisdiction) %> 29 |
30 | 31 |
32 |
33 | <%= f.check_box :home_occ %> Applies to home-sited businesses? 34 |
35 | 36 |
37 |
38 | <%= f.check_box :commercial %> Applies to commercially-sited businesses? 39 |
40 | 41 |
42 |
43 | <%= f.label :notes %> 44 | <%= f.text_area :notes, :rows => 5 %> 45 |
46 | 47 | -------------------------------------------------------------------------------- /app/views/admin/requirements/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit Requirement

2 | 3 | <%= form_for(:requirement, :url => admin_requirement_path(@requirement), :html => {:method => :put}) do |f| %> 4 | <%= render :partial => 'form', :locals => {:f => f} %> 5 | 6 |
7 |
8 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 9 |    10 | <%= link_to 'Cancel', admin_requirements_path %> 11 |
12 | <% end %> -------------------------------------------------------------------------------- /app/views/admin/requirements/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Requirements

3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameShort NameApplies to Home-Sited Businesses?Applies to Commercially-Sited Businesses?Jurisdiction
16 |
    17 | <% for requirement in @requirements %> 18 | <%= content_tag_for :li, requirement do %> 19 | 20 | "> 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
    <%= image_tag 'handle.png' %><%= requirement.name %><%= requirement.short_name %><%= requirement.home_occ %><%= requirement.commercial %><%= requirement.jurisdiction %><%= link_to 'Edit', edit_admin_requirement_path(requirement), :class => 'btn btn-mini' %><%= button_to 'Delete', admin_requirement_path(requirement), :method => :delete, :confirm => 'Delete this Requirement?', :class => 'btn btn-mini btn-danger' %>
    31 | <% end %> 32 | <% end -%> 33 |
34 | 35 |
36 |
37 | <%= link_to 'New Requirement', new_admin_requirement_path, :class => 'btn btn-success' %> 38 |
39 | 40 | <%= javascript_tag do %> 41 | $('#requirements-list').sortable({ 42 | axis: 'y', 43 | dropOnEmpty:false, 44 | handle: '.handle', 45 | cursor: 'crosshair', 46 | items: 'li', 47 | opacity: 0.4, 48 | scroll: true, 49 | update: function(event, ui){ 50 | $.ajax({ 51 | type: 'post', 52 | data: { requirement: { id: ui.item.attr('id'), sort_order: ui.item.index() } }, 53 | dataType: 'script', 54 | beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}, 55 | url: '/admin/requirements/sort'})} 56 | }) 57 | <% end %> 58 | -------------------------------------------------------------------------------- /app/views/admin/requirements/new.html.erb: -------------------------------------------------------------------------------- 1 |

New Requirement

2 | 3 | <%= form_for(:requirement, :url => admin_requirements_path, :html => {:method => :post}) do |f| %> 4 | <%= render :partial => 'form', :locals => {:f => f} %> 5 | 6 |
7 |
8 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 9 |    10 | <%= link_to 'Cancel', admin_requirements_path %> 11 |
12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/admin/zoning_districts/_form.html.erb: -------------------------------------------------------------------------------- 1 | <% if @zoning_district.errors.any? -%> 2 |
3 |

<%= pluralize(@zoning_district.errors.count, "error") -%> prohibited this county from being saved:"

4 |
    5 | <% @zoning_district.errors.full_messages.each do |msg| -%> 6 |
  • <%= msg %>
  • 7 | <% end %> 8 |
9 |
10 | <% end -%> 11 | 12 |
13 | <%= f.label :code %> 14 | <%= f.text_field :code %> 15 |
16 | 17 |
18 | <%= f.label :name %> 19 | <%= f.text_field :name %> 20 |
21 | 22 |
23 | <%= f.label :description %> 24 | <%= f.text_area :description, :rows => 5 %> 25 |
26 | 27 |
28 |
29 | <%= f.check_box :home_occ_prohibited %> Home Occ Prohibited? 30 |
-------------------------------------------------------------------------------- /app/views/admin/zoning_districts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing Zoning District

2 | 3 | <%= form_for(:zoning_district, :url => admin_zoning_district_path(@zoning_district), :html => {:method => :put}) do |f| %> 4 | <%= render :partial => 'form', :locals => {:f => f}%> 5 | 6 |
7 |
8 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 9 |    10 | <%= link_to 'Cancel', admin_zoning_districts_path %> 11 |
12 | <% end -%> -------------------------------------------------------------------------------- /app/views/admin/zoning_districts/index.html.erb: -------------------------------------------------------------------------------- 1 |

Zoning Districts

2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <% for zone in @zoning_districts %> 15 | "> 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | <% end %> 25 |
CodeNameCIC CodesHome Occ. Prohibited?
<%= zone.code %><%= zone.name %><%= zone.active_cic_codes.size %><%= on_the_spot_edit zone, :home_occ_prohibited, :type => :checkbox, :display_method => :home_occ_prohibited_name %><%= link_to 'Permissions', admin_zoning_district_path(zone), :class => 'btn btn-mini' %><%= link_to 'Edit', edit_admin_zoning_district_path(zone), :class => 'btn btn-mini' %><%= button_to 'Delete', admin_zoning_district_path(zone), method: :delete, confirm: 'Delete this Zoning District?', :class => 'btn btn-mini btn-danger' %>
26 | 27 |
28 | <%= link_to 'New Zoning District', new_admin_zoning_district_path, :class => 'btn btn-success' %> 29 |
30 |
-------------------------------------------------------------------------------- /app/views/admin/zoning_districts/new.html.erb: -------------------------------------------------------------------------------- 1 |

New Zoning District

2 | 3 | <%= form_for(:zoning_district, :url => admin_zoning_districts_path, :html => {:method => :post}) do |f| %> 4 | <%= render :partial => 'form', :locals => {:f => f}%> 5 | 6 |
7 |
8 | <%= f.submit 'Save', :class => 'btn btn-success btn-large' %> 9 |    10 | <%= link_to 'Cancel', admin_zoning_districts_path %> 11 |
12 | <% end -%> -------------------------------------------------------------------------------- /app/views/admin/zoning_districts/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= @zoning_district.code %> — <%= @zoning_district.name %>

2 |

<%= @zoning_district.description %>

3 | 4 | <% if flash[:notice].present? %> 5 |
<%= flash[:notice] %>
6 | <% end %> 7 | 8 | <%= will_paginate @cic_code_zoning_districts, :container => false %> 9 | 10 | <% if @zoning_district.cic_code_zoning_districts.blank? %> 11 |

There are no CIC Codes associated with this Zoning District.

12 | <% else %> 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | <% for cic_code_zoning_district in @cic_code_zoning_districts %> 25 | "> 26 | 29 | 30 | 31 | 32 | 33 | 34 | <% end %> 35 | 36 |
CodeIndustrySubindustryPermission Name / Permit TypeExplanation (if Unknown)
27 | <%= link_to cic_code_zoning_district.cic_code.code, edit_admin_cic_code_path(cic_code_zoning_district.cic_code, :zoning_district_id => @zoning_district.id) %> 28 | <%= cic_code_zoning_district.cic_code.industry %><%= cic_code_zoning_district.cic_code.subindustry %><%= on_the_spot_edit cic_code_zoning_district, :permission, :display_text => cic_code_zoning_district.permission_name, :type => :select, :data => [ [1,'Zoning Clearance'], [2,'AUP'], [3,'SUP'], [4,'Prohibited'], [5,'Unknown'] ] %><%= on_the_spot_edit cic_code_zoning_district, :notes %>
37 | <% end %> 38 | 39 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend confirmation instructions

2 | 3 | <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
<%= f.label :email %>
7 | <%= f.email_field :email %>
8 | 9 |
<%= f.submit "Resend confirmation instructions" %>
10 | <% end %> 11 | 12 | <%= render "devise/shared/links" %> 13 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome <%= @resource.email %>!

2 | 3 |

You can confirm your account email through the link below:

4 | 5 |

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

6 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Someone has requested a link to change your password, and you can do this through the link below.

4 | 5 |

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

6 | 7 |

If you didn't request this, please ignore this email.

8 |

Your password won't change until you access the link above and create a new one.

9 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Your account has been locked due to an excessive amount of unsuccessful sign in attempts.

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

8 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Change your password

2 | 3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> 4 | <%= devise_error_messages! %> 5 | <%= f.hidden_field :reset_password_token %> 6 | 7 |
<%= f.label :password, "New password" %>
8 | <%= f.password_field :password %>
9 | 10 |
<%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
12 | 13 |
<%= f.submit "Change my password" %>
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |

Forgot your password?

2 | 3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
<%= f.label :email %>
7 | <%= f.email_field :email %>
8 | 9 |
<%= f.submit "Send me reset password instructions" %>
10 | <% end %> 11 | 12 | <%= render "devise/shared/links" %> 13 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit <%= resource_name.to_s.humanize %>

2 | 3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
<%= f.label :email %>
7 | <%= f.email_field :email %>
8 | 9 |
<%= f.label :password %> (leave blank if you don't want to change it)
10 | <%= f.password_field :password, :autocomplete => "off" %>
11 | 12 |
<%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 | 15 |
<%= f.label :current_password %> (we need your current password to confirm your changes)
16 | <%= f.password_field :current_password %>
17 | 18 |
<%= f.submit "Update" %>
19 | <% end %> 20 | 21 |

Cancel my account

22 | 23 |

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.

24 | 25 | <%= link_to "Back", :back %> 26 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Sign up

2 | 3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
<%= f.label :email %>
7 | <%= f.email_field :email %>
8 | 9 |
<%= f.label :password %>
10 | <%= f.password_field :password %>
11 | 12 |
<%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 | 15 |
<%= f.submit "Sign up" %>
16 | <% end %> 17 | 18 | <%= render "devise/shared/links" %> 19 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |

Sign in

2 | 3 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> 4 |
5 | <%= f.label :email %> 6 | <%= f.email_field :email %> 7 |
8 | 9 |
10 | <%= f.label :password %> 11 | <%= f.password_field :password %> 12 |
13 | 14 |
15 |
16 | <%= f.submit "Sign in" %> 17 |
18 | <% end %> 19 | 20 | <%= render "devise/shared/links" %> 21 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Sign in", new_session_path(resource_name) %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%> 25 | <% end -%> -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend unlock instructions

2 | 3 | <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
<%= f.label :email %>
7 | <%= f.email_field :email %>
8 | 9 |
<%= f.submit "Resend unlock instructions" %>
10 | <% end %> 11 | 12 | <%= render "devise/shared/links" %> 13 | -------------------------------------------------------------------------------- /app/views/layouts/admin.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | OpenCounter - Admin 9 | 10 | 11 | <%= stylesheet_link_tag "application" %> 12 | <%= requirejs_include_tag "application" %> 13 | 14 | <%= stylesheet_link_tag :on_the_spot %> 15 | 16 | <%= javascript_include_tag :jquery %> 17 | <%= javascript_include_tag 'jquery-ui' %> 18 | <%= javascript_include_tag :on_the_spot %> 19 | <%= csrf_meta_tag %> 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 |
29 | <% unless current_user %> 30 | <%= button_to 'Log Out', destroy_admin_user_session_path, :method => :delete %> 31 | <% end %> 32 |
33 |
34 | <%= link_to 'Applications', admin_applications_url %> | 35 | <%= link_to 'CIC Codes', admin_cic_codes_url %> | 36 | <%= link_to 'Requirements', admin_requirements_url %> | 37 | <%= link_to 'Users', admin_admin_users_url %> | 38 | <%= link_to 'Zoning Districts', admin_zoning_districts_url %> 39 |
40 |
41 | <% if notice.present? %> 42 |

<%= notice %>

43 | <% elsif alert.present? %> 44 |

<%= alert %>

45 | <% end %> 46 | 47 | <%= yield %> 48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | OpenCounter - Start your business in Santa Cruz, CA 9 | 10 | 11 | <%= stylesheet_link_tag "application" %> 12 | 13 | 14 | <%= csrf_meta_tags %> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | <%= requirejs_include_tag "application" %> 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/views/panels/info.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/info.html.erb -------------------------------------------------------------------------------- /app/views/panels/info_applicant.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/info_applicant.html.erb -------------------------------------------------------------------------------- /app/views/panels/info_business.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/info_business.html.erb -------------------------------------------------------------------------------- /app/views/panels/intro.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/intro.html.erb -------------------------------------------------------------------------------- /app/views/panels/intro_big_picture.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/intro_big_picture.html.erb -------------------------------------------------------------------------------- /app/views/panels/intro_here_to_help.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/intro_here_to_help.html.erb -------------------------------------------------------------------------------- /app/views/panels/location.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/location.html.erb -------------------------------------------------------------------------------- /app/views/panels/location_home_occ.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/location_home_occ.html.erb -------------------------------------------------------------------------------- /app/views/panels/location_non_home_occ.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/location_non_home_occ.html.erb -------------------------------------------------------------------------------- /app/views/panels/location_non_home_occ_check_site.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/location_non_home_occ_check_site.html.erb -------------------------------------------------------------------------------- /app/views/panels/location_non_home_occ_choose_site.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/location_non_home_occ_choose_site.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_application_for_utility_service.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_application_for_utility_service.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_building_permit.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_building_permit.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_business_license.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_business_license.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_environmental_health_permit.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_environmental_health_permit.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_fictitious_business_name.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_fictitious_business_name.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_fictitious_business_name_statement.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_fictitious_business_name_statement.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_incorporation.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_incorporation.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_non_city_regulations.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_non_city_regulations.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_owner_agent_form.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_owner_agent_form.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_payroll_tax_registration.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_payroll_tax_registration.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_resellers_license.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_resellers_license.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_secretary_of_state_registration.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_secretary_of_state_registration.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_use_permit.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_use_permit.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirement_zoning_clearance.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirement_zoning_clearance.html.erb -------------------------------------------------------------------------------- /app/views/panels/requirements.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/requirements.html.erb -------------------------------------------------------------------------------- /app/views/panels/summary.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/app/views/panels/summary.html.erb -------------------------------------------------------------------------------- /app/views/planning_mailer/application_email.html.erb: -------------------------------------------------------------------------------- 1 |

OpenCounter Business Application

2 | 3 | 4 |

Business

5 | 6 |

Business Name: <%= @user.current_business.name -%>

7 | 8 |
9 | Business Type: 10 |
    11 |
  • Code: <%= user_answer_value(@user, "business_code") -%> (used for planning permit)
  • 12 |
  • Class A/B/C: <%= user_answer_value(@user, "business_type_class") -%> (used for business license)
  • 13 |
  • Type: <%= user_answer_value(@user, "business_type_type") -%> (used for BIDA)
  • 14 |
15 |
16 | 17 |

Business Structure: <%= user_answer_value(@user, 'business_structure') -%>

18 | 19 | 20 | 21 |

Applicant

22 | 23 |

Applicant Name: <%= @user.first_name -%> <%= @user.last_name -%>

24 | 25 |

Applicant Email : <%= @user.email -%>

26 | 27 |

Applicant Phone: <%= @user.phone -%>

28 | 29 | 30 |

Home Occupation

31 | 32 | <%- if user_answer_value(@user, "is_owner") == "no" -%> 33 |

Owner Name: <%= user_answer_value(@user, "owner_first_name") -%> <%= user_answer_value(@user, "owner_last_name") -%>

34 |

Owner Email: <%= user_answer_value(@user, "owner_email") -%>

35 |

Owner Phone: <%= user_answer_value(@user, "owner_phone") -%>

36 | <%- else -%> 37 | This applicant is the owner. 38 | <% end -%> 39 | 40 | 41 |

Location

42 | 43 |

44 | <%- if @user.current_business.answers.where(:location_type) == "home" -%> 45 | Home Occ: True 46 | <%- else -%> 47 | Home Occ: False 48 | <% end -%> 49 |

50 | 51 |

52 | Business Physical Address: 53 | <%= user_answer_value(@user, "business_physical_address_street") -%> 54 | <%= user_answer_value(@user, "business_physical_address_detail") -%> 55 | <%= user_answer_value(@user, "business_physical_address_city") -%>, 56 | <%= user_answer_value(@user, "business_physical_address_state") -%> <%= user_answer_value(@user, "business_physical_address_zip") -%> 57 |

58 | 59 |

60 | Business Mailing Address: 61 | <%= user_answer_value(@user, "business_mailing_address_street") -%> 62 | <%= user_answer_value(@user, "business_mailing_address_detail") -%> 63 | <%= user_answer_value(@user, "business_mailing_address_city") -%>, <%= user_answer_value(@user, "business_mailing_address_state") -%> <%= user_answer_value(@user, "business_mailing_address_zip") -%> 64 |

65 | 66 |

Zoning District: <%= user_answer_value(@user, "zoning") -%>

67 | 68 |

Business Improvement District: <%= user_answer_value(@user, "bid") -%>

69 | 70 |

APN: <%= user_answer_value(@user, "apn") -%>

71 | 72 |

Prior Use: <%= user_answer_value(@user, "prioruse") -%>

73 | 74 |

Details

75 | 76 | [@todo, data from requirements panels] -------------------------------------------------------------------------------- /app/views/planning_mailer/application_email.text.erb: -------------------------------------------------------------------------------- 1 | OpenCounter Business Application 2 | 3 | === Business =================================================================== 4 | 5 | Business Name: <%= @user.current_business.name -%> 6 | 7 | Business Type: 8 | 9 | Code: <%= user_answer_value(@user, "business_code") -%> (used for planning permit) 10 | 11 | Class A/B/C: <%= user_answer_value(@user, "business_type_class") -%> (used for business license) 12 | 13 | Type: <%= user_answer_value(@user, "business_type_type") -%> (used for BIDA) 14 | 15 | Business Structure: <%= user_answer_value(@user, 'business_structure') -%> 16 | 17 | === Applicant ===================================================================== 18 | 19 | Applicant Name: <%= @user.first_name -%> <%= @user.last_name -%> 20 | 21 | Applicant Email: <%= @user.email -%> 22 | 23 | Applicant Phone: <%= @user.phone -%> 24 | 25 | <%- if user_answer_value(@user, "is_owner") == "no" -%> 26 | 27 | Owner Name: <%= user_answer_value(@user, "owner_first_name") -%> <%= user_answer_value(@user, "owner_last_name") -%> 28 | 29 | Owner Email: <%= user_answer_value(@user, "owner_email") -%> 30 | 31 | Owner Phone: <%= user_answer_value(@user, "owner_phone") -%> 32 | 33 | <%- else -%> 34 | 35 | This applicant is the owner. 36 | 37 | <%- end -%> 38 | 39 | === Location =================================================================== 40 | 41 | <%- if @user.current_business.answers.where(:location_type) == "home" -%> 42 | Home Occ: True 43 | <%- else -%> 44 | Home Occ: False 45 | <%- end -%> 46 | 47 | 48 | Business Physical Address: <%= user_answer_value(@user, "business_physical_address_street") -%> <%= user_answer_value(@user, "business_physical_address_detail") -%> <%= user_answer_value(@user, "business_physical_address_city") -%>, <%= user_answer_value(@user, "business_physical_address_state") -%> <%= user_answer_value(@user, "business_physical_address_zip") -%> 49 | 50 | Business Mailing Address: <%= user_answer_value(@user, "business_mailing_address_street") -%> <%= user_answer_value(@user, "business_mailing_address_detail") -%> <%= user_answer_value(@user, "business_mailing_address_city") -%>, <%= user_answer_value(@user, "business_mailing_address_state") -%> <%= user_answer_value(@user, "business_mailing_address_zip") -%> 51 | 52 | Zoning District: <%= user_answer_value(@user, "zoning") -%> 53 | 54 | Business Improvement District: <%= user_answer_value(@user, "bid") -%> 55 | 56 | APN: <%= user_answer_value(@user, "apn") -%> 57 | 58 | Prior Use: <%= user_answer_value(@user, "prioruse") -%> 59 | 60 | === Details ==================================================================== 61 | 62 | [@todo, data from requirements panels] -------------------------------------------------------------------------------- /app/views/utilities/_contact.html.erb: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |

Contact Us

5 | 6 |

Send the Planning Department your question here, and we'll respond within 4 business days.

7 | 8 |

If you need to speak with someone sooner than that, here's how to contact the Planning Department.

9 | 10 |
11 | 12 | 16 | 17 | 21 | 22 | 30 | 31 | 35 | 36 |
37 | 38 |

Send this to the Planning Department →

39 | 40 |
-------------------------------------------------------------------------------- /app/views/utilities/_contact_thanks.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Thanks!

4 | 5 |

Thanks for contacting us. We will get in touch with you within 4 business days.

6 | 7 |

If you need to speak with someone sooner than that, here's how to contact the Planning Department.

8 | 9 |

How'd we do? Give us some feedback →

10 | 11 |
-------------------------------------------------------------------------------- /app/views/utilities/_credits.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Credits

3 |

A collaboration between the City of Santa Cruz, CA and Code for America.

4 |
-------------------------------------------------------------------------------- /app/views/utilities/_feedback.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Give us some feedback

3 |

If you have a moment, we would love to get your thoughts on this site.

4 |
5 | 13 | 17 | 21 |

22 |
23 |
-------------------------------------------------------------------------------- /app/views/utilities/_feedback_thanks.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Thanks for sharing!

4 | 5 |

Thanks, we've received your feedback.

6 | 7 |

(If they gave an email or phone) We'll follow up with you within one workday.

8 | 9 |

Thanks for helping us improve OpenCounter!

10 | 11 |

OpenCounter Home

12 | 13 |
-------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Opencounter::Application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | require 'rails/all' 3 | 4 | if defined?(Bundler) 5 | # If you precompile assets before deploying to production, use this line 6 | # Bundler.require(*Rails.groups(:assets => %w(development test))) 7 | # If you want your assets lazily compiled in production, use this line 8 | Bundler.require(:default, :assets, Rails.env) 9 | end 10 | 11 | module Opencounter 12 | class Application < Rails::Application 13 | # Settings in config/environments/* take precedence over those specified here. 14 | # Application configuration should go into files in config/initializers 15 | # -- all .rb files in that directory are automatically loaded. 16 | 17 | # Custom directories with classes and modules you want to be autoloadable. 18 | # config.autoload_paths += %W(#{config.root}/extras) 19 | 20 | # Only load the plugins named here, in the order given (default is alphabetical). 21 | # :all can be used as a placeholder for all plugins not explicitly named. 22 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 23 | 24 | # Activate observers that should always be running. 25 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 26 | 27 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 28 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 29 | # config.time_zone = 'Central Time (US & Canada)' 30 | 31 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 32 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 33 | # config.i18n.default_locale = :de 34 | 35 | # Configure the default encoding used in templates for Ruby 1.9. 36 | config.encoding = "utf-8" 37 | 38 | # Configure sensitive parameters which will be filtered from the log file. 39 | config.filter_parameters += [:password] 40 | 41 | # Enable escaping HTML in JSON. 42 | config.active_support.escape_html_entities_in_json = true 43 | 44 | # Use SQL instead of Active Record's schema dumper when creating the database. 45 | # This is necessary if your schema can't be completely dumped by the schema dumper, 46 | # like if you have constraints or database-specific column types 47 | # config.active_record.schema_format = :sql 48 | 49 | # Enforce whitelist mode for mass assignment. 50 | # This will create an empty whitelist of attributes available for mass-assignment for all models 51 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 52 | # parameters by using an attr_accessible or attr_protected declaration. 53 | config.active_record.whitelist_attributes = true 54 | 55 | # Enable the asset pipeline 56 | config.assets.enabled = true 57 | 58 | config.requirejs.loader = :almond 59 | 60 | # Version of your assets, change this if you want to expire all your assets 61 | config.assets.version = '1.0' 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /config/database_sample.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: &DEVELOPMENT 7 | adapter: postgresql 8 | database: opencounter_dev 9 | encoding: utf8 10 | host: localhost 11 | user: postgres 12 | pool: 5 13 | timeout: 5000 14 | 15 | # Warning: The database defined as "test" will be erased and 16 | # re-generated from your development database when you run "rake". 17 | # Do not set this db to the same as development or production. 18 | test: 19 | adapter: postgresql 20 | database: opencounter_test 21 | encoding: utf8 22 | host: localhost 23 | user: postgres 24 | pool: 5 25 | timeout: 5000 26 | 27 | production: 28 | adapter: postgresql 29 | database: opencounter_prod 30 | encoding: unicode 31 | pool: 5 32 | timeout: 5000 33 | 34 | 35 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Opencounter::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Opencounter::Application.configure do 2 | $stdout.sync = true 3 | 4 | # Settings specified here will take precedence over those in config/application.rb 5 | 6 | # In the development environment your application's code is reloaded on 7 | # every request. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Log error messages when you accidentally call methods on nil. 12 | config.whiny_nils = true 13 | 14 | # Show full error reports and disable caching 15 | config.consider_all_requests_local = true 16 | config.action_controller.perform_caching = false 17 | 18 | # Don't care if the mailer can't send 19 | config.action_mailer.perform_deliveries = true 20 | config.action_mailer.raise_delivery_errors = true 21 | config.action_mailer.delivery_method = :file 22 | 23 | # Print deprecation notices to the Rails logger 24 | config.active_support.deprecation = :log 25 | 26 | # Only use best-standards-support built into browsers 27 | config.action_dispatch.best_standards_support = :builtin 28 | 29 | # Raise exception on mass assignment protection for Active Record models 30 | config.active_record.mass_assignment_sanitizer = :strict 31 | 32 | # Log the query plan for queries taking more than this (works 33 | # with SQLite, MySQL, and PostgreSQL) 34 | config.active_record.auto_explain_threshold_in_seconds = 0.5 35 | 36 | # Do not compress assets 37 | config.assets.compress = false 38 | 39 | # Expands the lines which load the assets 40 | config.assets.debug = true 41 | 42 | # e-mail for help and form submission should go to this address 43 | #config.PLANNING_DEPARTMENT_EMAIL = 'pkoht@cityofsantacruz.com' 44 | config.PLANNING_DEPARTMENT_EMAIL = 'joel@codeforamerica.org' 45 | 46 | # e-mail configuration for devise 47 | config.action_mailer.default_url_options = { :host => 'localhost:3000' } 48 | 49 | ActionMailer::Base.delivery_method = :smtp 50 | ActionMailer::Base.smtp_settings = { 51 | :address => "smtp.sendgrid.net", 52 | :user_name => ENV['SENDGRID_USERNAME'], 53 | :password => ENV['SENDGRID_PASSWORD'], 54 | :domain => 'localhost:3000', 55 | :port => 587, 56 | :authentication => :plain, 57 | :enable_starttls_auto => true 58 | } 59 | end 60 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Opencounter::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | # Raise exception on mass assignment protection for Active Record models 33 | config.active_record.mass_assignment_sanitizer = :strict 34 | 35 | # Print deprecation notices to the stderr 36 | config.active_support.deprecation = :stderr 37 | end 38 | -------------------------------------------------------------------------------- /config/initializers/airbrake.rb: -------------------------------------------------------------------------------- 1 | Airbrake.configure do |config| 2 | config.api_key = '290d7c45bfc02b3478fe1d8cc91c1826' 3 | end 4 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | # 8 | if Rails.env.production? && ENV['SECRET_TOKEN'].blank? 9 | raise 'SECRET_TOKEN environment variable must be set!' 10 | end 11 | 12 | Opencounter::Application.config.secret_token = 13 | ENV['SECRET_TOKEN'] || '295ff5b00376ae17a65225f202e74c02f8228feb708b33ad2d6749385a103ea69954cbd20a131fa4dec51618f5dc799401d9af174f6bb9e85c65e2f395e6498e' 14 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Opencounter::Application.config.session_store :cookie_store, key: '_opencounter_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Opencounter::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /config/locales/on_the_spot.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | on_the_spot: 3 | ok: Ok 4 | cancel: Cancel 5 | tooltip: Click to edit ... 6 | access_not_allowed: Access is not allowed -------------------------------------------------------------------------------- /config/locales/on_the_spot.fr.yml: -------------------------------------------------------------------------------- 1 | fr: 2 | on_the_spot: 3 | ok: Ok 4 | cancel: Annuler 5 | tooltip: Cliquer pour modifier ... 6 | access_not_allowed: Il n'est pas permis de modifier cette valeur -------------------------------------------------------------------------------- /config/requirejs.yml: -------------------------------------------------------------------------------- 1 | modules: 2 | - name: 'app/main' -------------------------------------------------------------------------------- /db/migrate/20120713193322_create_fields.rb: -------------------------------------------------------------------------------- 1 | class CreateFields < ActiveRecord::Migration 2 | def change 3 | create_table :fields do |t| 4 | t.string :format 5 | t.text :prompt 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20120713193521_create_forms.rb: -------------------------------------------------------------------------------- 1 | class CreateForms < ActiveRecord::Migration 2 | def change 3 | create_table :forms do |t| 4 | t.string :title 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20120713193609_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table :users do |t| 4 | t.string :first_name 5 | t.string :last_name 6 | t.string :last_state 7 | t.string :email 8 | t.string :token 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20120713193643_create_answers.rb: -------------------------------------------------------------------------------- 1 | class CreateAnswers < ActiveRecord::Migration 2 | def change 3 | create_table :answers do |t| 4 | t.text :text 5 | t.integer :user_id 6 | t.integer :field_id 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20120713205437_create_fields_forms.rb: -------------------------------------------------------------------------------- 1 | class CreateFieldsForms < ActiveRecord::Migration 2 | def change 3 | create_table :fields_forms, :id => false do |t| 4 | t.references :field 5 | t.references :form 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20120730221215_add_jurisdiction_to_forms.rb: -------------------------------------------------------------------------------- 1 | class AddJurisdictionToForms < ActiveRecord::Migration 2 | def change 3 | 4 | add_column :forms, :jurisdiction, :string 5 | 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20120730234125_add_phone_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddPhoneToUsers < ActiveRecord::Migration 2 | def change 3 | 4 | add_column :users, :phone, :int 5 | 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20120730234147_add_role_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRoleToUsers < ActiveRecord::Migration 2 | def change 3 | 4 | add_column :users, :role, :string 5 | 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20120803223450_add_name_and_key_to_fields.rb: -------------------------------------------------------------------------------- 1 | class AddNameAndKeyToFields < ActiveRecord::Migration 2 | def change 3 | add_column :fields, :name, :string 4 | add_column :fields, :key, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120803224303_remove_timestamps_from_form_fields.rb: -------------------------------------------------------------------------------- 1 | class RemoveTimestampsFromFormFields < ActiveRecord::Migration 2 | def change 3 | remove_column :fields_forms, :created_at 4 | remove_column :fields_forms, :updated_at 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20120805180714_create_fees.rb: -------------------------------------------------------------------------------- 1 | class CreateFees < ActiveRecord::Migration 2 | def change 3 | create_table :fees do |t| 4 | t.text :conditions 5 | t.text :formula 6 | t.text :payable_to 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20120815011951_create_businesses.rb: -------------------------------------------------------------------------------- 1 | class CreateBusinesses < ActiveRecord::Migration 2 | def change 3 | create_table :businesses do |t| 4 | t.string :name 5 | t.text :description 6 | t.integer :user_id 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20120822014908_delete_fees_table.rb: -------------------------------------------------------------------------------- 1 | class DeleteFeesTable < ActiveRecord::Migration 2 | def up 3 | drop_table :fees 4 | end 5 | 6 | def down 7 | create_table :fees do |t| 8 | t.text :conditions 9 | t.text :formula 10 | t.text :payable_to 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20120822014923_add_business_id_to_answer.rb: -------------------------------------------------------------------------------- 1 | class AddBusinessIdToAnswer < ActiveRecord::Migration 2 | def change 3 | add_column :answers, :business_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120822015102_remove_user_id_from_answer.rb: -------------------------------------------------------------------------------- 1 | class RemoveUserIdFromAnswer < ActiveRecord::Migration 2 | def up 3 | remove_column :answers, :user_id 4 | end 5 | 6 | def down 7 | add_column :answers, :user_id, :integer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20120919214135_create_delayed_jobs.rb: -------------------------------------------------------------------------------- 1 | class CreateDelayedJobs < ActiveRecord::Migration 2 | def self.up 3 | create_table :delayed_jobs, :force => true do |table| 4 | table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue 5 | table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually. 6 | table.text :handler # YAML-encoded string of the object that will do work 7 | table.text :last_error # reason for last failure (See Note below) 8 | table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. 9 | table.datetime :locked_at # Set when a client is working on this object 10 | table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) 11 | table.string :locked_by # Who is working on this object (if locked) 12 | table.string :queue # The name of the queue this job is in 13 | table.timestamps 14 | end 15 | 16 | add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' 17 | end 18 | 19 | def self.down 20 | drop_table :delayed_jobs 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /db/migrate/20120921215004_change_answer_and_field.rb: -------------------------------------------------------------------------------- 1 | class ChangeAnswerAndField < ActiveRecord::Migration 2 | def up 3 | change_table :answers do |t| 4 | t.rename :text, :value 5 | end 6 | 7 | change_table :fields do |t| 8 | t.remove :key 9 | end 10 | end 11 | 12 | def down 13 | change_table :answers do |t| 14 | t.rename :value, :value 15 | end 16 | 17 | change_table :fields do |t| 18 | t.string :key 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /db/migrate/20120921221142_change_phone_type.rb: -------------------------------------------------------------------------------- 1 | class ChangePhoneType < ActiveRecord::Migration 2 | def up 3 | change_table :users do |t| 4 | t.change :phone, :string 5 | end 6 | end 7 | 8 | def down 9 | change_table :users do |t| 10 | t.change :phone, :integer 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20120921225738_change_field_i_dto_field_name.rb: -------------------------------------------------------------------------------- 1 | class ChangeFieldIDtoFieldName < ActiveRecord::Migration 2 | def up 3 | change_table :answers do |t| 4 | t.remove :field_id 5 | t.string :field_name 6 | end 7 | end 8 | 9 | def down 10 | change_table :answers do |t| 11 | t.remove :field_name 12 | t.id :field_id 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20120924214233_create_cic_codes.rb: -------------------------------------------------------------------------------- 1 | class CreateCicCodes < ActiveRecord::Migration 2 | def change 3 | create_table :cic_codes do |t| 4 | t.string :code 5 | t.string :industry 6 | t.string :subindustry 7 | t.text :keywords 8 | t.boolean :home_occ_prohibited, :default => false 9 | t.timestamps 10 | end 11 | add_index :cic_codes, :code 12 | add_index :cic_codes, :keywords 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20120924220105_create_zoning_districts.rb: -------------------------------------------------------------------------------- 1 | class CreateZoningDistricts < ActiveRecord::Migration 2 | def change 3 | create_table :zoning_districts do |t| 4 | t.string :code 5 | t.string :name 6 | t.text :description 7 | t.boolean :home_occ_prohibited, :default => false 8 | t.timestamps 9 | end 10 | add_index :zoning_districts, :code 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20120924221042_create_cic_code_zoning_districts.rb: -------------------------------------------------------------------------------- 1 | class CreateCicCodeZoningDistricts < ActiveRecord::Migration 2 | def change 3 | create_table :cic_code_zoning_districts do |t| 4 | t.integer :cic_code_id 5 | t.integer :zoning_district_id 6 | t.integer :permission, :default => 5 7 | t.boolean :home_occ_prohibited, :default => false 8 | t.text :notes 9 | t.timestamps 10 | end 11 | add_index :cic_code_zoning_districts, :cic_code_id 12 | add_index :cic_code_zoning_districts, :zoning_district_id 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20120927020404_add_parent_id_to_cic_codes.rb: -------------------------------------------------------------------------------- 1 | class AddParentIdToCicCodes < ActiveRecord::Migration 2 | def change 3 | add_column :cic_codes, :parent_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20120928225408_create_sic_codes.rb: -------------------------------------------------------------------------------- 1 | class CreateSicCodes < ActiveRecord::Migration 2 | def change 3 | create_table :sic_codes do |t| 4 | t.string :code 5 | t.string :industry 6 | t.string :subindustry 7 | t.integer :parent_id 8 | t.timestamps 9 | end 10 | add_index :sic_codes, :code 11 | 12 | create_table :cic_codes_sic_codes, :id => false do |t| 13 | t.integer :cic_code_id 14 | t.integer :sic_code_id 15 | end 16 | add_index :cic_codes_sic_codes, :cic_code_id 17 | add_index :cic_codes_sic_codes, :sic_code_id 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /db/migrate/20121102212652_create_requirements.rb: -------------------------------------------------------------------------------- 1 | class CreateRequirements < ActiveRecord::Migration 2 | def change 3 | create_table :requirements do |t| 4 | t.string :name 5 | t.text :notes 6 | t.string :jurisdiction 7 | t.timestamps 8 | end 9 | 10 | create_table :cic_codes_requirements, :id => false do |t| 11 | t.integer :cic_code_id 12 | t.integer :requirement_id 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20121104190433_create_cic_code_requirements.rb: -------------------------------------------------------------------------------- 1 | class CreateCicCodeRequirements < ActiveRecord::Migration 2 | def up 3 | drop_table :cic_codes_requirements 4 | 5 | create_table :cic_code_requirements do |t| 6 | t.integer :cic_code_id 7 | t.integer :requirement_id 8 | t.timestamps 9 | end 10 | add_index :cic_code_requirements, :cic_code_id 11 | add_index :cic_code_requirements, :requirement_id 12 | end 13 | 14 | def down 15 | drop_table :cic_code_requirements 16 | 17 | create_table :cic_codes_requirements, :id => false do |t| 18 | t.integer :cic_code_id 19 | t.integer :requirement_id 20 | end 21 | add_index :cic_codes_requirements, :cic_code_id 22 | add_index :cic_codes_requirements, :requirement_id 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /db/migrate/20121112181309_add_shortname_to_requirements.rb: -------------------------------------------------------------------------------- 1 | class AddShortnameToRequirements < ActiveRecord::Migration 2 | def change 3 | add_column :requirements, :short_name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121112193530_add_home_occ_to_requirements.rb: -------------------------------------------------------------------------------- 1 | class AddHomeOccToRequirements < ActiveRecord::Migration 2 | def change 3 | add_column :requirements, :home_occ, :boolean, :default => false 4 | add_column :requirements, :commercial, :boolean, :default => false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20121112195940_create_requirement_zoning_districts.rb: -------------------------------------------------------------------------------- 1 | class CreateRequirementZoningDistricts < ActiveRecord::Migration 2 | 3 | def up 4 | create_table :requirement_zoning_districts do |t| 5 | t.integer :zoning_district_id 6 | t.integer :requirement_id 7 | t.timestamps 8 | end 9 | add_index :requirement_zoning_districts, :zoning_district_id 10 | add_index :requirement_zoning_districts, :requirement_id 11 | end 12 | 13 | def down 14 | drop_table :requirement_zoning_districts 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20121115180142_devise_create_admin_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateAdminUsers < ActiveRecord::Migration 2 | def change 3 | create_table(:admin_users) do |t| 4 | ## Database authenticatable 5 | t.string :email, :null => false, :default => "" 6 | t.string :encrypted_password, :null => false, :default => "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, :default => 0 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.string :current_sign_in_ip 20 | t.string :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | ## Token authenticatable 34 | # t.string :authentication_token 35 | 36 | 37 | t.timestamps 38 | end 39 | 40 | add_index :admin_users, :email, :unique => true 41 | add_index :admin_users, :reset_password_token, :unique => true 42 | # add_index :admin_users, :confirmation_token, :unique => true 43 | # add_index :admin_users, :unlock_token, :unique => true 44 | # add_index :admin_users, :authentication_token, :unique => true 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /db/migrate/20121120213750_add_submitted_to_businesses.rb: -------------------------------------------------------------------------------- 1 | class AddSubmittedToBusinesses < ActiveRecord::Migration 2 | def change 3 | add_column :businesses, :submitted, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121120222310_add_submitted_at_to_businesses.rb: -------------------------------------------------------------------------------- 1 | class AddSubmittedAtToBusinesses < ActiveRecord::Migration 2 | def change 3 | add_column :businesses, :submitted_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121205214719_add_remember_token_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddRememberTokenToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :remember_token, :string 4 | add_index :users, :remember_token 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20121210205959_remove_remember_token_from_users.rb: -------------------------------------------------------------------------------- 1 | class RemoveRememberTokenFromUsers < ActiveRecord::Migration 2 | def up 3 | remove_column :users, :remember_token 4 | end 5 | 6 | def down 7 | add_column :users, :remember_token, :string 8 | add_index :users, :remember_token 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20121220221822_add_password_digest_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddPasswordDigestToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :password_digest, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121221012848_add_account_type_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAccountTypeToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :account_type, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121223214141_remove_field.rb: -------------------------------------------------------------------------------- 1 | class RemoveField < ActiveRecord::Migration 2 | def change 3 | drop_table :fields 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121223223006_add_token_to_businesses.rb: -------------------------------------------------------------------------------- 1 | class AddTokenToBusinesses < ActiveRecord::Migration 2 | def change 3 | add_column :businesses, :token, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121224003012_add_token_index_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddTokenIndexToUsers < ActiveRecord::Migration 2 | def change 3 | add_index :users, :token 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121224042232_add_current_business_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddCurrentBusinessToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :current_business_token, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20121224045321_change_current_business_token_to_string.rb: -------------------------------------------------------------------------------- 1 | class ChangeCurrentBusinessTokenToString < ActiveRecord::Migration 2 | def up 3 | remove_column :users, :current_business_token 4 | add_column :users, :current_business_token, :string 5 | end 6 | 7 | def down 8 | remove_column :users, :current_business_token 9 | add_column :users, :current_business_token, :integer 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20130106075302_add_sort_order_to_requirements.rb: -------------------------------------------------------------------------------- 1 | class AddSortOrderToRequirements < ActiveRecord::Migration 2 | def change 3 | add_column :requirements, :sort_order, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /demo/img/opencounter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/demo/img/opencounter_logo.png -------------------------------------------------------------------------------- /demo/img/planning-department-map.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/demo/img/planning-department-map.jpg -------------------------------------------------------------------------------- /demo/img/planning-department.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/demo/img/planning-department.png -------------------------------------------------------------------------------- /demo/js/lib/jquery.tinypubsub.js: -------------------------------------------------------------------------------- 1 | /* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011 2 | * http://benalman.com/ 3 | * Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ 4 | 5 | (function($) { 6 | 7 | var o = $({}); 8 | 9 | $.subscribe = function() { 10 | o.on.apply(o, arguments); 11 | }; 12 | 13 | $.unsubscribe = function() { 14 | o.off.apply(o, arguments); 15 | }; 16 | 17 | $.publish = function() { 18 | o.trigger.apply(o, arguments); 19 | }; 20 | 21 | }(jQuery)); -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/lib/assets/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/import_cic_code_zoning_districts.rake: -------------------------------------------------------------------------------- 1 | require 'csv' 2 | desc "Connect CIC Codes to Zoning Districts /app/assets/csv/cic_codes_and_zoning_districts.csv" 3 | namespace :import do 4 | task :cic_code_zoning_districts => :environment do 5 | @connections = 0 6 | def create_mappings(zoning_district_id, cic_codes, permission_type) 7 | if cic_codes.present? 8 | cic_codes.each do |cic_code| 9 | cic = CicCode.find_by_code(cic_code.try(:strip).try(:upcase)) 10 | if cic.present? 11 | connector = CicCodeZoningDistrict.find_or_create_by_cic_code_id_and_zoning_district_id(cic.id, zoning_district_id) 12 | connector.update_attribute(:permission, permission_type) 13 | @connections += 1 14 | end 15 | end 16 | end 17 | end 18 | 19 | counter = 0 20 | CSV.foreach("#{Rails.root}/app/assets/csv/cic_codes_and_zoning_districts.csv", :headers => false) do |row| 21 | unless row[0].blank? 22 | counter += 1 23 | unless counter == 1 24 | zoning_district = ZoningDistrict.find_by_code(row[0]) 25 | if zoning_district.present? 26 | permitted_cics = row[1].try(:split, ', ') 27 | permitted_aup_cics = row[2].try(:split, ', ') 28 | permitted_sup_cics = row[3].try(:split, ', ') 29 | prohibited_cics = row[4].try(:split, ', ') 30 | unknown_cics = row[5].try(:split, ', ') 31 | 32 | create_mappings(zoning_district.id, permitted_cics, 1) 33 | create_mappings(zoning_district.id, permitted_aup_cics, 2) 34 | create_mappings(zoning_district.id, permitted_sup_cics, 3) 35 | create_mappings(zoning_district.id, prohibited_cics, 4) 36 | create_mappings(zoning_district.id, unknown_cics, 5) 37 | 38 | end 39 | end 40 | end 41 | end 42 | puts "#{@connections} CIC Code / Zoning District connections" 43 | end 44 | end -------------------------------------------------------------------------------- /lib/tasks/import_cic_codes.rake: -------------------------------------------------------------------------------- 1 | require 'csv' 2 | desc "Import Business Codes from /app/assets/csv/cic_codes.csv" 3 | namespace :import do 4 | task :cic_codes => :environment do 5 | counter = 0 6 | CSV.foreach("#{Rails.root}/app/assets/csv/cic_codes.csv", :headers => false) do |row| 7 | unless row[0].blank? 8 | counter += 1 9 | CicCode.create(:code => row[0], :industry => row[1], :subindustry => row[2]) 10 | end 11 | end 12 | puts "#{counter} CIC Codes imported" 13 | end 14 | end -------------------------------------------------------------------------------- /lib/tasks/import_cic_sic_connections.rake: -------------------------------------------------------------------------------- 1 | require 'csv' 2 | desc "Connect CIC and SIC Codes from /app/assets/csv/zoning_and_sic_codes.csv" 3 | namespace :import do 4 | task :cic_sic_connections => :environment do 5 | counter = 0 6 | CSV.foreach("#{Rails.root}/app/assets/csv/zoning_and_sic_codes.csv", :headers => false) do |row| 7 | unless row[0].blank? 8 | counter += 1 9 | cic_code = CicCode.find_by_code(row[2]) 10 | sic_code = SicCode.find_by_code(row[6]) 11 | if cic_code.present? && sic_code.present? 12 | cic_code.sic_codes << sic_code 13 | end 14 | end 15 | end 16 | puts "#{counter} CIC and SIC Codes connected" 17 | end 18 | end -------------------------------------------------------------------------------- /lib/tasks/import_sic_codes.rake: -------------------------------------------------------------------------------- 1 | require 'csv' 2 | desc "Import SIC Codes from /app/assets/csv/sic_codes.csv" 3 | namespace :import do 4 | task :sic_codes => :environment do 5 | counter = 0 6 | CSV.foreach("#{Rails.root}/app/assets/csv/sic_codes.csv", :headers => false) do |row| 7 | unless row[0].blank? 8 | counter += 1 9 | SicCode.create(:code => row[0], :industry => row[1], :subindustry => row[2]) 10 | end 11 | end 12 | puts "#{counter} SIC Codes imported" 13 | end 14 | end -------------------------------------------------------------------------------- /lib/tasks/import_zoning_districts.rake: -------------------------------------------------------------------------------- 1 | require 'csv' 2 | desc "Import Zoning Districts /app/assets/csv/zoning_districts.csv" 3 | namespace :import do 4 | task :zoning_districts => :environment do 5 | counter = 0 6 | CSV.foreach("#{Rails.root}/app/assets/csv/zoning_districts.csv", :headers => false) do |row| 7 | unless row[0].blank? 8 | counter += 1 9 | unless counter == 1 10 | zd = ZoningDistrict.create(:code => row[0], :name => row[1], :description => row[2]) 11 | zd.update_attribute(:home_occ_prohibited, true) if row[3] == 'Y' 12 | end 13 | end 14 | end 15 | puts "#{counter} Zoning Districts imported" 16 | end 17 | end -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= semantic_form_for @<%= singular_name %> do |f| %> 2 | <%%= f.inputs do %> 3 | <%- attributes.each do |attribute| -%> 4 | <%%= f.input :<%= attribute.name %> %> 5 | <%- end -%> 6 | <%% end %> 7 | 8 | <%%= f.actions do %> 9 | <%%= f.action :submit, :as => :input %> 10 | <%% end %> 11 | <%% end %> 12 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Code for America 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | * Neither the name of Code for America nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/log/.gitkeep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /public/templates/helpers/city/administrative_use_permit.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | ADMINISTRATIVE USE PERMIT 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/bida.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | BUSINESS IMPROVEMENT DISTRICT ASSESSMENT 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/business_license.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | BUSINESS LICENSE 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/ehs.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | ENVIRONMENTAL HEALTH & SAFETY 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/parking.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | PARKING 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/sign.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | SIGN 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/special_use_permit.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | SPECIAL USE PERMIT 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/traffic_impact_fee.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | TRAFFIC IMPACT FEE 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/utility_services.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | UTILITY SERVICES 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/waste_water_discharge.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | WASTE WATER DISCHARGE 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/city/zoning_clearance.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | ZONING CLEARANCE 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/county/fbn.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | FICTITIOUS BUSINESS NAME 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/federal/irs_ein.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | IRS EMPLOYER IDENTIFICATION NUMBER (EIN) APPLICATION 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/state/abc.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | ALCOHOLIC BEVERAGE COMMISSION PERMIT 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/state/incorporation.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | INCORPORATION 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/state/payroll_tax.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | PAYROLL TAX 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/helpers/state/sellers_permit.txt: -------------------------------------------------------------------------------- 1 | ================================================================================ 2 | 3 | SELLER'S PERMIT 4 | 5 | ================================================================================ -------------------------------------------------------------------------------- /public/templates/layouts/main.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 |
7 |

OpenCounter

8 |

Start your business in Santa Cruz, CA.

9 |
10 | 11 |
12 | 13 |
14 |

Have Questions? Get Help →

15 |
16 | 17 |
18 | 19 |
20 | 21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 | 29 |
30 | 31 | 32 |
33 | 34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 | 42 | 43 |
44 |

OpenCounter is brought to you by the city of Santa Cruz and Code for America. Learn more, or give us feedback.

45 |
-------------------------------------------------------------------------------- /public/templates/navigation.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • Get Started
  • 3 |
  • You & Your Business
  • 4 |
  • Your Location
  • 5 |
  • Requirements
  • 6 |
  • Summary
  • 7 |
8 | -------------------------------------------------------------------------------- /public/templates/panels/about.html: -------------------------------------------------------------------------------- 1 |
2 |

About OpenCounter

3 |
4 | 5 |
6 |
7 |

OpenCounter is the result of a collaboration between the City of Santa Cruz, CA and Code for America.

8 |
9 |
10 |

Disclaimer

11 |

Please note that OpenCounter is intended to supplement, not replace, advice from Planning Department staff.

12 |

Though we do our best to give you accurate information, additional information regarding your business, the property, or your plans may alter the Planning Department’s determination or advice on how to proceed.

13 |
14 |
15 | -------------------------------------------------------------------------------- /public/templates/panels/help.html: -------------------------------------------------------------------------------- 1 |
2 |

Get Help

3 |
4 | 5 |
6 |
7 |
8 |
9 | 10 | 11 |
12 | 13 |
14 | We'll call you at 15 |
16 | 17 |
18 | We'll email you at 19 |
20 | 21 |

We'll include everything you've told us so far

22 | 23 |
24 | Send to Planning → 25 |
26 |
27 |
-------------------------------------------------------------------------------- /public/templates/panels/info.html: -------------------------------------------------------------------------------- 1 |
2 |

Tell Us About Yourself

3 |
4 | 5 |
6 |
7 |

The rest of this guide is tailored to you and your business.

8 |

To make sure we're asking the right questions, we first need to know if you're the owner of this business and the location where it will be located, or if you're filling this out to secure permits on a location which you are leasing.

9 |

This will let City staff know whether or not they need to secure the property owner's permission before issuing some permits.

10 | 11 |
12 | <% if (answers.is_owner == null) { %> 13 |

You haven't told us whether you're the property owner or not.

14 |

Yes, I own the property →

15 | No, I don't own the property → 16 | <% } else { %> 17 | <% if (answers.is_owner == 'no') { %> 18 |

You've told us that you are not the owner.

19 | Secure permits on a property → 20 | <% } else { %> 21 |

You've told us that you are the owner.

22 | Applicant info → 23 | <% } %> 24 | <% } %> 25 |
26 |
27 |
-------------------------------------------------------------------------------- /public/templates/panels/info/applicant.html: -------------------------------------------------------------------------------- 1 |
2 |

About You

3 |
4 | 5 |
6 | 7 |
8 | 9 | 10 |

About you, the business owner

11 | 12 |
13 | 14 |
15 | 16 |
17 |
18 | 19 |
20 | 21 |
22 |
23 | 24 | 28 | 29 |
30 | 31 |
32 |
33 | 34 |
35 | 36 |
37 | About <% if (answers.is_owner === "true") { %>your<% } else { %>the<% } %> business → 38 |
39 |
40 | 41 |
42 | 43 | 65 | -------------------------------------------------------------------------------- /public/templates/panels/intro/big_picture.html: -------------------------------------------------------------------------------- 1 |
2 |

The Big Picture

3 |
4 | 5 |
6 |
7 |

Here's how to start a business in the City of Santa Cruz.

8 |
    9 |
  1. First, secure a planning permit from the City’s Planning Department. If you’re starting a business, even if you're working from home, the City has to approve that use in your location.
  2. 10 |
  3. Next, if you’re doing any renovations or tenant improvements, get a building permit from the City of Santa Cruz Building Department.
  4. 11 |
  5. Finally, obtain a business license from the City of Santa Cruz Finance Department.
  6. 12 |
13 |

While that covers most City processes, there are also county, regional, state, and federal regulations that may apply to your business. We’ve included tools to help you research and fulfill those requirements, too.

14 | 15 |
16 | We’re here to help → 17 |
18 |
19 |
-------------------------------------------------------------------------------- /public/templates/panels/location.html: -------------------------------------------------------------------------------- 1 |
2 |

Business Location

3 |
4 | 5 |
6 |
7 |

The rules are different for work-from-home businesses and those that operate out of commercial locations. Please indicate whether <%= (answers.is_owner === "true") ? "you" : "the owner" %> will be:

8 | 9 | 24 | 25 |
26 | <% if (answers.location_type) { %> 27 | 28 | <% } else { %> 29 | 30 | <% } %> 31 |

Working from home →

32 |

Working out of a commercial space →

33 |
34 |
35 |
-------------------------------------------------------------------------------- /public/templates/panels/location/check.html: -------------------------------------------------------------------------------- 1 |
2 |

Check Your Business Zoning

3 |
4 | 5 |
6 |
7 |

You’ve told us that your business, <%= answers.business_name %>, is classified as <%= answers.CIC_industry_subindustry %> (code <%= answers.CIC_code %>).

8 |

What is your business’s physical address?

9 |
10 |   11 |
12 |
13 |
14 | 15 |
16 | Requirements → 17 |
18 |
19 | 20 |
21 | -------------------------------------------------------------------------------- /public/templates/panels/location/commercial.html: -------------------------------------------------------------------------------- 1 |
2 |

Siting Your Business

3 |
4 | 5 |
6 |
7 |

If you’re not working out of your home, you will need to pick a location that is zoned to allow businesses like yours to operate.

8 |

Zoning

9 |

Zoning laws limit the types of businesses that can operate within a particular area.

10 |

Why? By clustering types of businesses, we can help preserve neighborhoods and share services.

11 |

Think of it this way: zoning makes sure a rubber factory can’t open next to a preschool.

12 |

In Santa Cruz, all zones are defined by title 24 of the City’s municipal code.

13 |

Use & Prior Use

14 |

While Santa Cruz actively encourages creative reuse of buildings in town, it is much simpler to locate your business in a commercial space that has a prior use that’s similar to to one you’re proposing.

15 |

For example, if you are opening a restaurant, try to go into a space that previously held a restaurant.

16 |

If the past use matches your proposed use, it simplifies staff review.

17 |

This strategy will also have implications for the cost of the project, as changing the use of a location may entail additional "impact fees." These will be covered later in this guide.

18 | 19 |
20 |

Have you already picked out a space for your business?

21 | Not yet, help me choose a site → 22 |
23 |
24 | Yes, check my site's zoning and prior use → 25 |
26 |
27 |
-------------------------------------------------------------------------------- /public/templates/panels/location/research.html: -------------------------------------------------------------------------------- 1 |
2 |

Choose a Site

3 |
4 | 5 |
6 |

We've put together these tools to help you research and choose a site that's a good fit for your business.

7 | 8 |

See available commercial real estate in Santa Cruz

9 | 10 | 11 |

Check the zoning and prior use for a site

12 | 13 | 14 | 15 |

Example: 1367 Pacific Avenue

16 | 17 |
18 | Check your site → 19 |
20 |
21 | -------------------------------------------------------------------------------- /public/templates/panels/requirements.html: -------------------------------------------------------------------------------- 1 |
2 | <% if (answers.is_owner === "true") { %> 3 |

Your business’ requirements

4 | <% }else{ %> 5 |

Business Requirements

6 | <% } %> 7 |
8 | 9 |
10 |
11 |

Based on what you've told us about your business, let's walk through all of the requirements.

12 |
13 |
14 | 15 |
16 | <% if ((!answers.applicant_first_name) || (!answers.business_name) || (!answers.location_type)) { %> 17 |
18 |

Before we can walk you through the requirements that apply to your business, we'll need some basic information.

19 |
    20 | <% if (!answers.applicant_first_name) { %> 21 |
  • You haven't told us about yourself or the business owner. ← Go back
  • 22 | <% } %> 23 | <% if (!answers.business_name) { %> 24 |
  • You haven't told us about your business. ← Go back
  • 25 | <% } %> 26 | <% if (!answers.location_type) { %> 27 |
  • You haven't told us whether you'll be working from home or a commercial space. ← Go back
  • 28 | <% } %> 29 |
30 |
31 | 32 | <% } else { %> 33 | 34 |
35 | Get Started → 36 |
37 | <% } %> 38 | 39 |
40 | -------------------------------------------------------------------------------- /public/templates/panels/requirements/city/waste_water_discharge.html: -------------------------------------------------------------------------------- 1 |
2 |

Waste Water Discharge

3 |
4 | 5 |
6 |

This permit is required for food and manufacturing users or any business whose operations place a greater demand on City waste water facilities. The City normally requires this permit from these kinds of businesses:

7 |
    8 |
  • Categorical processes or operations as defined by federal regulations
  • 9 |
  • An average wastewater flow of 25,000 gallons per day
  • 10 |
  • A concentrated waste flow
  • 11 |
  • Dry cleaning operations
  • 12 |
  • Groundwater extraction and treatment operations
  • 13 |
  • Potential to have an adverse affect on wastewater workers, the wastewater collection system, or the wastewater treatment plant
  • 14 |
15 |

There are no application or permit fees, and your planner will help you get this form sorted as you do your tenant improvements and go through the building process.

16 |

Wastewater discharge permits are typically issued for a period of three years. The City may issue a permit for a period less than three years or one that expires on a specific date. A permit may not be reassigned, transferred, or sold to a new owner, new user, different premises or a new or changed operation.

17 |
18 | 19 |
20 | <%= nextRequirementName %> → 21 |
22 | -------------------------------------------------------------------------------- /public/templates/panels/requirements/federal/irs_ein_application.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/public/templates/panels/requirements/federal/irs_ein_application.html -------------------------------------------------------------------------------- /public/templates/panels/requirements/state/alcoholic_beverage_control.html: -------------------------------------------------------------------------------- 1 |
2 |

ABC permits

3 |
4 | 5 |
6 | 7 |

Earlier in this guide, you've told us that your business will sell alcohol. 8 |

This process involves not only the City's Police Department and Planning and Community Development staff, but also the State's Department of Alcoholic Beverage Control. Securing an ABC permit will take some time and the information that the ABC asks for is both detailed and extensive, including your business' layout, your employment and financial history and other personal details. 9 |

This guide will help you complete your application questionnaire, which will be required of anyone who would like to get a permit from the ABC. 10 |

Your contact in the Planning Department will help you with preparing many of the documents that will come later, including the layout of your business and hours of operation, as well as other conditions that the City will ask for during the permitting process. 11 |

    12 |
  • Listing of all ABC forms
  • 13 |
  • Flowchart of how an ABC application works
  • 14 |
  • Application Questionnaire
  • 15 |
  • Zoning Affidavit
  • 16 |
  • Personal Affidavit
  • 17 |
  • Individual Financial Affidavit
  • 18 |
  • Licensed Premise Diagram
  • 19 |
20 | 21 |
22 | <%= nextRequirementName %> → 23 |
24 | 25 |
-------------------------------------------------------------------------------- /public/templates/panels/requirements/state/incorporation.html: -------------------------------------------------------------------------------- 1 |
2 |

Incorporation

3 |
4 | 5 |
6 |

You don’t need to incorporate to start a business in Santa Cruz, but it should be something you think about.

7 |

For more information on incorporation, speak with an accountant or visit The California Business Portal.

8 | 9 | <% if (answers.business_structure) { %> 10 | 11 |

You’ve told us that <%= (answers.is_owner === 'y') ? 'your' : 'this' %> business is structured as a <%= answers.business_structure %>.

12 | 13 | <% } else { %> 14 | 15 |

You haven’t yet told us how your business is structured. ← Go back

16 | 17 | <% } %> 18 | 19 |

You’ve told us that <%= (answers.is_owner === "true") ? "you are" : "the owner is" %> <%= (answers.applicant_is_sole_owner) ? "" : "not" %> the sole owner of this business.

20 | 21 | 37 |
38 | <%= nextRequirementName %> → 39 |
40 |
41 | -------------------------------------------------------------------------------- /public/templates/panels/requirements/state/payroll_tax.html: -------------------------------------------------------------------------------- 1 |
2 |

Payroll Tax

3 |
4 | 5 |
6 |

You’ve told us that your business<% if (answers.business_name) { %>, <%= answers.business_name %>,<% } %> is structured as a <%= answers.business_structure %>. It's likely that you’ll have employees. As such, you'll need to register with the State of California for Payroll Tax.

7 | 8 |

The State has information about how has to pay this tax on their website here.

9 |

In their words, "generally, a business becomes subject to State payroll taxes upon paying wages over $100 in a calendar quarter to one or more employees. Wages consist of compensation for services performed, including cash payments, commissions, bonuses, and the reasonable cash value of noncash payments (like meals and lodging) for services. Once subject, an employer must complete and submit a registration form to EDD within 15 days."

10 | 11 |

How to Register

12 | 13 |

We’re sorry, but due to the comlexity of this matter, OpenCounter doesn’t automatically select the proper form for you at the state. We hope to add this feature eventually, for now, we’re linking to the State's forms.

14 | 15 |
    16 |
  • Commercial Employers, Pacific Maritime, and Fishing Boats (DE 1)
  • 17 |
  • Agricultural (DE 1AG)
  • 18 |
  • Governmental Organizations, Public Schools, & Indian Tribes (DE 1GS)
  • 19 |
  • Nonprofit Employers (DE 1NP)
  • 20 |
  • Personal Income Tax Withholding Only (DE 1P)
  • 21 |
  • Employer of Household Workers (DE1HW)
  • 22 |
23 | 24 |

You can also register by telephone by calling the EDD Tele-Reg service at (916) 654-8706. Please make sure to have a completed a registration form when you call. You will receive your EDD employer account number over the telephone and your new employer packet by mail.

25 | 26 |

Alternately, you can visit the closest Employee Development Department office. Here is the Office locator tool.

27 | 28 |
29 | <%= nextRequirementName %> → 30 |
31 | 32 |
-------------------------------------------------------------------------------- /public/templates/panels/requirements/state/sellers_permit.html: -------------------------------------------------------------------------------- 1 |
2 |

Seller’s Permit

3 |
4 | 5 |
6 | 7 |

Earlier in this guide, you’ve told us that your business will sell things to the public. This means that the State of California would like you to register for a “seller’s permit.” This registration is required for anyone who engages in “retail sales of tangible personal property.” Typically this means all clothing, housewares or other items that is sold directly to the public. This permit registers your business as a point of sale, and imports your information into the state’s taxation database. Sales tax is due quarterly to the state, and a portion of your sales tax stays within the community to pay for the services your shop will use, like policy and fire protection, city administration and services for small businesses.

8 |

The current sales tax rate in the City of Santa Cruz is 8.5%.

9 |

There is no upfront charge for the permit (unless you have unpaid taxes due to the state), but the State Board of Equalization may require a deposit. This deposit is used to cover any unpaid taxes that may be owed if the business closes. We’ve included some links below if you’d like to learn more. The BOE’s helpline is 800-400-7115.

10 | 11 |

Source

12 |
    13 |
  • English
  • 14 |
  • Español
  • 15 |
16 | 17 |

Guiding Regulations

18 |
    19 |
  • http://www.boe.ca.gov/sutax/staxregs.htm
  • 20 |
21 | 22 |

Seller’s Permit FAQ

23 |
    24 |
  • FAQ
  • 25 |
26 | 27 |

E-file system

28 |
    29 |
  • File online
  • 30 |
31 | 32 |
33 | <%= nextRequirementName %> → 34 |
35 | 36 |
-------------------------------------------------------------------------------- /public/templates/panels/welcome.html: -------------------------------------------------------------------------------- 1 |
2 |

Starting a business? We’re here to help.

3 |
4 | 5 |
6 |
7 |

This website will guide you through the business permitting process in Santa Cruz, CA.

8 |

You’ll learn what regulations and fees apply to your type of business, and we’ll help you get started on — or, in some cases, complete! — the paperwork you’ll need to file to open your doors.

9 |

OpenCounter is new software, and works best in Chrome or Safari right now. You may encounter some some bugs, please let us know, we’ll do our best to fix them.

10 |
11 | Let’s begin by learning about  the big picture → 12 |
13 |
14 |
-------------------------------------------------------------------------------- /public/templates/profile.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

New Here?Get started →

5 |
6 |
7 |

Returning?Jump back in →

8 |
9 |
10 |
-------------------------------------------------------------------------------- /public/templates/subnavigation.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. The Big Picture
  2. 3 |
  3. We're Here To Help
  4. 4 |
  5. Get Started
  6. 5 |
6 | 7 |
    8 |
  1. About You
  2. 9 |
  3. About Your Business
  4. 10 |
11 | 12 |
    13 |
  1. Work From Home
  2. 14 |
  3. Work From A Commercial Space
  4. 15 |
  5. Choose Your Site
  6. 16 |
  7. Check Your Site
  8. 17 |
18 | 19 |
    20 | 21 |
22 | -------------------------------------------------------------------------------- /script/delayed_job: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) 4 | require 'delayed/command' 5 | Delayed::Command.new(ARGV).daemonize 6 | -------------------------------------------------------------------------------- /script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /spec/controllers/admin/admin_users_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Admin::AdminUsersController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/cic_code_zoning_districts_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Admin::CicCodeZoningDistrictsController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/cic_codes_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Admin::CicCodesController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/requirements_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Admin::RequirementsController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/admin/zoning_districts_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Admin::ZoningDistrictsController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/answers_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | #describe AnswersController do 4 | # describe "GET #show" do 5 | # before :each do 6 | # @answer = FactoryGirl.create(:answer) 7 | # get :show, id: @answer, format: :json 8 | # end 9 | # 10 | # it("assigns @answer"){ assigns(:answer).should == @answer } 11 | # end 12 | #end 13 | -------------------------------------------------------------------------------- /spec/controllers/businesses_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe BusinessesController do 4 | 5 | describe "#create" do 6 | let(:name){ 7 | "test biz" 8 | } 9 | let(:desc){ 10 | "test biz" 11 | } 12 | let(:business){ 13 | {:name => name, :description => desc} 14 | } 15 | 16 | 17 | it "creates a business" do 18 | post :create, :business=> business, :format => :json 19 | 20 | response.code.should == '201' 21 | resp_json = JSON.parse response.body 22 | p resp_json 23 | 24 | resp_json["name"].should == name 25 | resp_json["description"].should == desc 26 | 27 | 28 | end 29 | it "saves in the db" do 30 | 31 | count = Business.count 32 | 33 | post :create, :business=> business, :format => :json 34 | 35 | Business.count.should > count 36 | 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /spec/controllers/cic_codes_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe CicCodesController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/home_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe HomeController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/permits_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe PermitsController do 4 | describe "GET #show" do 5 | context "when zoning exists" do 6 | let(:sic) { "1234" } 7 | let(:zoning) { "R-S" } 8 | 9 | it "returns the permit" do 10 | get :show, :sic => sic, :zoning => zoning 11 | response.code.should == '200' 12 | 13 | parsed_response = JSON.parse(response.body) 14 | parsed_response["permit"].should == 'zoning clearance' 15 | end 16 | end 17 | 18 | context "when zoning does not exist" do 19 | let(:sic) {"0000"} 20 | let(:zoning) {"R-S"} 21 | 22 | it "returns unkonwn" do 23 | get :show, :sic => sic, :zoning => zoning 24 | response.code.should == '200' 25 | parsed_response = JSON.parse(response.body) 26 | parsed_response["permit"].should == 'unknown' 27 | end 28 | 29 | end 30 | context "when zoning does not exist" do 31 | let(:sic) {"1234"} 32 | let(:zoning) {"JLKASD"} # <- not valid zone 33 | 34 | it "returns unkonwn" do 35 | get :show, :sic => sic, :zoning => zoning 36 | response.code.should == '200' 37 | parsed_response = JSON.parse(response.body) 38 | parsed_response["permit"].should == 'unknown' 39 | end 40 | 41 | end 42 | 43 | context "when zoning is explicitly unknown" do 44 | let(:sic) {"5555"} 45 | let(:zoning) {"R-S"} 46 | 47 | it "returns unkonwn" do 48 | get :show, :sic => sic, :zoning => zoning 49 | response.code.should == '200' 50 | parsed_response = JSON.parse(response.body) 51 | parsed_response["permit"].should == 'unknown' 52 | end 53 | end 54 | 55 | context "when sic falls within a range" do 56 | let(:sic) {"5025"} 57 | let(:zoning) {"R-S"} 58 | 59 | it "returns prohibited" do 60 | get :show, :sic => sic, :zoning => zoning 61 | response.code.should == '200' 62 | parsed_response = JSON.parse(response.body) 63 | parsed_response["permit"].should == 'prohibited' 64 | end 65 | 66 | end 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /spec/controllers/sessions_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe SessionsController do 4 | 5 | end 6 | -------------------------------------------------------------------------------- /spec/controllers/users_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe UsersController do 4 | describe "GET #show" do 5 | before :each do 6 | @user = FactoryGirl.create(:user) 7 | get :show, id: @user, format: :json 8 | end 9 | 10 | it("assigns @user") { assigns(:user).should == @user } 11 | end 12 | 13 | describe "POST #create" do 14 | before :each do 15 | user = FactoryGirl.attributes_for(:user) 16 | post :create, :user => user 17 | end 18 | 19 | it("assigns @user") { assigns(:user).should == user } 20 | it("sets the session") { session[:user_id].should == assigns(:user).id } 21 | it("renders :302") { response.status.should == 302 } 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/factories/admin_users.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :admin_user do 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/answers.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :answer do 5 | answer Faker::Lorem.words 6 | user 7 | field 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/businesses.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :business do 5 | name 'My biz' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/factories/cic_code_requirements.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :cic_code_requirement do 5 | cic_code_id 1 6 | requirement_id 1 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/factories/cic_code_zoning_districts.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :cic_code_zoning_district do 5 | cic_code_id 1 6 | zoning_district_id 1 7 | permitted false 8 | permitted_aup false 9 | permitted_sup false 10 | prohibited false 11 | home_occ_prohibited false 12 | notes "MyText" 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/factories/cic_codes.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :cic_code do 5 | code "MyString" 6 | industry "MyString" 7 | subindustry "MyString" 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/fields.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :field do 5 | format "string" 6 | prompt Faker::Lorem.sentence 7 | 8 | after(:create) do |field| 9 | field.forms.create(FactoryGirl.attributes_for(:form)) 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/factories/forms.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :form do 5 | sequence :title do |n| 6 | "form-#{n}" 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/requirements.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :requirement do 5 | name "MyString" 6 | notes "MyText" 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/factories/sic_codes.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :sic_code do 5 | code "MyString" 6 | industry "MyString" 7 | subindustry "MyString" 8 | parent_id 1 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/factories/users.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :user do 5 | first_name Faker::Name.first_name 6 | last_name Faker::Name.last_name 7 | email Faker::Internet.email 8 | #token Random.rand(0..10000) 9 | 10 | factory :invalid_user do 11 | email nil 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/factories/zoning_districts.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :zoning_district do 5 | code "MyString" 6 | name "MyString" 7 | description "MyText" 8 | home_occ_prohibited false 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/helpers/admin/admin_users_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::AdminUsersHelper. For example: 5 | # 6 | # describe Admin::AdminUsersHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe Admin::AdminUsersHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/admin/cic_code_zoning_districts_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::CicCodeZoningDistrictsHelper. For example: 5 | # 6 | # describe Admin::CicCodeZoningDistrictsHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe Admin::CicCodeZoningDistrictsHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/admin/cic_codes_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::CicCodesHelper. For example: 5 | # 6 | # describe Admin::CicCodesHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe Admin::CicCodesHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/admin/requirements_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::RequirementsHelper. For example: 5 | # 6 | # describe Admin::RequirementsHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe Admin::RequirementsHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/admin/zoning_districts_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the Admin::ZoningDistrictsHelper. For example: 5 | # 6 | # describe Admin::ZoningDistrictsHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe Admin::ZoningDistrictsHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/answers_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the FieldAnswersHelper. For example: 5 | # 6 | # describe FieldAnswersHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe AnswersHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/business_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the BusinessHelper. For example: 5 | # 6 | # describe BusinessHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe BusinessHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/cic_codes_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the CicCodesHelper. For example: 5 | # 6 | # describe CicCodesHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe CicCodesHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/home_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the HomeHelper. For example: 5 | # 6 | # describe HomeHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe HomeHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/permits_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the PermitsHelper. For example: 5 | # 6 | # describe PermitsHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe PermitsHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/helpers/users_helper_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Specs in this file have access to a helper object that includes 4 | # the UsersHelper. For example: 5 | # 6 | # describe UsersHelper do 7 | # describe "string concat" do 8 | # it "concats two strings with spaces" do 9 | # helper.concat_strings("this","that").should == "this that" 10 | # end 11 | # end 12 | # end 13 | describe UsersHelper do 14 | pending "add some examples to (or delete) #{__FILE__}" 15 | end 16 | -------------------------------------------------------------------------------- /spec/mailers/planning_mailer_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe PlanningMailer do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/admin_user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe AdminUser do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/answer_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Answer do 4 | it { should belong_to(:field) } 5 | it { should belong_to(:business) } 6 | end 7 | -------------------------------------------------------------------------------- /spec/models/application_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Application do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/business_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Business do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/cic_code_requirement_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe CicCodeRequirement do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/cic_code_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe CicCode do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/cic_code_zoning_district_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe CicCodeZoningDistrict do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/field_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Field do 4 | it { should have_many(:answers) } 5 | it { should have_and_belong_to_many(:forms) } 6 | end 7 | -------------------------------------------------------------------------------- /spec/models/form_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Form do 4 | it { should have_and_belong_to_many(:fields) } 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/requirement_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Requirement do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/sic_code_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe SicCode do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe User do 4 | it { should have_many(:businesses) } 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/zoning_district_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe ZoningDistrict do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV["RAILS_ENV"] ||= 'test' 3 | require File.expand_path("../../config/environment", __FILE__) 4 | require 'rspec/rails' 5 | require 'rspec/autorun' 6 | 7 | # Requires supporting ruby files with custom matchers and macros, etc, 8 | # in spec/support/ and its subdirectories. 9 | Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 10 | 11 | RSpec.configure do |config| 12 | # ## Mock Framework 13 | # 14 | # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 15 | # 16 | # config.mock_with :mocha 17 | # config.mock_with :flexmock 18 | # config.mock_with :rr 19 | 20 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 21 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 22 | 23 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 24 | # examples within a transaction, remove the following line or assign false 25 | # instead of true. 26 | config.use_transactional_fixtures = true 27 | 28 | # If true, the base class of anonymous controllers will be inferred 29 | # automatically. This will be the default behavior in future versions of 30 | # rspec-rails. 31 | config.infer_base_class_for_anonymous_controllers = false 32 | 33 | # Run specs in random order to surface order dependencies. If you find an 34 | # order dependency and want to debug it, you can fix the order by providing 35 | # the seed, which is printed after each run. 36 | # --seed 1234 37 | config.order = "random" 38 | end 39 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/vendor/assets/javascripts/.gitkeep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/vendor/assets/stylesheets/.gitkeep -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeforamerica/opencounter/2195fb1515e943e4814b2cf16caa73281088aba5/vendor/plugins/.gitkeep --------------------------------------------------------------------------------