From 7a1b68960df6548715a7a0ab108368c13296f0fd Mon Sep 17 00:00:00 2001 From: mix irving Date: Sun, 8 Mar 2015 20:21:25 +1300 Subject: [PATCH 1/2] install dotenv to help managed env vars --- .example-env | 18 ++++++++++++++++++ .gitignore | 1 + Gemfile | 1 + Gemfile.lock | 2 ++ 4 files changed, 22 insertions(+) create mode 100644 .example-env diff --git a/.example-env b/.example-env new file mode 100644 index 00000000..3e8752fb --- /dev/null +++ b/.example-env @@ -0,0 +1,18 @@ +RAILS_ENV=development + +AWS_ACCESS_KEY_ID +AWS_SECRET_ACCESS_KEY +BUNDLE_GEMFILE +SMTP_DOMAIN +SMTP_PASSWORD +SMTP_PORT +SMTP_SERVER +SMTP_USERNAME +SSO_KEY + +## find the ENV currently in use in the app using : +## grep -rIso -P "(?<=ENV)(\.fetch\(|\[).[A-Z_]+.(\)|\])" + +# for a uniq ordered list of env vars: +## grep -rIsoh -P "(?<=ENV)(\.fetch\(|\[).[A-Z_]+.(\)|\])" | grep -oP "[A-Z_]+" | sort -u > temp + diff --git a/.gitignore b/.gitignore index d1889d2c..75aa3c26 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ realtime/node_modules config/database.yml +.env #public/assets # Ignore bundler config diff --git a/Gemfile b/Gemfile index e21cca7e..9489f21d 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'rails3-jquery-autocomplete' gem 'best_in_place' #in-place editing gem 'kaminari' # pagination gem 'uservoice-ruby' +gem 'dotenv' gem 'paperclip' gem 'aws-sdk' diff --git a/Gemfile.lock b/Gemfile.lock index e46dfc6b..98a5e233 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -59,6 +59,7 @@ GEM responders thread_safe (~> 0.1) warden (~> 1.2.3) + dotenv (2.0.0) erubis (2.7.0) execjs (2.2.1) ezcrypto (0.7.2) @@ -165,6 +166,7 @@ DEPENDENCIES cancan coffee-rails (~> 3.2.1) devise + dotenv formtastic formula jbuilder (= 0.8.2) From a9b034637bd982c1c3e8d0e8d2288911ae8cc1b4 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 30 Sep 2015 13:55:23 +0800 Subject: [PATCH 2/2] only autocomplete topic/synapse if the user types more than 2 characters --- app/assets/javascripts/src/Metamaps.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 2a378623..af0518d0 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -665,8 +665,11 @@ Metamaps.Create = { }); // initialize the autocomplete results for the metacode spinner - $('#topic_name').typeahead([ + $('#topic_name').typeahead( { + minLength: 2, + }, + [{ name: 'topic_autocomplete', limit: 8, template: $('#topicAutocompleteTemplate').html(), @@ -674,8 +677,8 @@ Metamaps.Create = { url: '/topics/autocomplete_topic?term=%QUERY' }, engine: Hogan - } - ]); + }] + ); // tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete $('#topic_name').bind('typeahead:selected', function (event, datum, dataset) { @@ -724,8 +727,11 @@ Metamaps.Create = { }); // initialize the autocomplete results for synapse creation - $('#synapse_desc').typeahead([ + $('#synapse_desc').typeahead( { + minLength: 2, + }, + [{ name: 'synapse_autocomplete', template: "
{{label}}
", remote: { @@ -745,8 +751,8 @@ Metamaps.Create = { }, engine: Hogan, header: "

Existing synapses

" - } - ]); + }] + ); $('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) { if (datum.id) { // if they clicked on an existing synapse get it