Permalink
Browse files

First commit of Rethinking World Heritage Sites

  • Loading branch information...
0 parents commit ec3508085131c05c816ba9ef658ea0c02fa4cfd7 @Ferdev Ferdev committed Aug 11, 2011
Showing with 15,679 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +1 −0 .rspec
  3. +11 −0 Gemfile
  4. +219 −0 Gemfile.lock
  5. +30 −0 README.markdown
  6. +7 −0 Rakefile
  7. +3 −0 app/controllers/admin/admin_controller.rb
  8. +8 −0 app/controllers/admin/dashboard_controller.rb
  9. +14 −0 app/controllers/admin/features_controller.rb
  10. +14 −0 app/controllers/admin/pages_controller.rb
  11. +14 −0 app/controllers/admin/settings_controller.rb
  12. +19 −0 app/controllers/application_controller.rb
  13. +15 −0 app/controllers/features_controller.rb
  14. +7 −0 app/controllers/home_controller.rb
  15. +3 −0 app/controllers/prototypes_controller.rb
  16. +31 −0 app/controllers/sessions_controller.rb
  17. +52 −0 app/controllers/setup_controller.rb
  18. +24 −0 app/helpers/admin/admin_helper.rb
  19. +11 −0 app/helpers/application_helper.rb
  20. +2 −0 app/helpers/features_helper.rb
  21. +2 −0 app/helpers/prototypes_helper.rb
  22. +2 −0 app/helpers/sessions_helper.rb
  23. +7 −0 app/models/feature.rb
  24. +127 −0 app/views/admin/dashboard/index.html.erb
  25. +31 −0 app/views/admin/features/new.html.erb
  26. +43 −0 app/views/admin/features/show.html.erb
  27. +38 −0 app/views/admin/pages/show.html.erb
  28. +3 −0 app/views/admin/shared/_footer.html.erb
  29. +13 −0 app/views/admin/shared/_header.html.erb
  30. +20 −0 app/views/features/index.html.erb
  31. +11 −0 app/views/features/show.html.erb
  32. +6 −0 app/views/home/index.html.erb
  33. +17 −0 app/views/layouts/admin.html.erb
  34. +25 −0 app/views/layouts/application.html.erb
  35. +16 −0 app/views/layouts/setup.html.erb
  36. +33 −0 app/views/prototypes/prueba.html.erb
  37. +3 −0 app/views/sessions/new.html.erb
  38. +1 −0 app/views/setup/_help.html.erb
  39. +14 −0 app/views/setup/_step_indicator.erb
  40. +22 −0 app/views/setup/features_table_data.html.erb
  41. +10 −0 app/views/setup/step0.html.erb
  42. +86 −0 app/views/setup/step1.html.erb
  43. +19 −0 app/views/setup/step2.html.erb
  44. +43 −0 app/views/setup/step3.html.erb
  45. +31 −0 app/views/setup/step4.html.erb
  46. +4 −0 config.ru
  47. +50 −0 config/application.rb
  48. +6 −0 config/boot.rb
  49. +5 −0 config/environment.rb
  50. +26 −0 config/environments/development.rb
  51. +49 −0 config/environments/production.rb
  52. +35 −0 config/environments/test.rb
  53. +7 −0 config/initializers/backtrace_silencers.rb
  54. +6 −0 config/initializers/cartoset_config.rb
  55. +1 −0 config/initializers/extra_cartoset_libs.rb
  56. +13 −0 config/initializers/float.rb
  57. +10 −0 config/initializers/inflections.rb
  58. +5 −0 config/initializers/mime_types.rb
  59. +7 −0 config/initializers/secret_token.rb
  60. +8 −0 config/initializers/session_store.rb
  61. +96 −0 config/initializers/string.rb
  62. +81 −0 config/locales/en.yml
  63. +27 −0 config/routes.rb
  64. +2 −0 doc/README_FOR_APP
  65. +86 −0 lib/cartoset/config.rb
  66. +5 −0 lib/cartoset/constants.rb
  67. +18 −0 lib/cartoset/features_data_importer.rb
  68. +9 −0 lib/helpers/feature_getter_helper.rb
  69. 0 lib/tasks/.gitkeep
  70. +62 −0 lib/tasks/cartoset.rake
  71. +26 −0 public/404.html
  72. +26 −0 public/422.html
  73. +26 −0 public/500.html
  74. 0 public/favicon.ico
  75. BIN public/fonts/museosans_500-webfont.eot
  76. +247 −0 public/fonts/museosans_500-webfont.svg
  77. BIN public/fonts/museosans_500-webfont.ttf
  78. BIN public/fonts/museosans_500-webfont.woff
  79. BIN public/images/backgrounds/bottom_blue.png
  80. BIN public/images/backgrounds/bubble_bottom.png
  81. BIN public/images/backgrounds/bubble_top.png
  82. BIN public/images/backgrounds/mid_blue.png
  83. BIN public/images/backgrounds/top_blue.png
  84. BIN public/images/bg_content_box.png
  85. BIN public/images/bg_input.png
  86. BIN public/images/globe.png
  87. BIN public/images/next_steps_diagram.png
  88. BIN public/images/rails.png
  89. BIN public/images/select.png
  90. BIN public/images/sprites/admin.png
  91. BIN public/images/sprites/htmlArea.png
  92. BIN public/images/sprites/setup.png
  93. +55 −0 public/javascripts/admin/dashboard/index.js
  94. +47 −0 public/javascripts/admin/features/new.js
  95. +50 −0 public/javascripts/admin/pages/new.js
  96. +33 −0 public/javascripts/features/index.js
  97. +1,247 −0 public/javascripts/fileuploader.js
  98. +8 −0 public/javascripts/jHtmlArea-0.7.0.min.js
  99. +8,316 −0 public/javascripts/jquery.1.5.1.js
  100. +11 −0 public/javascripts/jquery.jscrollpane.min.js
  101. +78 −0 public/javascripts/jquery.mousewheel.js
  102. +11 −0 public/javascripts/jquery.scrollTo-1.4.2.js
  103. +51 −0 public/javascripts/prettyfile.js
  104. +191 −0 public/javascripts/rails.js
  105. +15 −0 public/javascripts/setup/step1.js
  106. +15 −0 public/javascripts/setup/step2.js
  107. +91 −0 public/javascripts/setup/step3.js
  108. +6 −0 public/javascripts/utils.js
  109. +60 −0 public/new_pages.html
  110. +5 −0 public/robots.txt
  111. +5 −0 public/stylesheets/admin.colors.css
  112. +355 −0 public/stylesheets/admin.css
  113. 0 public/stylesheets/admin.vars.css
  114. 0 public/stylesheets/admin/admin.colors.css
  115. 0 public/stylesheets/admin/admin.vars.css
  116. +237 −0 public/stylesheets/admin/dashboard/index.css
  117. +5 −0 public/stylesheets/admin/features/index.css
  118. 0 public/stylesheets/admin/mixins.css
  119. +58 −0 public/stylesheets/admin/pages/htmlArea.css
  120. 0 public/stylesheets/admin/pages/index.css
  121. +168 −0 public/stylesheets/admin/pages/new.css
  122. 0 public/stylesheets/admin_colors.css
  123. +14 −0 public/stylesheets/application.css
  124. +5 −0 public/stylesheets/features/index.css
  125. +83 −0 public/stylesheets/jscrollpane.css
  126. +6 −0 public/stylesheets/main.fonts.css
  127. 0 public/stylesheets/main.mixins.css
  128. 0 public/stylesheets/main.vars.css
  129. 0 public/stylesheets/main_vars.css
  130. 0 public/stylesheets/mixins.css3.css
  131. +44 −0 public/stylesheets/reset.css
  132. +45 −0 public/stylesheets/sass/admin.colors.scss
  133. +427 −0 public/stylesheets/sass/admin.scss
  134. +1 −0 public/stylesheets/sass/admin.vars.scss
  135. +298 −0 public/stylesheets/sass/admin/dashboard/index.scss
  136. +4 −0 public/stylesheets/sass/admin/features/index.scss
  137. +3 −0 public/stylesheets/sass/admin/mixins.scss
  138. +13 −0 public/stylesheets/sass/admin/pages/htmlArea.scss
  139. +204 −0 public/stylesheets/sass/admin/pages/new.scss
  140. +20 −0 public/stylesheets/sass/application.scss
  141. +6 −0 public/stylesheets/sass/features/index.scss
  142. +118 −0 public/stylesheets/sass/jscrollpane.scss
  143. +10 −0 public/stylesheets/sass/main.fonts.scss
  144. +7 −0 public/stylesheets/sass/main.mixins.scss
  145. +1 −0 public/stylesheets/sass/main.vars.scss
  146. +24 −0 public/stylesheets/sass/mixins.css3.scss
  147. +138 −0 public/stylesheets/sass/setup/index.scss
  148. +32 −0 public/stylesheets/sass/setup/setup.colors.scss
  149. 0 public/stylesheets/sass/setup/setup.vars.scss
  150. +21 −0 public/stylesheets/sass/setup/step0.scss
  151. +139 −0 public/stylesheets/sass/setup/step1.scss
  152. +38 −0 public/stylesheets/sass/setup/step2.scss
  153. +185 −0 public/stylesheets/sass/setup/step3.scss
  154. +48 −0 public/stylesheets/sass/setup/step4.scss
  155. +148 −0 public/stylesheets/setup/index.css
  156. 0 public/stylesheets/setup/mixins.css
  157. +50 −0 public/stylesheets/setup/new_features_table.css
  158. 0 public/stylesheets/setup/register.colors.css
  159. 0 public/stylesheets/setup/register.vars.css
  160. 0 public/stylesheets/setup/setup.colors.css
  161. 0 public/stylesheets/setup/setup.vars.css
  162. +13 −0 public/stylesheets/setup/step0.css
  163. +83 −0 public/stylesheets/setup/step1.css
  164. +28 −0 public/stylesheets/setup/step2.css
  165. +191 −0 public/stylesheets/setup/step3.css
  166. +47 −0 public/stylesheets/setup/step4.css
  167. +6 −0 script/rails
  168. 0 vendor/plugins/.gitkeep
10 .gitignore
@@ -0,0 +1,10 @@
+.bundle
+.rvmrc
+db/*.sqlite3
+log/*.log
+tmp/
+
+config/cartodb_config.yml
+config/cartoset_config.yml
+
+bin/
1 .rspec
@@ -0,0 +1 @@
+--colour -d
11 Gemfile
@@ -0,0 +1,11 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.5'
+
+gem 'cartodb-rb-client', :git => 'git@github.com:Vizzuality/cartodb-rb-client.git'
+
+gem 'sass'
+
+group :development, :test do
+ gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
+end
219 Gemfile.lock
@@ -0,0 +1,219 @@
+GIT
+ remote: git@github.com:Vizzuality/cartodb-rb-client.git
+ revision: df666326f57094cacf56ee794b09f409cb27a2af
+ specs:
+ cartodb-rb-client (0.0.1)
+ activesupport (= 3.0.5)
+ i18n (= 0.5.0)
+ json (= 1.5.1)
+ mime-types (= 1.16)
+ omniauth (= 0.1.6)
+ pg (= 0.11.0)
+ rails_warden (= 0.5.2)
+ rgeo (= 0.2.7)
+ rgeo-geojson (= 0.2.0)
+ typhoeus (= 0.2.4)
+ warden (= 1.0.3)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.5)
+ actionpack (= 3.0.5)
+ mail (~> 2.2.15)
+ actionpack (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.5)
+ activesupport (= 3.0.5)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ activesupport (3.0.5)
+ addressable (2.2.6)
+ archive-tar-minitar (0.5.2)
+ arel (2.0.9)
+ builder (2.1.2)
+ capybara (0.4.1.2)
+ celerity (>= 0.7.9)
+ culerity (>= 0.2.4)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (>= 0.0.27)
+ xpath (~> 0.1.3)
+ celerity (0.8.9)
+ childprocess (0.1.8)
+ ffi (~> 1.0.6)
+ columnize (0.3.2)
+ configuration (1.2.0)
+ culerity (0.2.15)
+ diff-lcs (1.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ faraday (0.5.7)
+ addressable (~> 2.2.4)
+ multipart-post (~> 1.1.0)
+ rack (< 2, >= 1.1.0)
+ ffi (1.0.7)
+ rake (>= 0.8.7)
+ i18n (0.5.0)
+ json (1.5.1)
+ json_pure (1.5.1)
+ launchy (0.4.0)
+ configuration (>= 0.0.5)
+ rake (>= 0.8.1)
+ linecache19 (0.5.11)
+ ruby_core_source (>= 0.1.4)
+ mail (2.2.15)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (0.0.5)
+ multipart-post (1.1.3)
+ net-ldap (0.1.1)
+ nokogiri (1.4.7)
+ oa-basic (0.1.6)
+ multi_json (~> 0.0.2)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.1.6)
+ rest-client (~> 1.6.0)
+ oa-core (0.1.6)
+ rack (~> 1.1)
+ oa-enterprise (0.1.6)
+ net-ldap (~> 0.1.1)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.1.6)
+ pyu-ruby-sasl (~> 0.0.3.1)
+ rubyntlm (~> 0.1.1)
+ oa-oauth (0.1.6)
+ multi_json (~> 0.0.2)
+ nokogiri (~> 1.4.2)
+ oa-core (= 0.1.6)
+ oauth (~> 0.4.0)
+ oauth2 (~> 0.1.0)
+ oa-openid (0.1.6)
+ oa-core (= 0.1.6)
+ rack-openid (~> 1.2.0)
+ ruby-openid-apps-discovery
+ oauth (0.4.5)
+ oauth2 (0.1.1)
+ faraday (~> 0.5.0)
+ multi_json (~> 0.0.4)
+ omniauth (0.1.6)
+ oa-basic (= 0.1.6)
+ oa-core (= 0.1.6)
+ oa-enterprise (= 0.1.6)
+ oa-oauth (= 0.1.6)
+ oa-openid (= 0.1.6)
+ pg (0.11.0)
+ polyglot (0.3.1)
+ pyu-ruby-sasl (0.0.3.3)
+ rack (1.2.3)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-openid (1.2.0)
+ rack (>= 1.1.0)
+ ruby-openid (>= 2.1.8)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.5)
+ actionmailer (= 3.0.5)
+ actionpack (= 3.0.5)
+ activerecord (= 3.0.5)
+ activeresource (= 3.0.5)
+ activesupport (= 3.0.5)
+ bundler (~> 1.0)
+ railties (= 3.0.5)
+ rails_warden (0.5.2)
+ warden
+ railties (3.0.5)
+ actionpack (= 3.0.5)
+ activesupport (= 3.0.5)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rest-client (1.6.3)
+ mime-types (>= 1.16)
+ rgeo (0.2.7)
+ rgeo-geojson (0.2.0)
+ rgeo (>= 0.2.0)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.1)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ rspec-rails (2.5.0)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.5.0)
+ ruby-debug-base19 (0.11.24)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby-openid (2.1.8)
+ ruby-openid-apps-discovery (1.2.0)
+ ruby-openid (>= 2.1.7)
+ ruby_core_source (0.1.4)
+ archive-tar-minitar (>= 0.5.2)
+ rubyntlm (0.1.1)
+ rubyzip (0.9.4)
+ sass (3.1.0.alpha.252)
+ selenium-webdriver (0.1.4)
+ childprocess (>= 0.1.7)
+ ffi (>= 1.0.7)
+ json_pure
+ rubyzip
+ steak (1.1.0)
+ rspec (>= 1.3)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ typhoeus (0.2.4)
+ mime-types
+ mime-types
+ tzinfo (0.3.25)
+ warden (1.0.3)
+ rack (>= 1.0.0)
+ xpath (0.1.3)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ capybara
+ cartodb-rb-client!
+ launchy
+ rails (= 3.0.5)
+ rspec
+ rspec-rails
+ ruby-debug19
+ sass
+ steak
30 README.markdown
@@ -0,0 +1,30 @@
+CARTOSET
+========
+
+Requirements.
+-------------
+
+The only requirement you will need in order to run a Cartoset based project is a valid Ruby interpreter (versions 1.8.7 and 1.9.2 supported). That's all!
+
+Setting up a new Cartoset based project.
+----------------------------------------
+
+1. First of all, download the source code clicking in the 'Downloads' button, in the Cartoset [github's repository](https://github.com/vizzuality/cartoset).
+
+2. Unzip the downloaded file into your desired folder, and then open a new terminal session.
+
+3. Install the [bundler](http://gembundler.com/) gem.
+
+4. Install gem's bundle:
+
+ bundle install
+
+5. Start a new server session:
+
+ rails start
+
+6. Go to http://localhost:3000. It will redirect you to the setup wizard.
+
+7. Go through the setup wizard and when you finish it, you will have your cartoset project configured!
+
+8. Customize your cartoset project, adding some css styles and givint it some love!
7 Rakefile
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Cartoset::Application.load_tasks
3 app/controllers/admin/admin_controller.rb
@@ -0,0 +1,3 @@
+class Admin::AdminController < ApplicationController
+ layout 'admin'
+end
8 app/controllers/admin/dashboard_controller.rb
@@ -0,0 +1,8 @@
+class Admin::DashboardController < Admin::AdminController
+
+ def index
+ @features_columns = Feature.data_columns
+ @features = Feature.all
+ end
+
+end
14 app/controllers/admin/features_controller.rb
@@ -0,0 +1,14 @@
+class Admin::FeaturesController < Admin::AdminController
+ include FeatureGetterHelper
+
+ before_filter :get_feature, :only => [:show]
+
+ def show
+
+ end
+
+ def new
+ @features_fields = Feature.non_common_fields
+ end
+
+end
14 app/controllers/admin/pages_controller.rb
@@ -0,0 +1,14 @@
+class Admin::PagesController < Admin::AdminController
+ before_filter :get_page, :only => [:show]
+
+ def show
+
+ end
+
+ def get_page
+ #results = CARTODB.query("SELECT * FROM features WHERE cartodb_id = #{params[:id]}") if params[:id]
+ #@feature = results.rows.first if results && results.rows.present?
+ end
+ private :get_page
+
+end
14 app/controllers/admin/settings_controller.rb
@@ -0,0 +1,14 @@
+class Admin::SettingsController < Admin::AdminController
+ before_filter :get_setting, :only => [:show]
+
+ def show
+
+ end
+
+ def get_setting
+ #results = CARTODB.query("SELECT * FROM features WHERE cartodb_id = #{params[:id]}") if params[:id]
+ #@feature = results.rows.first if results && results.rows.present?
+ end
+ private :get_setting
+
+end
19 app/controllers/application_controller.rb
@@ -0,0 +1,19 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ before_filter :show_setup_wizard_if_uninstalled
+
+ def features_table_name
+ Cartoset::Config['features_table'] || ''
+ end
+
+ def show_setup_wizard_if_uninstalled
+ redirect_to setup_path unless application_installed?
+ end
+ private :show_setup_wizard_if_uninstalled
+
+ def application_installed?
+ Cartoset::Config.valid?
+ end
+ private :application_installed?
+end
15 app/controllers/features_controller.rb
@@ -0,0 +1,15 @@
+class FeaturesController < ApplicationController
+ include FeatureGetterHelper
+
+ before_filter :get_feature, :only => [:show]
+
+ def index
+ table = CartoDB::Connection.query "SELECT * FROM #{features_table_name}", :page => 1, :rows_per_page => 20
+ @features = table.rows || []
+ end
+
+ def show
+
+ end
+
+end
7 app/controllers/home_controller.rb
@@ -0,0 +1,7 @@
+class HomeController < ApplicationController
+
+ def index
+
+ end
+
+end
3 app/controllers/prototypes_controller.rb
@@ -0,0 +1,3 @@
+class PrototypesController < ApplicationController
+ layout 'admin'
+end
31 app/controllers/sessions_controller.rb
@@ -0,0 +1,31 @@
+class SessionsController < ApplicationController
+
+ skip_before_filter :show_setup_wizard_if_uninstalled, :only => :create
+
+ def new
+ if logged_in?
+ redirect_to features_path and return
+ end
+ end
+
+ def create
+ env['warden'].authenticate(:cartodb_oauth)
+ redirect_to session[:return_to]
+ rescue ActionController::ActionControllerError
+ redirect_to features_path
+ end
+
+ def destroy
+ logout
+ redirect_to root_path
+ end
+
+ def unauthenticated
+ respond_to do |format|
+ format.html do
+ render :action => 'new' and return
+ end
+ end
+ end
+
+end
52 app/controllers/setup_controller.rb
@@ -0,0 +1,52 @@
+class SetupController < ApplicationController
+ include FeatureGetterHelper
+
+ layout 'setup'
+
+ skip_before_filter :show_setup_wizard_if_uninstalled
+
+ def step
+ step_id = params[:step_id] || 0
+
+ case step_id
+ when "1"
+ session[:return_to] = setup_path(:step_id => 2)
+ when "2"
+ Cartoset::Config.update :cartodb_host => params[:oauth_host],
+ :cartodb_oauth_key => params[:oauth_key],
+ :cartodb_oauth_secret => params[:oauth_secret]
+
+ Cartoset::Config.setup_cartodb
+ when "3"
+ Cartoset::Config.update :app_name => params[:app_name]
+
+ result = CartoDB::Connection.tables || []
+ @tables = result.tables
+ when "4"
+ @table = CartoDB::Connection.table params[:features_table]
+ Cartoset::Config.update :features_table => @table.name
+ end
+
+ render "step#{step_id}"
+ end
+
+ def features_table_data
+ table_name = params[:table_name]
+ if table_name
+ @table = CartoDB::Connection.table table_name
+ records = CartoDB::Connection.records table_name, {}
+ @rows = records.rows if records
+ end
+ render :layout => false
+ end
+
+ def create_features_table
+ table = {}
+
+ if params[:qqfile] && request.body.present?
+ table = FeaturesDataImporter.start request.body
+ end
+
+ render :json => table.to_json
+ end
+end
24 app/helpers/admin/admin_helper.rb
@@ -0,0 +1,24 @@
+module Admin::AdminHelper
+ def build_field_for_column(column, value = nil)
+ case column[:type]
+ when 'boolean'
+ ul_content = ''
+ selected = "selected"
+ value = (value.blank?)? 'null' : value.to_s
+ puts value
+ ul_content << '<li><a class="radiobutton '+((value=="true")? selected:'')+'" href="#true">true</a></li>'
+ ul_content << '<li><a class="radiobutton '+((value=="false")? selected:'')+'" href="#false">false</a></li>'
+ ul_content << '<li><a class="radiobutton '+((value=="null")? selected:'')+'" href="#null">null</a></li>'
+ ul_content << radio_button_tag(column[:name], true, (value=="true"), :class=>"hidden")
+ ul_content << radio_button_tag(column[:name], false, (value=="false"), :class=>"hidden")
+ ul_content << radio_button_tag(column[:name], "null", (value=="null"), :class=>"hidden")
+ content_tag :ul, raw(ul_content)
+ when 'number'
+ number_field_tag column[:name], value, :id => column[:name], :class => column[:type]
+ when 'date'
+ text_field_tag(column[:name], value, :readonly => "readonly", :id => column[:name], :class => column[:type]) + content_tag(:div, date_select(column[:name], :name), :class => 'date show')
+ else
+ text_field_tag column[:name], value, :id => column[:name], :class => column[:type]
+ end
+ end
+end
11 app/helpers/application_helper.rb
@@ -0,0 +1,11 @@
+module ApplicationHelper
+ def paginate(rows, current_page, total_count, per_page = 10)
+
+ total_pages = (total_count.to_f / per_page.to_f).ceil
+ pages = (1..total_pages).to_a
+
+ content_tag :div, :class => 'pagination' do
+ raw pages.map{|page| link_to page, '#', :class => page == current_page ? 'current' : nil}.join(' ')
+ end
+ end
+end
2 app/helpers/features_helper.rb
@@ -0,0 +1,2 @@
+module FeaturesHelper
+end
2 app/helpers/prototypes_helper.rb
@@ -0,0 +1,2 @@
+module PrototypesHelper
+end
2 app/helpers/sessions_helper.rb
@@ -0,0 +1,2 @@
+module SessionsHelper
+end
7 app/models/feature.rb
@@ -0,0 +1,7 @@
+class Feature < CartoDB::Model::Base
+ cartodb_table_name Cartoset::Config['features_table']
+
+ def self.non_common_fields
+ columns.reject{|c| Cartoset::Constants::COMMON_FEATURES_FIELDS.include?(c[:name])}
+ end
+end
127 app/views/admin/dashboard/index.html.erb
@@ -0,0 +1,127 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js', 'jquery.scrollTo-1.4.2.js', 'admin/dashboard/index.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'admin/dashboard/index.css' %>
+<% end %>
+
+<div id="features_list" class="table">
+ <span class="title"><%= t('.your_features') %></span>
+ <div id="search">
+ <%= form_tag '/', :method => :get do %>
+ <%= label_tag 'search', t('.search_label') %>
+ <%= text_field_tag 'search' %>
+ <%= submit_tag t('.search') %>
+ <% end %>
+ <%= link_to content_tag(:span, t('.scroll_right')), '#', :id => 'scroll_right' %>
+ <%= link_to content_tag(:span, t('.scroll_left')), '#', :id => 'scroll_left' %>
+ </div>
+ <div id="features_table">
+ <table class="list">
+ <tr class="header">
+ <th><div class="id">id.</div></th>
+ <% @features_columns.each do |column| %>
+ <th><div class="<%= column[:type] %>"><%= column[:name] %></div></th>
+ <% end %>
+ </tr>
+ <% @features.each do |feature| %>
+ <tr class="item <%= cycle('odd', 'even') %>">
+ <td class="cartodb_id"><%= link_to feature.cartodb_id, admin_features_path(feature.cartodb_id) %></td>
+ <% @features_columns.each do |column| %>
+ <td class="<%= column.first %>"><%= feature.send(column[:name]).to_s.truncate(28) %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+ </div>
+ <%= link_to t('.create_feature'), new_admin_feature_path, :id => 'create_feature', :class => 'main_action' %>
+ <%= link_to t('.edit_in_cartodb'), '#', :id => 'edit_in_cartodb', :class => 'alternate_action' %>
+ <%= paginate @features, 1, @features.count %>
+</div>
+
+<div id="pages_list" class="table">
+ <span class="title">Your pages</span>
+ <div class="pages_list_container">
+ <ul>
+ <li>
+ <div>
+ <p>About your catoset</p>
+ <p class="link"><a href="#">edit this page</a></p>
+ </div>
+ </li>
+ <li>
+ <div>
+ <p>About your catoset</p>
+ <p class="link"><a href="#">edit this page</a></p>
+ </div>
+ </li>
+ <li>
+ <div>
+ <p>About your catoset</p>
+ <p class="link"><a href="#">edit this page</a></p>
+ </div>
+ </li>
+ <li>
+ <div>
+ <p>About your catoset</p>
+ <p class="link"><a href="#">edit this page</a></p>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div class="pages_footer">
+ <a href="#" class="main_action">Create new page</a>
+ </div>
+</div>
+
+<% if false %>
+<div id="settings_list" class="table">
+ <span class="title">Settings</span>
+ <div class="settings_list_container">
+ <ul>
+ <li class="odd" id="1">
+ <div class="name">
+ <p class="setting_name">services.google.tracking_id</p>
+ <p class="setting_description">Integration ID with Google Analytics</p>
+ </div>
+ <div class="setting_value"><a href="">UA-1234567-1</a></div>
+ <div class="edit_value">
+ <input type="text" value="UA-1234567-1"/>
+ <input type="hidden" value="UA-1234567-1"/>
+ <a href="" class="action_input">Save</a>
+ <span class="cancel_value">or <a href="">cancel</a></span>
+ </div>
+ </li>
+ <li class="even" id="2">
+ <div class="name">
+ <p class="setting_name">services.google.tracking_id</p>
+ <p class="setting_description">Integration ID with Google Analytics</p>
+ </div>
+ <div class="setting_value"><a href="">UA-1234567-2</a></div>
+ <div class="edit_value">
+ <input type="text" value="UA-1234567-2"/>
+ <input type="hidden" value="UA-1234567-2"/>
+ <a href="" class="action_input">Save</a>
+ <span class="cancel_value">or <a href="">cancel</a></span>
+ </div>
+ </li>
+ <li class="odd last" id="3">
+ <div class="name">
+ <p class="setting_name">services.google.tracking_id</p>
+ <p class="setting_description">Integration ID with Google Analytics</p>
+ </div>
+ <div class="setting_value"><a href="">UA-1234567-3</a></div>
+ <div class="edit_value">
+ <input type="text" value="UA-1234567-3"/>
+ <input type="hidden" value="UA-1234567-3"/>
+ <a href="" class="action_input">Save</a>
+ <span class="cancel_value">or <a href="">cancel</a></span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div class="settings_footer"></div>
+</div>
+<% end %>
+
31 app/views/admin/features/new.html.erb
@@ -0,0 +1,31 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js', 'prettyfile.js', 'admin/features/new.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'admin/features/new.css' %>
+<% end %>
+
+<div class="content_box table">
+ <h1>New Feature</h1>
+
+ <% @features_fields.each do |column| %>
+ <%= label_tag column[:name], column[:name], :class => 'field_label' %>
+ <%= build_field_for_column(column) %>
+ <% end %>
+
+ <span class="file_content">
+ <%= file_field :post, :attached, :accept => 'text/html', :id=>"file_input" %>
+ </span>
+
+ <%= link_to 'Save changes', admin_dashboard_index_path, :class => 'main_action' %>
+
+ <div class="side_bar">
+ <%= link_to (content_tag(:span) + 'Back to dashboard'), admin_dashboard_index_path, :class => 'back' %>
+ <div class="delete">
+ <span>DELETE THIS FEATURE</span>
+ <p>Clicking the link below will permanently delete this feature and its references within the site</p>
+ <a href="">Delete this feature</a>
+ </div>
+ </div>
+</div>
43 app/views/admin/features/show.html.erb
@@ -0,0 +1,43 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'admin/features/index.css' %>
+<% end %>
+
+
+<div class="content_box">
+ <div class="left">
+ <h1>Feature <%=params[:id]%></h1>
+
+ <label for="name" class="field_label">NAME</label>
+ <input type="text" id="name"/>
+
+ <label for="description" class="field_label">DESCRIPTION</label>
+ <input type="text" id="description"/>
+
+ <label for="employee_number" class="field_label">EMPLOYEE NUMBER</label>
+ <input type="text" id="employee_number"/>
+
+ <label for="iso_certification" class="field_label">ISO 9001 CERTIFICATION</label>
+ <input type="radio" name="iso_certification" value="Yes"/> Yes<br/>
+ <input type="radio" name="iso_certification" value="No"/> No<br/>
+ <input type="radio" name="iso_certification" value="Not informed"/> Not informed<br/>
+
+ <a href="/admin/" class="main_action">Save changes</a>
+
+ </div>
+
+ <div class="right">
+ <a href="/admin/" class="back">Back to dashboard</a>
+ <div class="delete">
+ <span>DELETE THIS FEATURE</span>
+ <p>Clicking the link below will permanently delete this feature and its references within the site</p>
+ <a href="">Delete this feature</a>
+ </div>
+ </div>
+ <div class="clear"></div>
+</div>
+
+<div class="clear"></div>
38 app/views/admin/pages/show.html.erb
@@ -0,0 +1,38 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'admin/features/index.css' %>
+<% end %>
+
+
+<div class="content_box">
+ <div class="left">
+ <h1>Page <%=params[:id]%></h1>
+
+ <label for="title" class="field_label">TITLE</label>
+ <input type="text" id="title"/>
+
+ <label for="body" class="field_label">BODY</label>
+ <input type="text" id="body"/>
+
+ <label for="permalink" class="field_label">PERMALINK</label>
+ <input type="text" id="permalink"/>
+
+ <a href="/admin/" class="main_action">Save changes</a>
+
+ </div>
+
+ <div class="right">
+ <a href="/admin/" class="back">Back to dashboard</a>
+ <div class="delete">
+ <span>DELETE THIS PAGE</span>
+ <p>Clicking the link below will permanently delete this page from the site</p>
+ <a href="">Delete this page</a>
+ </div>
+ </div>
+ <div class="clear"></div>
+</div>
+
+<div class="clear"></div>
3 app/views/admin/shared/_footer.html.erb
@@ -0,0 +1,3 @@
+<footer>
+ <div id="footer_content">POWERED BY <a href="">CARTOSET</a></div>
+</footer>
13 app/views/admin/shared/_header.html.erb
@@ -0,0 +1,13 @@
+<header>
+ <div id="header_content">
+ <h1 id="logo">CartoSet</h1>
+ <nav>
+ <ul>
+ <li><%= link_to t('.features'), '#' , :id => 'features_menu_link' %></li>
+ <li><%= link_to t('.pages'), '#', :id => 'pages_menu_link' %></li>
+ <% if false %><li><%= link_to t('.settings'), '#' , :id => 'settings_menu_link'%></li><% end %>
+ <li><%= link_to t('.close_session'), '#', :class => 'close_session' %></li>
+ </ul>
+ </nav>
+ </div>
+</header>
20 app/views/features/index.html.erb
@@ -0,0 +1,20 @@
+<% content_for :javascripts do %>
+ <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
+ <%= javascript_include_tag 'jquery.1.5.1.js', 'utils.js', 'features/index.js' %>
+ <script type="text/javascript" charset="utf-8">
+ var features = <%= @features.to_json.html_safe %>;
+ </script>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'features/index.css' %>
+<% end %>
+
+<h1 id="features_list"><%= t('.title')%></h1>
+<div id="features_map"></div>
+
+<ul>
+ <% @features.each do |feature| %>
+ <li><%= link_to feature.name, feature_path(feature.cartodb_id) %></li>
+ <% end %>
+</ul>
11 app/views/features/show.html.erb
@@ -0,0 +1,11 @@
+<h2><%= @feature.name %></h2>
+<div>
+ <span class="label">latitude: </span><span><%= @feature.latitude %></span>
+</div>
+<div>
+ <span class="label">longitude: </span><span><%= @feature.longitude %></span>
+</div>
+<div>
+ <span class="label">description:</span>
+ <p><%= @feature.description %></p>
+</div>
6 app/views/home/index.html.erb
@@ -0,0 +1,6 @@
+<h1 id="welcome_message"><%= t('.welcome') %></h1>
+<h2><%= t('.disclaimer') %></h2>
+
+<p>
+ <%= raw t('.features_list', :features_link => link_to(t('.features_link'), features_path)) %>
+</p>
17 app/views/layouts/admin.html.erb
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Cartoset - Administration Panel</title>
+ <%= stylesheet_link_tag 'reset.css', 'admin.css' %>
+ <%= yield :stylesheets %>
+ <%= csrf_meta_tag %>
+</head>
+<body>
+<%= render 'admin/shared/header' %>
+<div id="main_content">
+ <%= yield %>
+</div>
+<%= render 'admin/shared/footer' %>
+<%= yield :javascripts %>
+</body>
+</html>
25 app/views/layouts/application.html.erb
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Cartoset</title>
+ <%= stylesheet_link_tag 'reset.css', 'application.css' %>
+ <%= yield :stylesheets %>
+ <%= csrf_meta_tag %>
+</head>
+<body>
+
+<div class="header">
+ <% if logged_in? %>
+ Hi <%= current_user.username %>! (<%= link_to('logout', logout_path) %>)
+ <% else %>
+ <%= link_to('login', login_path) %>
+ <% end %>
+</div>
+
+<div id="main_content">
+ <%= yield %>
+</div>
+<%= yield :javascripts %>
+
+</body>
+</html>
16 app/views/layouts/setup.html.erb
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Cartoset - Configuration process</title>
+ <%= stylesheet_link_tag 'reset.css', 'setup/index.css' %>
+ <%= yield :stylesheets %>
+ <%= csrf_meta_tag %>
+</head>
+<body>
+<div id="main_content">
+ <%= yield %>
+</div>
+<%= render 'help' %>
+<%= yield :javascripts %>
+</body>
+</html>
33 app/views/prototypes/prueba.html.erb
@@ -0,0 +1,33 @@
+
+ <% content_for :javascripts do %>
+ <%= javascript_include_tag 'jquery.1.5.1.js', 'jHtmlArea-0.7.0.min.js', 'admin/pages/new.js' %>
+ <% end %>
+
+ <% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'admin/pages/new.css' %>
+ <% end %>
+
+
+ <div id="main_content">
+ <div class="content_box table">
+ <h1>New Page</h1>
+
+ <label class="field_label" for="title">title<strong>*</strong></label>
+ <input class="string" id="name" name="title" type="text" value="About Methane Gas Hydrates" />
+
+ <label class="field_label" for="body">body<strong>*</strong></label>
+ <textarea id="txtDefaultHtmlArea"></textarea>
+
+ <label class="field_label permalink" for="permalink">permalink</label>
+ <input class="string" id="permalink" name="permalink" type="text" value="Permalink" />
+
+ <span class="submit">
+ <a href="/admin/dashboard" class="main_action">Save new page</a>
+ <a class="checkbox" href="#check">This page is visible</a>
+ </span>
+
+ <div class="side_bar">
+ <a href="/admin/dashboard" class="back"><span></span>Back to pages</a>
+ </div>
+ </div>
+ </div>
3 app/views/sessions/new.html.erb
@@ -0,0 +1,3 @@
+Welcome to CartoSet
+
+<%= link_to "Sign in with CartoDB", "/auth/cartodb_authentication" %>
1 app/views/setup/_help.html.erb
@@ -0,0 +1 @@
+<div class="help"><%= raw t('.problems', :contact_us => link_to(t('.contact_us'), '#')) %></div>
14 app/views/setup/_step_indicator.erb
@@ -0,0 +1,14 @@
+<ol class="step_indicator">
+ <li class="<%= "selected" if step==1%>">
+ <span class="step_number">1</span>
+ <span class="step_description"><%= t('.step_1') %></span>
+ </li>
+ <li class="<%= "selected" if step==2%>">
+ <span class="step_number">2</span>
+ <span class="step_description"><%= t('.step_2') %></span>
+ </li>
+ <li class="<%= "selected" if step==3%>">
+ <span class="step_number">3</span>
+ <span class="step_description"><%= t('.step_3') %></span>
+ </li>
+</ol>
22 app/views/setup/features_table_data.html.erb
@@ -0,0 +1,22 @@
+<table class="data">
+ <tr>
+ <% @table.schema.first(3).each do |column| %>
+ <th class="<%= column.last %>"><%= column.first %></th>
+ <% end %>
+ </tr>
+ <% if @rows.present? %>
+ <% first_row = @rows.shift %>
+ <tr>
+ <% first_row.values.first(3).each do |cell| %>
+ <td class="first"><%= cell %></td>
+ <% end %>
+ </tr>
+ <% @rows.each do |row| %>
+ <tr class="item <%= cycle('odd', 'even') %>">
+ <% row.values.first(3).each do |cell| %>
+ <td><%= cell %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ <% end %>
+</table>
10 app/views/setup/step0.html.erb
@@ -0,0 +1,10 @@
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'setup/index.css', 'setup/step0.css' %>
+<% end %>
+
+<div class="small_content_box">
+ <h1 class="lowered"><%= t('.congrats') %></h1>
+ <p class="success_message"><%= t('.success') %></p>
+ <%= link_to t('.start'), setup_path(:step_id => 1), :class => 'main_action' %>
+</div>
+
86 app/views/setup/step1.html.erb
@@ -0,0 +1,86 @@
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'setup/index.css', 'setup/step1.css' %>
+<% end %>
+
+<% content_for :javascripts do %>
+ <%= javascript_include_tag 'jquery.1.5.1.js', 'setup/step1.js' %>
+<% end %>
+
+<%= render 'step_indicator', :step => 1 %>
+
+<div class="small_content_box">
+ <h1><%= t('.title') %></h1>
+ <p><%= t('.description') %></p>
+ <br />
+ <p><%= t('.continue') %></p>
+ <br />
+
+
+ <ul>
+ <li class="selected">
+ <div class="top">
+ <div class="bottom">
+ <div class="middle">
+ <a class="radiobutton" href="#">Use CartoDB</a>
+ <div class="options right">
+ <%= form_tag setup_path(:step_id => 2) do %>
+ <div class="field cartodb">
+ <%= label_tag 'oauth_host', t('.oauth_host'), :class => 'host' %>
+ <%= text_field_tag 'oauth_host' %>
+ </div>
+ <div class="field cartodb">
+ <%= label_tag 'oauth_key', t('.oauth_key'), :class => 'oauth_key' %>
+ <%= text_field_tag 'oauth_key' %>
+ </div>
+ <div class="field cartodb">
+ <%= label_tag 'oauth_secret', t('.oauth_secret'), :class => 'oauth_secret' %>
+ <%= text_field_tag 'oauth_secret' %>
+ </div>
+ <div class="submit">
+ <%= submit_tag t('.connect_with_cartodb'), :class => 'main_action' %>
+ </div>
+ <% end %>
+ </div>
+ </div>
+ </div>
+ </div>
+ </li>
+ <li>
+ <div class="top">
+ <div class="bottom">
+ <div class="middle">
+ <a class="radiobutton" href="#">Use your own database</a>
+ <div class="options bottom">
+ <%= form_tag setup_path(:step_id => 2) do %>
+ <div class="field">
+ <%= label_tag 'hostname', t('.hostname'), :class => 'hostname' %>
+ <%= text_field_tag 'hostname' %>
+ </div>
+ <div class="field last">
+ <%= label_tag 'port', t('.port'), :class => 'port' %>
+ <%= text_field_tag 'port' %>
+ </div>
+ <div class="field">
+ <%= label_tag 'user', t('.user'), :class => 'user' %>
+ <%= text_field_tag 'user' %>
+ </div>
+ <div class="field last">
+ <%= label_tag 'password', t('.password'), :class => 'password' %>
+ <%= text_field_tag 'password' %>
+ </div>
+ <div class="field database">
+ <%= label_tag 'database_name', t('.database_name'), :class => 'database_name' %>
+ <%= text_field_tag 'database_name' %>
+ </div>
+ <div class="submit">
+ <%= submit_tag t('.connect'), :class => 'main_action' %>
+ </div>
+ <% end %>
+ </div>
+ </div>
+ </div>
+ </div>
+ </li>
+ </ul>
+
+</div>
19 app/views/setup/step2.html.erb
@@ -0,0 +1,19 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js', 'setup/step2.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'setup/index.css', 'setup/step2.css' %>
+<% end %>
+
+<%= render 'step_indicator', :step => 2 %>
+
+<div class="small_content_box">
+ <h1><%= t('.title') %></h1>
+ <p><%= t('.description') %></p>
+ <%= form_tag setup_path(:step_id => 3) do %>
+ <%= label_tag 'app_name', t('.app_name') %>
+ <%= text_field_tag 'app_name' %>
+ <%= submit_tag t('.next_step'), :class => 'main_action' %>
+ <% end %>
+</div>
43 app/views/setup/step3.html.erb
@@ -0,0 +1,43 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js', 'fileuploader.js', 'jquery.jscrollpane.min.js', 'jquery.mousewheel.js', 'setup/step3.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'setup/index.css', 'setup/step3.css', 'jscrollpane.css' %>
+<% end %>
+
+<%= render 'step_indicator', :step => 3 %>
+<%= form_tag setup_path(:step_id => 4) do %>
+ <div class="small_content_box">
+ <h1><%= t('.title') %></h1>
+ <p><%= t('.description') %></p>
+
+ <div id="select_table" class="shadowed">
+ <a href="#" class="selector">Select table</a> <span id="new_table"><%= raw t('.or', :link => link_to(t('.create_a_new_one'), '#')) %></span>
+ <ul id="tables_combo" class="selector_values scroll_pane">
+ <% @tables.each do |table| %>
+ <li><a href="#"><%= table.name %></a></li>
+ <% end %>
+ </ul>
+ <%= select_tag 'features_table', options_for_select(@tables.map{|t| [t.name, t.name]}), {:include_blank => true} %>
+ <div id="table_data"></div>
+ </div>
+
+ <div id="create_table" class="shadowed">
+ <div id="file-uploader">
+ select
+ <noscript>
+ <%= form_tag create_table_path do %>
+ <%= label_tag 'data_file' %>
+ <%= file_field_tag 'data_file' %>
+ <%= submit_tag 'Submit' %>
+ <% end %>
+ </noscript>
+ </div>
+ <span class="select_file message">Select a data file (CSV,XLS) from your computer</span>
+ <span class="processing message">Processing your file...</span>
+ </div>
+
+ <%= submit_tag t('.use_this_table'), :id => 'use_this_table', :class => 'main_action right', :disabled => true %>
+ </div>
+<% end %>
31 app/views/setup/step4.html.erb
@@ -0,0 +1,31 @@
+<% content_for :javascripts do %>
+<%= javascript_include_tag 'jquery.1.5.1.js', 'admin/setup/index.js' %>
+<% end %>
+
+<% content_for :stylesheets do %>
+ <%= stylesheet_link_tag 'setup/index.css' %>
+ <%= stylesheet_link_tag 'setup/step4.css' %>
+<% end %>
+
+<div class="small_content_box">
+ <h1><%= t('.title') %></h1>
+ <p><%= t('.description') %></p>
+
+ <div class="shadowed">
+ <div class="suggestion" id="manage_data">
+ <h2><%= t('.manage_data.title') %></h2>
+ <p><%= t('.manage_data.description') %></p>
+ <%= link_to t('.manage_data.link'), "#{CartoDB::Settings['host']}/tables/#{@table.id}" %>
+ </div>
+ <div class="suggestion" id="manage_site">
+ <h2><%= t('.manage_site.title') %></h2>
+ <p><%= t('.manage_site.description') %></p>
+ <%= link_to t('.manage_site.link'), admin_path %>
+ </div>
+ <div class="suggestion last" id="public_site">
+ <h2><%= t('.public_site.title') %></h2>
+ <p><%= t('.public_site.description') %></p>
+ <%= link_to t('.public_site.link'), root_path %>
+ </div>
+ </div>
+</div>
4 config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Cartoset::Application
50 config/application.rb
@@ -0,0 +1,50 @@
+require File.expand_path('../boot', __FILE__)
+
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "active_resource/railtie"
+require "rails/test_unit/railtie"
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Cartoset
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ config.generators do |g|
+ g.test_framework :rspec, :fixture => true, :views => false
+ end
+ end
+end
+
6 config/boot.rb
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5 config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Cartoset::Application.initialize!
26 config/environments/development.rb
@@ -0,0 +1,26 @@
+Cartoset::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+end
+
49 config/environments/production.rb
@@ -0,0 +1,49 @@
+Cartoset::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The production environment is meant for finished, "live" apps.
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Specifies the header that your server uses for sending files
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
+
+ # For nginx:
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
+
+ # If you have no front-end server that supports something like X-Sendfile,
+ # just comment this out and Rails will serve the files
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Disable Rails's static asset server
+ # In production, Apache or nginx will already do this
+ config.serve_static_assets = false
+
+ # Enable serving of images, stylesheets, and javascripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
35 config/environments/test.rb
@@ -0,0 +1,35 @@
+Cartoset::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
7 config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
6 config/initializers/cartoset_config.rb
@@ -0,0 +1,6 @@
+require 'cartoset/config'
+require 'cartoset/constants'
+require 'cartoset/features_data_importer'
+include Cartoset
+
+Cartoset::Config.setup_cartodb
1 config/initializers/extra_cartoset_libs.rb
@@ -0,0 +1 @@
+require 'helpers/feature_getter_helper'
13 config/initializers/float.rb
@@ -0,0 +1,13 @@
+ # coding: UTF-8
+
+class Float
+
+ def self.random_latitude
+ 40.0 + (rand(10000.0) / 1000.0)
+ end
+
+ def self.random_longitude
+ 3.0 + (rand(1000.0) / 1000.0)
+ end
+
+end
10 config/initializers/inflections.rb
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
5 config/initializers/mime_types.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
7 config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Cartoset::Application.config.secret_token = '9abd9384eb9295f25f6e453477984269f91de653ab0dcd8dd4f3f4dd22183b6c7d324fc5a0e2ed50e490e30e5d2c05179752ae7ef391f0abf8b091180cfe2b0b'
8 config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Cartoset::Application.config.session_store :cookie_store, :key => '_cartoset_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# Cartoset::Application.config.session_store :active_record_store
96 config/initializers/string.rb
@@ -0,0 +1,96 @@
+ # coding: UTF-8
+
+class String
+ def self.random(length=10)
+ ('a'..'z').sort_by {rand}[0,length].join
+ end
+
+ def normalize
+ str = self.downcase
+ return '' if str.blank?
+ n = str
+ n.gsub!(/[àáâãäåāă]/, 'a')
+ n.gsub!(/æ/, 'ae')
+ n.gsub!(/[ďđ]/, 'd')
+ n.gsub!(/[çćčĉċ]/, 'c')
+ n.gsub!(/[èéêëēęěĕė]/, 'e')
+ n.gsub!(/ƒ/, 'f')
+ n.gsub!(/[ĝğġģ]/, 'g')
+ n.gsub!(/[ĥħ]/, 'h')
+ n.gsub!(/[ììíîïīĩĭ]/, 'i')
+ n.gsub!(/[įıijĵ]/, 'j')
+ n.gsub!(/[ķĸ]/, 'k')
+ n.gsub!(/[łľĺļŀ]/, 'l')
+ n.gsub!(/[ñńňņʼnŋ]/, 'n')
+ n.gsub!(/[òóôõöøōőŏŏ]/, 'o')
+ n.gsub!(/œ/, 'oe')
+ n.gsub!(/ą/, 'q')
+ n.gsub!(/[ŕřŗ]/, 'r')
+ n.gsub!(/[śšşŝș]/, 's')
+ n.gsub!(/[ťţŧț]/, 't')
+ n.gsub!(/[ùúûüūůűŭũų]/, 'u')
+ n.gsub!(/ŵ/, 'w')
+ n.gsub!(/[ýÿŷ]/, 'y')
+ n.gsub!(/[žżź]/, 'z')
+
+ n.gsub!(/[ÀÁÂÃÄÅĀĂ]/i, 'A')
+ n.gsub!(/Æ/i, 'AE')
+ n.gsub!(/[ĎĐ]/i, 'D')
+ n.gsub!(/[ÇĆČĈĊ]/i, 'C')
+ n.gsub!(/[ÈÉÊËĒĘĚĔĖ]/i, 'E')
+ n.gsub!(/Ƒ/i, 'F')
+ n.gsub!(/[ĜĞĠĢ]/i, 'G')
+ n.gsub!(/[ĤĦ]/i, 'H')
+ n.gsub!(/[ÌÌÍÎÏĪĨĬ]/i, 'I')
+ n.gsub!(/[IJĴ]/i, 'J')
+ n.gsub!(/[Ķĸ]/i, 'J')
+ n.gsub!(/[ŁĽĹĻĿ]/i, 'L')
+ n.gsub!(/[ÑŃŇŅʼnŊ]/i, 'M')
+ n.gsub!(/[ÒÓÔÕÖØŌŐŎŎ]/i, 'N')
+ n.gsub!(/Œ/i, 'OE')
+ n.gsub!(/Ą/i, 'Q')
+ n.gsub!(/[ŔŘŖ]/i, 'R')
+ n.gsub!(/[ŚŠŞŜȘ]/i, 'S')
+ n.gsub!(/[ŤŢŦȚ]/i, 'T')
+ n.gsub!(/[ÙÚÛÜŪŮŰŬŨŲ]/i, 'U')
+ n.gsub!(/Ŵ/i, 'W')
+ n.gsub!(/[ÝŸŶ]/i, 'Y')
+ n.gsub!(/[ŽŻŹ]/i, 'Z')
+ n
+ end
+
+ def sanitize
+ return if self.blank?
+ self.gsub(/<[^>]+>/m,'').normalize.downcase.gsub(/&.+?;/,'-').
+ gsub(/[^a-z0-9 _-]/,'-').strip.gsub(/\s+/,'-').gsub(/-+/,'-').
+ gsub(/-/,' ').strip.gsub(/ /,'-').gsub(/-/,'_')
+ end
+
+ def strip_tags
+ self.gsub(/<[^>]+>/m,'').strip
+ end
+
+ def convert_to_db_type
+ if CartoDB::TYPES.keys.include?(self.downcase)
+ CartoDB::TYPES[self.downcase].first
+ else
+ self.downcase
+ end
+ end
+
+ # {"integer"=>:number, "real"=>:number, "varchar"=>:string, "text"=>:string, "timestamp"=>:date, "boolean"=>:boolean}
+ def convert_to_cartodb_type
+ inverse_types = CartoDB::TYPES.invert.inject({}){ |h, e| e.first.each{ |k| h[k] = e.last }; h}
+ if inverse_types.keys.include?(self.downcase)
+ inverse_types[self.downcase]
+ else
+ self.downcase
+ end
+ end
+
+ def sanitize_sql!
+ self.gsub(/\\/, '\&\&').gsub(/'/, "''")
+ end
+
+
+end
81 config/locales/en.yml
@@ -0,0 +1,81 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ admin:
+ shared:
+ header:
+ features: 'Features'
+ pages: 'Pages'
+ settings: 'Settings'
+ close_session: 'Close session'
+ dashboard:
+ index:
+ your_features: 'Your features'
+ search: 'Search!'
+ search_label: 'Search by any field'
+ scroll_left: 'Scroll left'
+ scroll_right: 'Scroll right'
+ create_feature: 'Create new feature'
+ edit_in_cartodb: 'or edit them in CartoDB'
+ home:
+ index:
+ welcome: 'Welcome to CartoSet!'
+ disclaimer: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
+ features_list: 'You can see a list of %{features_link}'
+ features_link: 'features'
+ features:
+ index:
+ title: 'Features list'
+ setup:
+ help:
+ problems: 'If you get stuck or have any problem, %{contact_us}'
+ contact_us: 'contact us'
+ step_indicator:
+ step_1: 'Your CartoDB'
+ step_2: 'Your CartoSet'
+ step_3: 'Your Data'
+ step0:
+ congrats: 'Congratulations!'
+ success: "CartosSet has been succesfully installed. It's time to adapt it to your needs."
+ start: 'Start configuration'
+ step1:
+ title: 'Connect your app with CartoDB'
+ description: 'CartoSet stores its data in CartoDB, a powerful cloud-based database for geolocated data.'
+ continue: 'To continue, introduce your OAUTH key and secrets from your account in CartoDB:'
+ oauth_host: 'CartoDB Host'
+ oauth_key: 'Oauth key'
+ oauth_secret: 'Oauth secret'
+ connect_with_cartodb: 'Connect with CartoDB'
+ hostname: 'Hostname'
+ port: 'Port'
+ user: 'User'
+ password: 'Password'
+ database_name: 'Database Name'
+ connect: 'Connect'
+ step2:
+ title: 'Name your app'
+ description: "Don't be afraid. You will be able to change it later."
+ next_step: 'Save and continue'
+ app_name: "'Pandas in the world', 'Elvis sightings'..."
+ step3:
+ title: 'Import your data'
+ description: "Select which CartoDB table you want to use for this CartoSet. If you don't have tables created you will be able to create a new one."
+ or: 'or %{link}'
+ create_a_new_one: 'create a new one'
+ use_this_table: 'Use this table'
+ step4:
+ title: 'Done!'
+ description: 'It looks like you have your CartoSet running in your server. Now...'
+ manage_data:
+ title: 'Manage your data'
+ description: 'Change and clean your data, geolocalize your features...'
+ link: 'CartoDB table'
+ manage_site:
+ title: 'Manage your site'
+ description: 'Add images and videos, create additional pages...'
+ link: 'CartoSet backoffice'
+ public_site:
+ title: 'Go to your site'
+ description: 'Check how your users will see your site...'
+ link: 'Public site'
27 config/routes.rb
@@ -0,0 +1,27 @@
+Cartoset::Application.routes.draw do
+
+ resources :features
+
+ namespace :admin do
+ resources :dashboard
+ resources :features
+ resources :pages
+ resources :settings
+ end
+ match '/admin' => 'admin/dashboard#index', :as => :admin
+
+ match '/setup(/steps/:step_id)' => 'setup#step', :as => :setup
+ match '/setup/features_table_data' => 'setup#features_table_data'
+ match '/setup/create_features_table' => 'setup#create_features_table', :as => :create_table
+
+ match "/auth/cartodb", :as => :authorize
+ match "/auth/:provider/callback" => "sessions#create"
+
+ get '/login' => 'sessions#create', :as => :login
+ get '/logout' => 'sessions#destroy', :as => :logout
+
+ match ':controller(/:action(/:id))'
+
+ resources :features
+ root :to => "home#index"
+end
2 doc/README_FOR_APP
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
86 lib/cartoset/config.rb
@@ -0,0 +1,86 @@
+class Cartoset::Config
+
+ CARTODB_DEFAULT_HOST = 'https://api.cartodb.com'
+
+ config_env_folder = Rails.env.test?? 'tmp' : 'config'
+
+ @@path = Rails.root.join(config_env_folder, 'cartoset_config.yml')
+
+ cattr_accessor :path
+
+ class << self
+
+ def update(values)
+ values.each do |key, value|
+ settings[key.to_s] = value
+ end
+ consolidate_settings
+ end
+
+ def empty
+ settings = {}
+ consolidate_settings
+ end
+
+ def valid?
+ settings.present? && (cartodb_settings? || local_postgis_settings?) && settings['app_name'].present? && settings['features_table'].present?
+ end
+
+ def cartodb_settings?
+ settings['cartodb_oauth_key'].present? && settings['cartodb_oauth_secret'].present?
+ end
+ private :cartodb_settings?
+
+ def local_postgis_settings?
+ settings['host'].present? && settings['port'].present? && settings['user'].present? && settings['password'].present? && settings['database'].present?
+ end
+ private :local_postgis_settings?
+
+ def [](key)
+ settings[key]
+ end
+
+ def []=(key, value)
+ settings[key] = value
+ end
+
+ def destroy
+ FileUtils.rm_f(path) if File.exists?(path)
+ end
+
+ def setup_cartodb
+ if settings['cartodb_oauth_key'].present? && settings['cartodb_oauth_secret'].present?
+
+ cartodb_settings = {
+ 'host' => settings['cartodb_host'] || CARTODB_DEFAULT_HOST,
+ 'oauth_key' => settings['cartodb_oauth_key'],
+ 'oauth_secret' => settings['cartodb_oauth_secret']
+ }
+
+ CartoDB::Init.start Cartoset::Application, cartodb_settings
+
+ end
+ end
+
+ def settings=(values)
+ @@settings = values
+ end
+ private :settings=
+
+ def settings
+ @@settings ||= begin
+ YAML.load_file(path) || {}
+ rescue Exception => e
+ {}
+ end
+ end
+ private :settings
+
+ def consolidate_settings
+ File.open(path, "w") do |f|
+ f.write(settings.to_yaml)
+ end
+ end
+ private :consolidate_settings
+ end
+end
5 lib/cartoset/constants.rb
@@ -0,0 +1,5 @@
+module Cartoset
+ module Constants
+ COMMON_FEATURES_FIELDS = %w(cartodb_id the_geom created_at updated_at )
+ end
+end
18 lib/cartoset/features_data_importer.rb
@@ -0,0 +1,18 @@
+class Cartoset::FeaturesDataImporter
+
+ DATA_FILE_PATH = Rails.root.join('tmp/features_data.csv').freeze
+
+ def self.start(data_stream)
+ table = {}
+ File.open(DATA_FILE_PATH, 'w+') do |file|
+ file.write(data_stream.read.force_encoding("UTF-8"))
+
+ @tables = CartoDB::Connection.tables || nil
+ CartoDB::Connection.drop_table('cartoset_features') if @tables && @tables.map{|t| t.name}.include?('cartoset_features')
+
+ table = CartoDB::Connection.create_table 'cartoset_features', file
+ end
+
+ table
+ end
+end
9 lib/helpers/feature_getter_helper.rb
@@ -0,0 +1,9 @@
+module FeatureGetterHelper
+
+ def get_feature
+ results = CartoDB::Connection.query("SELECT * FROM features WHERE cartodb_id = #{params[:id]}") if params[:id]
+ @feature = results.rows.first if results && results.rows.present?
+ end
+ private :get_feature
+
+end
0 lib/tasks/.gitkeep
No changes.
62 lib/tasks/cartoset.rake
@@ -0,0 +1,62 @@
+
+namespace :cartoset do
+ desc "Creates the cartodb schema"
+ task :create_schema => :environment do
+ errors = []
+
+ puts ''
+ puts 'Creating table features...'
+
+ begin
+ CartoDB::Connection.create_table 'features'
+ puts '... done!'
+ rescue CartoDB::CartoError => e
+ errors << e
+ end
+
+ print_errors(errors)
+ end
+
+ desc "Drops the cartodb schema"
+ task :drop_schema => :environment do
+ errors = []
+
+ puts ''
+ puts 'Droping table features...'
+
+ begin
+ table = CartoDB::Connection.table 'features'
+ CartoDB::Connection.drop_table table.id
+
+ puts '... done!'
+ rescue CartoDB::CartoError => e
+ errors << e
+ end
+
+ print_errors(errors)
+ end
+
+ desc "Creates random test data"
+ task :test_data => :environment do
+ CartoDB::Connection.table 'features'
+