From 7de642ccb2c6082708f564b1f1de451ba48cfeb0 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 5 Apr 2016 10:12:12 +0800 Subject: [PATCH 1/5] add rack-cors; fix #531 --- Gemfile | 1 + Gemfile.lock | 2 ++ config/initializers/cors.rb | 8 ++++++++ 3 files changed, 11 insertions(+) create mode 100644 config/initializers/cors.rb diff --git a/Gemfile b/Gemfile index 1a129d7b..26bd64f6 100644 --- a/Gemfile +++ b/Gemfile @@ -18,6 +18,7 @@ gem 'kaminari' # pagination gem 'uservoice-ruby' gem 'dotenv' gem 'snorlax' +gem 'rack-cors' gem 'httparty' gem 'active_model_serializers', '~> 0.8.1' gem 'delayed_job', '~> 4.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index 6a522642..44873eda 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -160,6 +160,7 @@ GEM quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.6.4) + rack-cors (0.4.0) rack-test (0.6.3) rack (>= 1.0) rails (4.2.4) @@ -286,6 +287,7 @@ DEPENDENCIES pundit pundit_extra quiet_assets + rack-cors rails (= 4.2.4) rails3-jquery-autocomplete rails_12factor diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb new file mode 100644 index 00000000..6fd69b6a --- /dev/null +++ b/config/initializers/cors.rb @@ -0,0 +1,8 @@ +Rails.application.config.middleware.insert_before 0, Rack::Cors do + allow do + origins '*' + resource '*', + headers: :any, + methods: [:get, :post, :put, :delete, :options, :head] + end +end From 2e6f04d0be53c7a0cdaa1ede795e3818fa473648 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 6 Apr 2016 10:27:31 +0800 Subject: [PATCH 2/5] metamaps.debug function, and move VERSION into a rails constant initializer. from this commit on, we would need to modify config/initializers/version.rb to increment the version number. --- app/assets/javascripts/src/Metamaps.Debug.js.erb | 7 +++++++ app/assets/javascripts/src/Metamaps.js.erb | 3 ++- app/views/layouts/_lightboxes.html.erb | 2 +- config/initializers/version.rb | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/src/Metamaps.Debug.js.erb create mode 100644 config/initializers/version.rb diff --git a/app/assets/javascripts/src/Metamaps.Debug.js.erb b/app/assets/javascripts/src/Metamaps.Debug.js.erb new file mode 100644 index 00000000..18fcb620 --- /dev/null +++ b/app/assets/javascripts/src/Metamaps.Debug.js.erb @@ -0,0 +1,7 @@ +Metamaps.Debug = function() { + console.debug(Metamaps) + console.debug(`Metamaps Version: ${Metamaps.VERSION}`) +} +Metamaps.debug = function() { + Metamaps.Debug() +} diff --git a/app/assets/javascripts/src/Metamaps.js.erb b/app/assets/javascripts/src/Metamaps.js.erb index c49e6801..231592da 100644 --- a/app/assets/javascripts/src/Metamaps.js.erb +++ b/app/assets/javascripts/src/Metamaps.js.erb @@ -16,11 +16,12 @@ var labelType, useGradients, nativeTextSupport, animate; animate = !(iStuff || !nativeCanvasSupport); })(); -// TODO eliminate these 4 top-level variables +// TODO eliminate these 5 top-level variables Metamaps.panningInt = null; Metamaps.tempNode = null; Metamaps.tempInit = false; Metamaps.tempNode2 = null; +Metamaps.VERSION = '<%= VERSION %>' Metamaps.Settings = { embed: false, // indicates that the app is on a page that is optimized for embedding in iFrames on other web pages diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index 53e402a9..225433ed 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -18,7 +18,7 @@

PRIVATE BETA

-

2.8

+

<%= VERSION %>

Mar 26, 2016

diff --git a/config/initializers/version.rb b/config/initializers/version.rb new file mode 100644 index 00000000..9fd9407f --- /dev/null +++ b/config/initializers/version.rb @@ -0,0 +1 @@ +VERSION = '2.8.3' From e27d64e64384a432297f2446683b782eb4e860d1 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 6 Apr 2016 20:09:25 +0800 Subject: [PATCH 3/5] only allow cors on api routes --- config/initializers/cors.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 6fd69b6a..092bbeaf 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,7 +1,7 @@ Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' - resource '*', + resource '/api/*', headers: :any, methods: [:get, :post, :put, :delete, :options, :head] end From c9bba0cdb28aed90382a2ab60bac393b2aefe1b9 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 13 Apr 2016 10:16:54 +0800 Subject: [PATCH 4/5] rename repo --- README.md | 16 ++++++++-------- app/views/layouts/_head.html.erb | 2 +- app/views/layouts/_lightboxes.html.erb | 4 ++-- app/views/main/home.html.erb | 2 +- doc/CONTRIBUTING.md | 4 ++-- doc/RailsIntroduction.md | 2 +- doc/UbuntuInstallation.md | 6 +++--- doc/WindowsInstallation.md | 8 ++++---- doc/production/first-deploy.md | 22 +++++++++++----------- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index cf871b82..20d8db27 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Metamaps ======= -[![Join the chat at https://gitter.im/metamaps/metamaps_gen002](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/metamaps/metamaps_gen002?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.org/metamaps/metamaps_gen002.svg)](https://travis-ci.org/metamaps/metamaps_gen002) +[![Join the chat at https://gitter.im/metamaps/metamaps](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/metamaps/metamaps?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/metamaps/metamaps.svg)](https://travis-ci.org/metamaps/metamaps) Welcome to the Metamaps GitHub repo. @@ -20,11 +20,11 @@ To get connected with the community interested in Metamaps, join our [Google+ co If you are on Mac or Ubuntu you can use the following instructions to quickly get a local copy of metamaps up and running using a Vagrant virtualbox. Don't be intimidated, it's easy! ``` -git clone git@github.com:metamaps/metamaps_gen002.git +git clone git@github.com:metamaps/metamaps.git ``` Now ensure you have VirtualBox and Vagrant installed on your computer ``` -cd metamaps_gen002 +cd metamaps ./bin/configure.sh ``` This will do all the setup steps to make Metamaps work with a bit of behind the scenes ninja magick. @@ -73,7 +73,7 @@ Copyright (c) 2015 Connor Turland [site-blog]: http://blog.metamaps.cc [site-beta]: http://metamaps.cc [community]: https://plus.google.com/u/0/communities/115060009262157699234 -[license]: https://github.com/metamaps/metamaps_gen002/blob/develop/LICENSE -[contributing]: https://github.com/metamaps/metamaps_gen002/blob/develop/doc/CONTRIBUTING.md -[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/develop/doc/CONTRIBUTING.md#reporting-bugs-and-other-issues -[windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/develop/doc/WindowsInstallation.md +[license]: https://github.com/metamaps/metamaps/blob/develop/LICENSE +[contributing]: https://github.com/metamaps/metamaps/blob/develop/doc/CONTRIBUTING.md +[contributing-issues]: https://github.com/metamaps/metamaps/blob/develop/doc/CONTRIBUTING.md#reporting-bugs-and-other-issues +[windows-installation]: https://github.com/metamaps/metamaps/blob/develop/doc/WindowsInstallation.md diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 07881bce..e99ec640 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -5,7 +5,7 @@ Metamaps.cc is an open source project, and we are always looking for new developers to help contribute to our codebase! To get involved, send an email to team@metamaps.cc or find us on Github at - https://github.com/metamaps/metamaps_gen002. + https://github.com/metamaps/metamaps. --> diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index 225433ed..461366c0 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -51,7 +51,7 @@
  • - +
    source code
    @@ -205,7 +205,7 @@

    MEMBERS are contributors who act as stewards and guardians of the collective and are responsible for maintaining our culture and purpose. We're working on a set of agreements to formalize what it means to be a member.

    -

    We welcome people of all skillsets to create value within our network. There's open possibilities for designers, researchers, academics, strategists, and facilitators to contribute. If you're a developer, help us advance the code and take a look around our Github.

    +

    We welcome people of all skillsets to create value within our network. There's open possibilities for designers, researchers, academics, strategists, and facilitators to contribute. If you're a developer, help us advance the code and take a look around our Github.

    Thanks for your interest in helping out with Metamaps! Hopefully this gets you pointed in the right direction to get involved. The next step is to read the links on this page and then contribute!

    diff --git a/app/views/main/home.html.erb b/app/views/main/home.html.erb index 6089b7df..062de972 100644 --- a/app/views/main/home.html.erb +++ b/app/views/main/home.html.erb @@ -34,7 +34,7 @@