diff --git a/.travis.yml b/.travis.yml index 9b759a8..09fad33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" before_script: - - psql -c 'create database starterapp_test;' -U postgres + - psql -c 'create database bikebike_test;' -U postgres diff --git a/DB specs.txt b/DB specs.txt new file mode 100644 index 0000000..b2f09e9 --- /dev/null +++ b/DB specs.txt @@ -0,0 +1,130 @@ +conference + - title : string + - slug : string + - start_date : datetime + - end_date : datetime + - info : text + - poster : *image + - banner : *image + - workshop_schedule_published : boolean + - registration_open : boolean + - meals_provided : boolean + - meal_info : *text + + - conference_type : [conference_type] + - host_organizations : NtoN[organization] + - locations : *NtoN[location] + - registration_form_fields : *NtoN[registration_form_field] + - workshop_resources : *NtoN[workshop_resource] + +*conference_type + - title : string + - slug : string + - info : text + +event + - title : string + - slug : string + - conference : [conference] + - info : text + - location : *[location] + - start_time : *datetime + - end_time : *datetime + +*location + - title : *string + - latitude : *float + - longitude : *float + - country : *string + - territory : *string + - city : *string + - street : *string + - postal_code : *string + +*organization + - name : string + - slug : string + - email_address : string + - shop_status : list(string) + - year_founded : integer + - info : text + - url : string + - logo : image + - icon : image + - requires_approval : boolean + - secret_question : *string + - secret_answer : *string(hashed) + - location : [location] + - members : NtoN[user_organization_replationship] + +registration_form_field + - title : string + - slug : string + - required : boolean + - field_type : list(string) + - options : *string + - other_option : *boolean + - retired : boolean + +request + - comment : text + - object : Nto1[object] + - is_invite : boolean + - state : list(string) + +*user_organization_relationship + - user : [user] + - organization : [organization] + - relationship : string + +workshop + - title : string + - slug : string + - info : text + - conference : [conference] + - stream : [workshop_stream] + - presentation_style : [presentation_style] + - requested_resources : NtoN[workshop_resource] + - facilitators : NtoN[user] + - min_facilitators : integer + - location : *[location] + - start_time : *datetime + - end_time : *datetime + +*workshop_presentation_style + - name : string + - slug : string + - info : text + +*workshop_resource + - name : string + - slug : string + - info : text + +*workshop_stream + - name : string + - slug : string + - info : text + +rails g scaffold organization name:string slug:string email_address:string url:string year_founded:integer info:text logo:string avatar:string requires_approval:boolean secret_question:string secret_answer:string location_id:integer user_organization_replationship_id:integer + +organization_status:string +user_organization_replationship_id:integer + + +conference title:string slug:string start_date:datetime end_date:datetime info:text poster:string banner:string workshop_schedule_published:boolean registration_open:boolean meals_provided:boolean meal_info:text travel_info:text conference_type:conference_type_id + +conference_hosts_organizations conference_id:integer organization_id:integer + + - host_organizations : NtoN[organization] + - locations : *NtoN[location] + - registration_form_fields : *NtoN[registration_form_field] + - workshop_resources : *NtoN[workshop_resource] + +registration_form_field + - title : string + - help : text + - required : boolean + - field_type : list(string) + - options : string + - retired : boolean diff --git a/Gemfile b/Gemfile index fbe480c..93e91ed 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,10 @@ -source 'https://rubygems.org' +source 'http://rubygems.org' ruby '2.0.0' gem 'rails', '4.0.0' +#gem 'nokogiri', :git => '/nokogiri/' + # Servers # gem 'puma' # gem 'unicorn' @@ -29,6 +31,7 @@ gem 'pg' gem 'haml' # gem 'http_accept_language' gem 'jquery-rails' +gem 'jquery-ui-rails' # gem 'resque', require: 'resque/server' # Resque web interface # Assets @@ -36,14 +39,32 @@ gem 'coffee-rails', '~> 4.0.0' gem 'haml_assets' gem 'handlebars_assets' gem 'i18n-js' +gem 'i18n-active_record', + :git => 'git://github.com/svenfuchs/i18n-active_record.git', + :require => 'i18n/active_record' gem 'jquery-turbolinks' gem 'sass-rails', '~> 4.0.0' -gem 'therubyracer' -gem 'compass-rails', '~> 2.0.alpha.0' -gem 'zurb-foundation' +gem "compass-rails", "~> 1.1.3" +gem 'foundation-rails' gem 'turbolinks' gem 'uglifier', '>= 1.3.0' -#gem 'rails_12factor', group: :production +gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git' +gem 'sorcery', '>= 0.8.1' +gem 'oauth2', '~> 0.8.0' +gem 'ruby-drupal-hash' +gem 'redis' +gem 'carrierwave' +gem 'carrierwave-imageoptimizer' +gem 'mini_magick' +gem 'carmen-rails', '~> 1.0.0', github: 'jim/carmen-rails' +gem 'nested_form' +gem 'acts_as_list' +#gem 'jcrop-rails' +#gem 'rmagick' + +gem 'geocoder' +gem 'forgery' +gem 'paper_trail' group :development, :test do gem 'debugger' @@ -55,10 +76,13 @@ group :development, :test do end group :development do + #gem 'perftools.rb' gem 'bullet' gem 'better_errors' gem 'binding_of_caller' gem 'meta_request' + gem 'haml-rails' + gem 'awesome_print' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index b7d31a8..d279b3c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,26 @@ +GIT + remote: git://github.com/jim/carmen-rails.git + revision: 076dd251e075d07408e0b5268f886956ef2a347c + specs: + carmen-rails (1.0.0) + carmen (~> 1.0.0) + rails + +GIT + remote: git://github.com/svenfuchs/i18n-active_record.git + revision: 55507cf59f8f2173d38e07e18df0e90d25b1f0f6 + specs: + i18n-active_record (0.0.2) + i18n (>= 0.5.0) + +GIT + remote: https://github.com/codahale/bcrypt-ruby.git + revision: df09e4c73f2f3d9a134b2abf536ca5f159f33075 + specs: + bcrypt-ruby (3.1.2) + GEM - remote: https://rubygems.org/ + remote: http://rubygems.org/ specs: actionmailer (4.0.0) actionpack (= 4.0.0) @@ -25,98 +46,133 @@ GEM multi_json (~> 1.3) thread_safe (~> 0.1) tzinfo (~> 0.3.37) + acts_as_list (0.4.0) + activerecord (>= 3.0) addressable (2.3.5) - arel (4.0.0) + arel (4.0.2) atomic (1.1.14) - better_errors (1.0.1) + awesome_print (1.2.0) + better_errors (1.1.0) coderay (>= 1.0.0) erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.1.4) - bullet (4.6.0) - uniform_notifier + bullet (4.8.0) + activesupport + uniform_notifier (>= 1.4.0) callsite (0.0.11) - capybara (2.1.0) + capybara (2.2.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - childprocess (0.3.9) + carmen (1.0.0) + unicode_utils (~> 1.4.0) + carrierwave (0.9.0) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + json (>= 1.7) + carrierwave-imageoptimizer (1.2.1) + carrierwave (~> 0.8) + image_optimizer (~> 1.2) + childprocess (0.5.1) ffi (~> 1.0, >= 1.0.11) chronic (0.10.2) - chunky_png (1.2.8) - coderay (1.0.9) + chunky_png (1.3.0) + coderay (1.1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.3) + coffee-script-source (1.7.0) columnize (0.3.6) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) - compass-rails (2.0.alpha.0) - compass (>= 0.12.2, < 0.14) + compass-rails (1.1.3) + compass (>= 0.12.2) coveralls (0.7.0) multi_json (~> 1.3) rest-client simplecov (>= 0.7) term-ansicolor thor - crack (0.4.1) - safe_yaml (~> 0.9.0) + crack (0.4.2) + safe_yaml (~> 1.0.0) daemons (1.1.9) database_cleaner (1.2.0) debug_inspector (0.0.2) - debugger (1.6.2) + debugger (1.6.5) columnize (>= 0.3.1) debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.2.3) + debugger-ruby_core_source (~> 1.3.1) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.2.3) + debugger-ruby_core_source (1.3.1) delorean (2.1.0) chronic - diff-lcs (1.2.4) + diff-lcs (1.2.5) + docile (1.1.3) email_spec (1.5.0) launchy (~> 2.1) mail (~> 2.2) erubis (2.7.0) + eventmachine (1.0.3) eventmachine (1.0.3-x86-mingw32) execjs (2.0.2) - factory_girl (4.2.0) + factory_girl (4.4.0) activesupport (>= 3.0.0) - factory_girl_rails (4.2.1) - factory_girl (~> 4.2.0) + factory_girl_rails (4.4.0) + factory_girl (~> 4.4.0) railties (>= 3.0.0) faker (1.2.0) i18n (~> 0.5) - ffi (1.9.0-x86-mingw32) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) + ffi (1.9.3-x86-mingw32) + forgery (0.5.0) + foundation-rails (5.1.1.0) + railties (>= 3.1.0) + sass (>= 3.2.0) fssm (0.2.10) - haml (4.0.3) + geocoder (1.1.9) + haml (4.0.5) tilt + haml-rails (0.5.1) + actionpack (~> 4.0.0) + activesupport (~> 4.0.0) + haml (>= 3.1, < 5.0) + railties (~> 4.0.0) haml_assets (0.2.2) haml tilt - handlebars_assets (0.14.1) + handlebars_assets (0.15) execjs (>= 1.2.9) + multi_json sprockets (>= 2.0.3) tilt hike (1.2.3) - i18n (0.6.5) + httpauth (0.2.1) + i18n (0.6.9) i18n-js (2.1.2) i18n - jquery-rails (3.0.4) + image_optimizer (1.2.1) + jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - jquery-turbolinks (2.0.1) + jquery-turbolinks (2.0.2) railties (>= 3.1.0) turbolinks - launchy (2.3.0) + jquery-ui-rails (4.2.0) + railties (>= 3.2.16) + json (1.8.1) + jwt (0.1.11) + multi_json (>= 1.5) + launchy (2.4.2) addressable (~> 2.3) mail (2.5.4) mime-types (~> 1.16) @@ -126,16 +182,36 @@ GEM rack-contrib railties method_source (0.8.2) - mime-types (1.25) - mini_portile (0.5.1) + mime-types (1.25.1) + mini_magick (3.7.0) + subexec (~> 0.2.1) + mini_portile (0.5.2) minitest (4.7.5) - multi_json (1.8.2) - nokogiri (1.6.0-x86-mingw32) + multi_json (1.8.4) + multipart-post (2.0.0) + nested_form (0.3.2) + nokogiri (1.6.1) + mini_portile (~> 0.5.0) + nokogiri (1.6.1-x86-mingw32) mini_portile (~> 0.5.0) - pg (0.17.0-x86-mingw32) + oauth (0.4.7) + oauth2 (0.8.1) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) + paper_trail (3.0.0) + activerecord (>= 3.0, < 5.0) + activesupport (>= 3.0, < 5.0) + pg (0.17.1-x86-mingw32) polyglot (0.3.3) - pry (0.9.12.2-x86-mingw32) - coderay (~> 1.0.5) + pry (0.9.12.6) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + pry (0.9.12.6-x86-mingw32) + coderay (~> 1.0) method_source (~> 0.8) slop (~> 3.4) win32console (~> 1.3) @@ -157,50 +233,57 @@ GEM rails_12factor (0.0.2) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.1) + rails_serve_static_assets (0.0.2) rails_stdout_logging (0.0.3) railties (4.0.0) actionpack (= 4.0.0) activesupport (= 4.0.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.1.0) - ref (1.0.5) + rake (10.1.1) + redis (3.0.7) rest-client (1.6.7) mime-types (>= 1.16) rspec (2.14.1) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - rspec-core (2.14.6) - rspec-expectations (2.14.3) + rspec-core (2.14.7) + rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.4) - rspec-rails (2.14.0) + rspec-mocks (2.14.5) + rspec-rails (2.14.1) actionpack (>= 3.0) + activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - rubyzip (1.0.0) - safe_yaml (0.9.7) - sass (3.2.12) + ruby-drupal-hash (0.0.3) + rubyzip (1.1.0) + safe_yaml (1.0.1) + sass (3.2.14) sass-rails (4.0.1) railties (>= 4.0.0, < 5.0) sass (>= 3.1.10) sprockets-rails (~> 2.0.0) - selenium-webdriver (2.37.0) + selenium-webdriver (2.39.0) childprocess (>= 0.2.5) multi_json (~> 1.0) - rubyzip (~> 1.0.0) + rubyzip (~> 1.0) websocket (~> 1.0.4) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - slop (3.4.6) - sprockets (2.10.0) + simplecov (0.8.2) + docile (~> 1.1.0) + multi_json + simplecov-html (~> 0.8.0) + simplecov-html (0.8.0) + slop (3.4.7) + sorcery (0.8.5) + bcrypt-ruby (>= 3.0) + oauth (~> 0.4.4) + oauth2 (>= 0.8.0, < 1.0.0) + sprockets (2.10.1) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -209,49 +292,53 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) - term-ansicolor (1.2.2) - tins (~> 0.8) - therubyracer (0.11.0beta1-x86-mingw32) - ref - thin (1.5.1) + subexec (0.2.3) + term-ansicolor (1.3.0) + tins (~> 1.0) + thin (1.6.1) daemons (>= 1.0.9) - eventmachine (>= 0.12.6) + eventmachine (>= 1.0.0) rack (>= 1.0.0) thor (0.18.1) thread_safe (0.1.3) atomic tilt (1.4.1) - tins (0.12.0) + tins (1.0.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - turbolinks (1.3.0) + turbolinks (2.2.1) coffee-rails tzinfo (0.3.38) - uglifier (2.2.1) + uglifier (2.4.0) execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) - uniform_notifier (1.3.0) - webmock (1.15.0) + json (>= 1.8.0) + unicode_utils (1.4.0) + uniform_notifier (1.4.0) + webmock (1.17.3) addressable (>= 2.2.7) crack (>= 0.3.2) websocket (1.0.7) win32console (1.3.2-x86-mingw32) xpath (2.0.0) nokogiri (~> 1.3) - zurb-foundation (4.3.2) - sass (>= 3.2.0) PLATFORMS x86-mingw32 DEPENDENCIES + acts_as_list + awesome_print + bcrypt-ruby! better_errors binding_of_caller bullet capybara + carmen-rails (~> 1.0.0)! + carrierwave + carrierwave-imageoptimizer coffee-rails (~> 4.0.0) - compass-rails (~> 2.0.alpha.0) + compass-rails (~> 1.1.3) coveralls database_cleaner debugger @@ -259,27 +346,38 @@ DEPENDENCIES email_spec factory_girl_rails faker + forgery + foundation-rails + geocoder haml + haml-rails haml_assets handlebars_assets + i18n-active_record! i18n-js jquery-rails jquery-turbolinks + jquery-ui-rails launchy meta_request + mini_magick + nested_form + oauth2 (~> 0.8.0) + paper_trail pg pry pry-rails rails (= 4.0.0) rails_12factor + redis rspec rspec-rails + ruby-drupal-hash sass-rails (~> 4.0.0) selenium-webdriver simplecov - therubyracer + sorcery (>= 0.8.1) thin turbolinks uglifier (>= 1.3.0) webmock - zurb-foundation diff --git a/README.md b/README.md index e30f24d..34c3168 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Starter App [![Build Status](https://travis-ci.org/diowa/ruby2-rails4-bootstrap-heroku.png?branch=master)](https://travis-ci.org/diowa/ruby2-rails4-bootstrap-heroku) [![Dependency Status](https://gemnasium.com/diowa/ruby2-rails4-bootstrap-heroku.png)](https://gemnasium.com/diowa/ruby2-rails4-bootstrap-heroku) [![Code Climate](https://codeclimate.com/github/diowa/ruby2-rails4-bootstrap-heroku.png)](https://codeclimate.com/github/diowa/ruby2-rails4-bootstrap-heroku) [![Coverage Status](https://coveralls.io/repos/diowa/ruby2-rails4-bootstrap-heroku/badge.png?branch=master)](https://coveralls.io/r/diowa/ruby2-rails4-bootstrap-heroku) +Bike!Bike! =========== This is a starter web application based on the following technology stack: diff --git a/Rakefile b/Rakefile index 20cb543..09d13cd 100644 --- a/Rakefile +++ b/Rakefile @@ -3,4 +3,4 @@ require File.expand_path('../config/application', __FILE__) -Starterapp::Application.load_tasks +BikeBike::Application.load_tasks diff --git a/app/assets/fonts/README.md b/app/assets/fonts/README.md new file mode 100644 index 0000000..17158a3 --- /dev/null +++ b/app/assets/fonts/README.md @@ -0,0 +1,10 @@ +Bike!Bike! Icon Font +=========== + +To add to the icon font: + +* Go to icomoon.io/app/ +* Import the .svg in this folder +* Add you own svg icons +* Genreate and download the font +* Unzip and overwrite the contents into this directory diff --git a/app/assets/fonts/glyphs/noun_project_592.svg b/app/assets/fonts/glyphs/noun_project_592.svg new file mode 100644 index 0000000..761e71f --- /dev/null +++ b/app/assets/fonts/glyphs/noun_project_592.svg @@ -0,0 +1,29 @@ + + + + + + diff --git a/app/assets/images/Columbus-ohio-skyline-panorama.jpg b/app/assets/images/Columbus-ohio-skyline-panorama.jpg new file mode 100644 index 0000000..5e4fb2a Binary files /dev/null and b/app/assets/images/Columbus-ohio-skyline-panorama.jpg differ diff --git a/app/assets/images/Nola2013Banner-2.jpg b/app/assets/images/Nola2013Banner-2.jpg new file mode 100644 index 0000000..dd7e277 Binary files /dev/null and b/app/assets/images/Nola2013Banner-2.jpg differ diff --git a/app/assets/images/Nola2013Banner.jpg b/app/assets/images/Nola2013Banner.jpg new file mode 100644 index 0000000..f0b27d8 Binary files /dev/null and b/app/assets/images/Nola2013Banner.jpg differ diff --git a/app/assets/images/Thumbs.db b/app/assets/images/Thumbs.db new file mode 100644 index 0000000..a7df432 Binary files /dev/null and b/app/assets/images/Thumbs.db differ diff --git a/app/assets/images/columbus.jpg b/app/assets/images/columbus.jpg new file mode 100644 index 0000000..5e4fb2a Binary files /dev/null and b/app/assets/images/columbus.jpg differ diff --git a/app/assets/images/columbus.png b/app/assets/images/columbus.png new file mode 100644 index 0000000..38147b7 Binary files /dev/null and b/app/assets/images/columbus.png differ diff --git a/app/assets/images/icon_24074.png b/app/assets/images/icon_24074.png new file mode 100644 index 0000000..59186c5 Binary files /dev/null and b/app/assets/images/icon_24074.png differ diff --git a/app/assets/images/poster.jpg b/app/assets/images/poster.jpg new file mode 100644 index 0000000..e141f13 Binary files /dev/null and b/app/assets/images/poster.jpg differ diff --git a/app/assets/images/t-dot.jpg b/app/assets/images/t-dot.jpg new file mode 100644 index 0000000..2bc7949 Binary files /dev/null and b/app/assets/images/t-dot.jpg differ diff --git a/app/assets/images/translate_cursor-24.png b/app/assets/images/translate_cursor-24.png new file mode 100644 index 0000000..8244867 Binary files /dev/null and b/app/assets/images/translate_cursor-24.png differ diff --git a/app/assets/images/translate_cursor-32.png b/app/assets/images/translate_cursor-32.png new file mode 100644 index 0000000..e9d4760 Binary files /dev/null and b/app/assets/images/translate_cursor-32.png differ diff --git a/app/assets/images/translate_cursor.png b/app/assets/images/translate_cursor.png new file mode 100644 index 0000000..5e9efd2 Binary files /dev/null and b/app/assets/images/translate_cursor.png differ diff --git a/app/assets/images/vancity.jpg b/app/assets/images/vancity.jpg new file mode 100644 index 0000000..2121ffc Binary files /dev/null and b/app/assets/images/vancity.jpg differ diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee new file mode 100644 index 0000000..2d90f26 --- /dev/null +++ b/app/assets/javascripts/application.js.coffee @@ -0,0 +1,175 @@ +#= require jquery +#= require jquery_ujs +#= require jquery.ui.sortable +#= require jquery.turbolinks +#= require turbolinks +#= require foundation + +# FRONT END + +# JS HANDLEBARS TEMPLATES +# require handlebars.runtime +# require jquery_nested_form + +# I18n +#= require i18n +#= require i18n/translations + +# ALL THE REST +#= require_tree . + +'use strict' + +I18n.defaultLocale = '<%= I18n.default_locale %>' +I18n.locale = $('html').attr 'lang' + +try Typekit.load() catch + +startSpinner = -> + $('#loading-spinner').show() + +stopSpinner = -> + $('#loading-spinner').fadeOut() + +# Turbolinks Spinner +document.addEventListener 'page:fetch', startSpinner +document.addEventListener 'page:receive', stopSpinner + +readURL = (input) -> + reader = null + if input.files && input.files[0] + reader = new FileReader() + reader.readAsDataURL input.files[0] + reader.onload = (e) -> + $(input).prev().attr('src', e.target.result) + +createOverlay = () -> + if $('#overlay').length > 0 + $('#overlay').remove() + $('body').append('
') + $('#overlay-dlg') + +setOverlayHTML = (html) -> + $('#overlay-inner').append('
' + html + '
'); + $('#overlay').removeAttr('class').click(destroyOverlay) + +destroyOverlay = () -> + $('#overlay').remove() + +selectA = (type, event, $emptyObj) -> + event.preventDefault() + # = $(this) + $overlay = createOverlay() + objs = [] + $('.' + type + '-select-field.added input.' + type + '-id').each () -> obj.push($(this).val()) + $.post $emptyObj.data().url + (if type == 'organization' then '/nonhosts' else '/nonmembers'), {added: objs}, + (html) -> + setOverlayHTML(html).addClass('' + type + '-select') + $('#select-' + type + '-list a').click (event) -> + event.preventDefault() + + $this = $(this) + $old_field = $emptyObj.closest('.field') + $field = $old_field.clone() + + oldID = parseInt($old_field.find('input[type="hidden"]').attr('name').match(/\[(\d+)\]\[id\]/)[1]) + newID = oldID + 1 + + $field.find('input.' + type + '-id').val($this.data().id) + $field.find('.' + type + 'name').html($this.find('.' + type + 'name').html()).before('') + $field.find('.select-' + type + '').remove() + $field.removeClass('new').addClass('added') + $old_field.html (i, html) -> + pregex = new RegExp('\\[' + oldID + '\\]', 'g'); + aregex = new RegExp('_' + oldID + '_', 'g'); + html.replace(pregex, '[' + newID + ']').replace(aregex, '_' + newID + '_') + $field.insertBefore($old_field) + $('a.select-' + type + '').click (event) -> selectA(type, event, $(this)) + + destroyOverlay() + return + , 'html' + +updateFormField = () -> + $form = $('form#new_registration_form_field') + $field_type = $form.find('#registration_form_field_field_type') + field_type = $field_type.val() + $form.find('.registration-form-field-field').hide() + $form.find('.registration-form-field-field.field-type-' + field_type).show() + +updateFormFieldForm = () -> + $('form #registration_form_field_field_type').change updateFormField + updateFormField() + $('form#new_registration_form_field').submit (event) -> + event.preventDefault() + $form = $(this) + serialized = $form.serialize() + $.post $form.attr('action'), serialized, + (json) -> + $form.replaceWith(json.form) + $('#registration-form-field-list').html(json.list) + updateFormFieldForm() + , 'json' +updateFormFieldList = () -> + $('#registration-form-field-list .add-form-field').click () -> + $.post 'form/add-field', {field: $(this).data().id}, + (json) -> + $('#conference-form').html(json.form) + $('#registration-form-field-list').html(json.list) + #console.log json + updateFormFieldList() + return + $('#conference-form .remove-form-field').click () -> + $.post 'form/remove-field', {field: $(this).data().id}, + (json) -> + $('#conference-form').html(json.form) + $('#registration-form-field-list').html(json.list) + updateFormFieldList() + return + +$ -> + $(document).foundation(); + $('.field.country-select select').change () -> + $country = $(this) + country = $country.val() + $territory = $('.field.subregion-select select') + if $territory.data().country == country + $territory.removeClass('can cant').addClass('can') + return + + $.post '/location/territories', {country: country}, + (json) -> + $territory.html('') + if json && Object.keys(json).length + $.each json, (code, name) -> + $territory.append($('