diff --git a/.example-env b/.example-env index 3e8752fb..c8fb94af 100644 --- a/.example-env +++ b/.example-env @@ -16,3 +16,16 @@ SSO_KEY # for a uniq ordered list of env vars: ## grep -rIsoh -P "(?<=ENV)(\.fetch\(|\[).[A-Z_]+.(\)|\])" | grep -oP "[A-Z_]+" | sort -u > temp +RUBY_GC_TUNE=0 #set to 1 to enable GC test +RUBY_GC_TOKEN=4f4380fc9a2857d1f008005a3eb86928 +RUBY_GC_HEAP_INIT_SLOTS=186426 +RUBY_GC_HEAP_FREE_SLOTS=559278 +RUBY_GC_HEAP_GROWTH_FACTOR=1.03 +RUBY_GC_HEAP_GROWTH_MAX_SLOTS=74570 +RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.4 +RUBY_GC_MALLOC_LIMIT=32883406 +RUBY_GC_MALLOC_LIMIT_MAX=69055153 +RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.68 +RUBY_GC_OLDMALLOC_LIMIT=32509481 +RUBY_GC_OLDMALLOC_LIMIT_MAX=68269910 +RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=1.4 diff --git a/.gitignore b/.gitignore index 9eded787..c6358ead 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,6 @@ log/*.log tmp .DS_Store +*/.DS_Store +.DS_Store? .vagrant diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..f4597680 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +metamaps_gen002 diff --git a/.ruby-version b/.ruby-version index ac2cdeba..378bc559 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.3 +ruby-2.1.3 diff --git a/Gemfile b/Gemfile index 80ac4f64..4f4b0d73 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'uservoice-ruby' gem 'dotenv' gem 'paperclip' -gem 'aws-sdk' +gem 'aws-sdk', '< 2.0' gem 'jquery-rails' gem 'jquery-ui-rails' @@ -54,4 +54,5 @@ group :development, :test do gem 'better_errors' gem 'binding_of_caller' gem 'quiet_assets' + gem 'tunemygc' end diff --git a/Gemfile.lock b/Gemfile.lock index f8de0ac1..27e9e40f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,12 +37,11 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) - aws-sdk (2.1.32) - aws-sdk-resources (= 2.1.32) - aws-sdk-core (2.1.32) - jmespath (~> 1.0) - aws-sdk-resources (2.1.32) - aws-sdk-core (= 2.1.32) + aws-sdk (1.66.0) + aws-sdk-v1 (= 1.66.0) + aws-sdk-v1 (1.66.0) + json (~> 1.4) + nokogiri (>= 1.4.4) bcrypt (3.1.10) best_in_place (3.0.3) actionpack (>= 3.2) @@ -98,7 +97,6 @@ GEM jbuilder (2.3.2) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - jmespath (1.1.3) jquery-rails (4.0.5) rails-dom-testing (~> 1.0) railties (>= 4.2.0) @@ -213,6 +211,7 @@ GEM thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1) + tunemygc (1.0.61) tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (2.7.2) @@ -229,7 +228,7 @@ PLATFORMS ruby DEPENDENCIES - aws-sdk + aws-sdk (< 2.0) best_in_place better_errors binding_of_caller @@ -256,6 +255,7 @@ DEPENDENCIES redis rspec-rails sass-rails + tunemygc uglifier uservoice-ruby diff --git a/README.md b/README.md index 1e23d33b..4a74151a 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ OR create a new account at `/join`, and use access code `qwertyui` Start mapping and programming! -While we are still figuring out vagrant for Windows, there is an older set of instructions below +We haven't figured out Vagrant for Windows yet, but we have a set of manual instructions here: + - [For Windows][windows-installation] ## Contributing @@ -72,6 +73,6 @@ Copyright (c) 2015 Connor Turland [site-beta]: http://metamaps.cc [community]: https://plus.google.com/u/0/communities/115060009262157699234 [license]: https://github.com/metamaps/metamaps_gen002/blob/master/LICENSE -[contributing]: https://github.com/metamaps/metamaps_gen002/blob/master/CONTRIBUTING.md -[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/master/CONTRIBUTING.md#reporting-bugs-and-other-issues -[windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/master/WindowsInstallation.md +[contributing]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/CONTRIBUTING.md +[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/CONTRIBUTING.md#reporting-bugs-and-other-issues +[windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/WindowsInstallation.md diff --git a/WindowsInstallation.md b/WindowsInstallation.md deleted file mode 100644 index 42364b44..00000000 --- a/WindowsInstallation.md +++ /dev/null @@ -1,49 +0,0 @@ -First off, Metamaps runs on Ruby On Rails. Ruby 2.1.3 and Rails 3.2. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/ - -You'll also need GIT: http://git-scm.com/download/win - -It uses postgreSQL 9.2 as a database. You can install that for your computer from here: http://www.enterprisedb.com/products-services-training/pgdownload . During installation you can choose whatever database password you like. Make sure to note it down! - -Once you install those, open a 'command prompt with ruby'. - -to install rails - gem install rails -v 3.2 - -also download node.js, which is also needed http://nodejs.org/download/ - -Navigate to the folder that you want to download the metamaps files to and run the following: (use your forked git repository address if it's different than this repo. You will also need to go to your Github account settings and add the SSH key that was placed in your clipboard earlier) - - git clone https://github.com/metamaps/metamaps_gen002.git --branch develop - cd metamaps_gen002 - -Now you're in the main directory. - -Install all the gems needed for Metamaps by running - - bundle install - -Setting up the database: - -1) Copy /config/database.yml.default and rename the copy to /config/database.yml then edit database.yml with your text editor and set the password to whatever you chose when you set up the PostGres database. - -2) In a terminal: - - rake db:create - rake db:schema:load - rake db:fixtures:load - -Running the server: - - rails s - -Navigate your browser to localhost:3000 once you have the server running - -Sign in with the default account - -email: user@user.com - -password: toolsplusconsciousness - -OR create a new account at /join, and use access code 'qwertyui' - -Start mapping and programming! diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb index 5c575e88..2e17ffae 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb @@ -459,7 +459,7 @@ Metamaps.GlobalUI.Search = { $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({ width: '0' }, 300, function () { - $('.sidebarSearchField').typeahead('setQuery', ''); + $('.sidebarSearchField').typeahead('val', ''); $('.sidebarSearchField').blur(); self.changing = false; self.isOpen = false; @@ -477,95 +477,109 @@ Metamaps.GlobalUI.Search = { var topics = { name: 'topics', limit: 9999, - dupChecker: function (datum1, datum2) { - return false; - }, - template: $('#topicSearchTemplate').html(), - remote: { - url: '/search/topics?term=%QUERY', - replace: function () { - var q = '/search/topics?term=' + $('.sidebarSearchField').val(); - if (Metamaps.Active.Mapper && $("#limitTopicsToMe").is(':checked')) { - q += "&user=" + Metamaps.Active.Mapper.id.toString(); - } - return q; + + display: function(s) { return s.label; }, + templates: { + notFound: function(s) { + return Hogan.compile($('#topicSearchTemplate').html()).render({ + value: "No results", + label: "No results", + typeImageURL: "<%= asset_path('icons/wildcard.png') %>", + rtype: "noresult" + }); + }, + header: topicheader, + suggestion: function(s) { + return Hogan.compile($('#topicSearchTemplate').html()).render(s); }, - filter: function (dataset) { - if (dataset.length == 0) { - dataset.push({ - value: "No results", - label: "No results", - typeImageURL: "<%= asset_path('icons/wildcard.png') %>", - rtype: "noresult" - }); - } - return dataset; - } }, - engine: Hogan, - header: topicheader + source: new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: { + url: '/search/topics', + prepare: function(query, settings) { + settings.url += '?term=' + query; + if (Metamaps.Active.Mapper && $("#limitTopicsToMe").is(':checked')) { + settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); + } + return settings; + }, + }, + }), }; var maps = { name: 'maps', limit: 9999, - dupChecker: function (datum1, datum2) { - return false; - }, - template: $('#mapSearchTemplate').html(), - remote: { - url: '/search/maps?term=%QUERY', - replace: function () { - var q = '/search/maps?term=' + $('.sidebarSearchField').val(); - if (Metamaps.Active.Mapper && $("#limitMapsToMe").is(':checked')) { - q += "&user=" + Metamaps.Active.Mapper.id.toString(); - } - return q; + display: function(s) { return s.label; }, + templates: { + notFound: function(s) { + return Hogan.compile($('#mapSearchTemplate').html()).render({ + value: "No results", + label: "No results", + rtype: "noresult" + }); + }, + header: mapheader, + suggestion: function(s) { + return Hogan.compile($('#mapSearchTemplate').html()).render(s); }, - filter: function (dataset) { - if (dataset.length == 0) { - dataset.push({ - value: "No results", - label: "No results", - rtype: "noresult" - }); - } - return dataset; - } }, - engine: Hogan, - header: mapheader + source: new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: { + url: '/search/maps', + prepare: function(query, settings) { + settings.url += '?term=' + query; + if (Metamaps.Active.Mapper && $("#limitMapsToMe").is(':checked')) { + settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); + } + return settings; + }, + }, + }), }; var mappers = { name: 'mappers', limit: 9999, - dupChecker: function (datum1, datum2) { - return false; + display: function(s) { return s.label; }, + templates: { + notFound: function(s) { + return Hogan.compile($('#mapperSearchTemplate').html()).render({ + value: "No results", + label: "No results", + rtype: "noresult", + profile: "<%= asset_path('user.png') %>", + }); + }, + header: mapperheader, + suggestion: function(s) { + return Hogan.compile($('#mapperSearchTemplate').html()).render(s); + }, }, - template: $('#mapperSearchTemplate').html(), - remote: { - url: '/search/mappers?term=%QUERY', - filter: function (dataset) { - if (dataset.length == 0) { - dataset.push({ - profile: "<%= asset_path('user.png') %>", - - value: "No results", - label: "No results", - rtype: "noresult" - }); - } - return dataset; - } - }, - engine: Hogan, - header: mapperheader + source: new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: { + url: '/search/mappers?term=%QUERY', + wildcard: '%QUERY', + }, + }), }; - $('.sidebarSearchField').typeahead([topics, maps, mappers]); + + // Take all that crazy setup data and put it together into one beautiful typeahead call! + $('.sidebarSearchField').typeahead( + { + highlight: true, + }, + [topics, maps, mappers] + ); //Set max height of the search results box to prevent it from covering bottom left footer - $('.sidebarSearchField').bind('typeahead:suggestionsRendered', function (event) { + $('.sidebarSearchField').bind('typeahead:render', function (event) { self.initSearchOptions(); self.hideLoader(); var h = $(window).height(); @@ -577,7 +591,7 @@ Metamaps.GlobalUI.Search = { }); // tell the autocomplete to launch a new tab with the topic, map, or mapper you clicked on - $('.sidebarSearchField').bind('typeahead:selected', self.handleResultClick); + $('.sidebarSearchField').bind('typeahead:select', self.handleResultClick); // don't do it, if they clicked on a 'addToMap' button $('.sidebarSearch button.addToMap').click(function (event) { @@ -585,7 +599,7 @@ Metamaps.GlobalUI.Search = { }); // make sure that when you click on 'limit to me' or 'toggle section' it works - $('.sidebarSearchField').bind('typeahead:queryChanged', function(){ + $('.sidebarSearchField').bind('typeahead:change', function(){ if ($(this).val() === "") { self.hideLoader(); } @@ -635,7 +649,7 @@ Metamaps.GlobalUI.Search = { $('.limitToMe').unbind().bind("change", function (e) { // set the value of the search equal to itself to retrigger the autocomplete event self.isOpen = false; - $('.sidebarSearchField').typeahead('setQuery', $('.sidebarSearchField').val()); + $('.sidebarSearchField').typeahead('val', $('.sidebarSearchField').val()); setTimeout(function () { self.isOpen = true; }, 2000); diff --git a/app/assets/javascripts/src/Metamaps.js.erb b/app/assets/javascripts/src/Metamaps.js.erb index 84fd38bc..33cb15ef 100644 --- a/app/assets/javascripts/src/Metamaps.js.erb +++ b/app/assets/javascripts/src/Metamaps.js.erb @@ -656,7 +656,7 @@ Metamaps.Create = { self.newSelectedMetacodeNames = self.selectedMetacodeNames.slice(0); self.newSelectedMetacodes = self.selectedMetacodes.slice(0); } - $('#metacodeSwitchTabs').tabs("select", self.selectedMetacodeSetIndex); + $('#metacodeSwitchTabs').tabs("option", "active", self.selectedMetacodeSetIndex); $('#topic_name').focus(); }, newTopic: { @@ -3300,26 +3300,34 @@ Metamaps.Filter = { // the first option enables us to accept // ['Topics', 'Synapses'] as 'collection' if (typeof collection === "object") { - Metamaps[collection[0]].each(function(model) { - var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; - if (prop && newList.indexOf(prop) === -1) { - newList.push(prop); - } - }); - Metamaps[collection[1]].each(function(model) { - var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; - if (prop && newList.indexOf(prop) === -1) { - newList.push(prop); - } - }); - } - else if (typeof collection === "string") { - Metamaps[collection].each(function(model) { - var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; - if (prop && newList.indexOf(prop) === -1) { - newList.push(prop); - } - }); + Metamaps[collection[0]].each(function(model) { + var prop = model.get(propertyToCheck); + if (prop !== null) { + prop = prop.toString(); + if (newList.indexOf(prop) === -1) { + newList.push(prop); + } + } + }); + Metamaps[collection[1]].each(function(model) { + var prop = model.get(propertyToCheck); + if (prop !== null) { + prop = prop.toString(); + if (newList.indexOf(prop) === -1) { + newList.push(prop); + } + } + }); + } else if (typeof collection === "string") { + Metamaps[collection].each(function(model) { + var prop = model.get(propertyToCheck); + if (prop !== null) { + prop = prop.toString(); + if (newList.indexOf(prop) === -1) { + newList.push(prop); + } + } + }); } removed = _.difference(self.filters[filtersToUse], newList); diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index b671dd80..6c036de1 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -2146,6 +2146,7 @@ and it won't be important on password protected instances */ display: block; width: 100%; padding: 4px 0 !important; + outline: none; } .ui-tabs-vertical .ui-tabs-panel { padding: 0 !important; @@ -2182,6 +2183,7 @@ and it won't be important on password protected instances */ } #metacodeSwitchTabs li.ui-state-active a { color: #00BCD4; + cursor: pointer; } .metacodeSwitchTab { max-height: 300px; diff --git a/app/assets/stylesheets/clean.css.erb b/app/assets/stylesheets/clean.css.erb index 94164b6b..8c3bd7dd 100644 --- a/app/assets/stylesheets/clean.css.erb +++ b/app/assets/stylesheets/clean.css.erb @@ -150,470 +150,6 @@ height: 32px; } -/* search */ - -.sidebarSearch { - float:left; - height: 32px; - position: relative; -} - -#searchLoading { - height: 24px; - width: 24px; - position: absolute; - top: 4px; - right: 76px; - display: none; -} - -.unauthenticated .homePage .sidebarSearchIcon { - border-radius: 2px; -} -.sidebarSearchIcon { - float: left; - width: 72px; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; - height: 32px; - background: #4fb5c0 url(<%= asset_data_uri('search.png') %>) no-repeat center center; - background-size: 32px 32px; - cursor: pointer; -} -.sidebarSearch .twitter-typeahead, .sidebarSearch .sidebarSearchField { - float: left; -} - -.unauthenticated .homePage .sidebarSearchField, -.unauthenticated .homePage .sidebarSearch .tt-hint { - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; -} -.explorePage .sidebarSearchField, -.explorePage .sidebarSearch .tt-hint { - width: 380px; - padding: 5px 10px 5px 10px; -} - -.sidebarSearchField { - color: #424242; -} -.sidebarSearch .tt-hint { - color: transparent; -} -.sidebarSearchField, -.sidebarSearch .tt-hint { - height: 20px; - border-top: 1px solid #BDBDBD; - border-bottom: 1px solid #BDBDBD; - border-left: none; - border-right: none; - padding: 5px 0 5px 0; - width: 0px; - margin: 0; - outline: none; - font-size: 14px; - line-height: 14px; - background: #F5F5F5; - font-family: 'din-medium', helvetica, sans-serif; -} -.sidebarSearch .tt-dropdown-menu { - top: 40px !important; - background: #F5F5F5; - width: 472px; - overflow-y: auto; - overflow-x: visible; - box-shadow: 0 10px 10px rgba(0,0,0,0.19), 0 6px 3px rgba(0,0,0,0.23); -} - -.autoOptions #mapContribs { - width: 15px; - height: 15px; - border: 1px solid #424242; - margin-top: 4px; - margin-left: 4px; -} - -.mapContributorsIcon span { - margin-left: 5px; -} - -.mapContributorsIcon li span { - margin-left: 10px; -} - - -.searchHeader { - height: 42px; - width: 100%; - position: relative; -} -.searchTopicsHeader { - background: #4fc4a8; -} -.searchMapsHeader { - background: #994fc0; -} -.searchMappersHeader { - background: #c04f4f; -} -.sidebarSearch .tt-dropdown-menu h3 { - text-transform: uppercase; - color: #F5F5F5; - font-size: 18px; - line-height: 18px; - margin: 12px 0 3px 16px; - float: left; -} -.sidebarSearch .tt-dropdown-menu .limitToMe { - float: left; - width: 12px; - height: 12px; - border: 1px; - color: #000000; - position: absolute; - top: 15px; - left: 136px; -} -.sidebarSearch .tt-dropdown-menu .limitToMeLabel { - float: left; - font-family: 'din-medium', helvetica, sans-serif; - font-size: 12px; - color: #f5f5f5; - margin: 0; - position: absolute; - top: 15px; - left: 156px; -} -.sidebarSearch .tt-dropdown-menu .minimizeResults, .sidebarSearch .tt-dropdown-menu .maximizeResults { - width: 32px; - height: 32px; - background-image: url(<%= asset_data_uri('arrowpermswhite_sprite.png') %>); - background-repeat: no-repeat; - cursor: pointer; - position: absolute; - top: 5px; - left: 410px; -} -.sidebarSearch .tt-dropdown-menu .minimizeResults { - background-position: 0 0; -} -.sidebarSearch .tt-dropdown-menu .maximizeResults { - background-position: -32px 0; -} -.sidebarSearch .tt-dataset { - overflow: visible; -} -.sidebarSearch .tt-suggestion { - position: relative; - background: #FFF; - padding: 8px 0; -} -.sidebarSearch .tt-is-under-cursor, -.sidebarSearch .tt-suggestion:hover { - background: #E0E0E0; -} - -.resultmap, .resulttopic, .resultmapper, .resultnoresult { - min-height: 48px; - display: table; -} -/*.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap, -.sidebarSearch .tt-dataset-maps .tt-is-under-mouse-cursor .resultmap, -.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic, -.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .resulttopic { - min-height: 48px; -}*/ -.sidebarSearch .tt-suggestion .searchResIconWrapper { - display: table-cell; - vertical-align: middle; - height: 32px; - padding: 0 18px 0 28px; -} -.sidebarSearch .tt-suggestion .icon { - width: 32px; - height: 32px; - border-radius:16px; -} -.sidebarSearch .topicMetacode { - display: table-cell; - vertical-align: middle; - padding: 0 0 0 8px; - width: 70px; -} -.sidebarSearch .tt-dataset-topics .topicIcon { - width: 32px; - height: 32px; - margin: 0 auto; -} -.sidebarSearch .tt-dataset-topics .metacodeTip { - display: none; - margin: 0 auto; -} -.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .metacodeTip, -.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .metacodeTip { - display: block; - font-family: 'vinyl'; - text-transform: uppercase; - font-style: italic; - font-size: 13px; - margin: 0 5px 0 2px; - text-align: center; -} -.sidebarSearch .tt-dataset-mappers .tt-suggestion .icon { - margin: 0px 0px 0px 0px; -} -.sidebarSearch .tt-dataset-mappers .resultText { - width: 150px; -} - -.sidebarSearch .resultText { - width: 260px; - display: table-cell; - padding-left: 8px; - vertical-align: middle; - word-wrap: break-word; -} -.sidebarSearch .resultTitle { - font-weight: normal; - font-size: 16px; - line-height: 20px; - width: 100%; - font-family: 'din-regular', helvetica, sans-serif; -} -.sidebarSearch .resultDesc { - font-size: 12px; - line-height: 16px; - width: 100%; - font-style: italic; - font-family: helvetica, sans-serif; -} -.sidebarSearch .tip { - display: none; -} -.sidebarSearch div.autoOptions { - width: 114px; - height: 48px; - position: absolute; - display: none; - top: 8px; - right: 0; -} -.tt-dataset-maps div.autoOptions { - width: 84px; -} -.sidebarSearch .tt-dataset-mappers .autoOptions { - width: 235px; -} -.sidebarSearch .tt-is-under-cursor .autoOptions, -.sidebarSearch .tt-is-under-mouse-cursor .autoOptions { - display: block; -} -.sidebarSearch .tt-suggestion .resultnoresult .autoOptions { - display: none; -} -.sidebarSearch .autoOptions button, -.sidebarSearch .autoOptions a, -.sidebarSearch .autoOptions div { - position: absolute; - padding: 0; - margin: 0; - border: none; - outline: none; -} -.sidebarSearch button.addToMap { - display:none; - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('addtopic_sprite.png') %>); - background-repeat: no-repeat; - background-size: 48px 24px; - top: 12px; - left: 80px; - cursor: pointer; -} -.canEditMap button.addToMap { - display: block; -} -.sidebarSearch button.addToMap:hover { - background-position: -24px; -} - -.sidebarSearch div.topicCount { - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('topic16.png') %>); - background-repeat: no-repeat; - background-position: 0 center; - top: 0; - left: 0; - padding-left: 18px; - font-size: 12px; - line-height: 24px; -} - -.sidebarSearch div.mapCount { - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('metamap16.png') %>); - background-repeat: no-repeat; - background-position: 0 center; - left: 0; - padding-left: 20px; - font-size: 12px; - line-height: 24px; -} -.sidebarSearch div.synapseCount { - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('synapse16.png') %>); - background-repeat: no-repeat; - background-position: 0 center; - top: 24px; - left: 0; - padding-left: 20px; - font-size: 12px; - line-height: 24px; -} -.sidebarSearch div.topicOriginatorIcon { - width: 18px; - height: 18px; - padding: 3px; - top: 0; - left: 44px; -} -.sidebarSearch .topicOriginatorIcon img { - border-radius: 9px; -} - -.sidebarSearch .topicOriginatorIcon .tip { - right: 30px; - top: 1px; -} -.sidebarSearch .tip { - position: absolute; - background: #424242; - width: auto; - top: 2px; - right: 25px; - color: white; - white-space: nowrap; - border-radius: 2px; - font-size: 12px !important; - font-family: 'din-regular'; - line-height: 12px; - padding: 4px 4px 4px; - z-index: 100; -} -.sidebarSearch .hoverForTip:hover .tip { - display: block; -} - -.sidebarSearch .mapContributorsIcon .tip { - right: 40px; - top: -5px; - padding-top: 5px; - padding-bottom: 5px; -} - -.sidebarSearch .hoverForTip .tip li { - padding-left: 28px; - padding-top: 4px; -} - -.tipUserImage { - position: absolute; - top: 0px; - left: 7px; - border-radius: 14px; -} - -.sidebarSearch .hoverForTip .tip:before { - content: ''; - position: absolute; - width: 0; - height: 0; - border-left: 4px solid #424242; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; -} - -.sidebarSearch .hoverForTip.addToMap .tip { - right: 30px; -} -.sidebarSearch .hoverForTip.addToMap .tip:before { - right: -4px; -} - -.sidebarSearch .mapContributorsIcon .tip:before { - top: 12px; - right: -4px; -} - -.sidebarSearch .topicOriginatorIcon .tip:before { - top: 5px; - right: -4px; -} - -.sidebarSearch .mapContributorsIcon .mapContributors { - top: auto; - right: 0; - bottom: 21px; - white-space: normal; - width: 200px; -} -.sidebarSearch div.mapContributorsIcon { - height: 24px; - top: 0; - left: 44px; - font-size: 12px; - line-height: 24px; -} -.sidebarSearch div.topicPermission, -.sidebarSearch div.mapPermission { - width: 24px; - height: 24px; - background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>); - background-repeat: no-repeat; - background-size: 72px 48px !important; - top: 24px; - left: 44px; -} -.sidebarSearch div.topicPermission.commons, -.sidebarSearch div.mapPermission.commons { - background-position: 0 0; -} -.sidebarSearch div.topicPermission.public, -.sidebarSearch div.mapPermission.public { - background-position: -48px 0; -} -.sidebarSearch div.topicPermission.private, -.sidebarSearch div.mapPermission.private { - background-position: -24px 0; -} - -.sidebarSearch .tt-dataset-mappers div.mapCount { - top: 8px; - left: 170px; -} -.sidebarSearch .tt-dataset-mappers div.mapperCreated { - left: 0px; - padding-left: 0px; - font-size: 12px; - font-family: 'din-medium', helvetica, sans-serif; - line-height: 24px; -} -.sidebarSearch .tt-dataset-mappers div.mapperGeneration { - top: 20px; - left: 0px; - padding-left: 0px; - font-size: 12px; - font-family: 'din-medium', helvetica, sans-serif; - line-height: 24px; -} - -/* end search */ - /* end upperLeftUI */ /* upperRightUI */ diff --git a/app/assets/stylesheets/jquery.mCustomScrollbar.css b/app/assets/stylesheets/jquery.mCustomScrollbar.css.erb similarity index 96% rename from app/assets/stylesheets/jquery.mCustomScrollbar.css rename to app/assets/stylesheets/jquery.mCustomScrollbar.css.erb index f799cdc4..e8588f35 100644 --- a/app/assets/stylesheets/jquery.mCustomScrollbar.css +++ b/app/assets/stylesheets/jquery.mCustomScrollbar.css.erb @@ -162,7 +162,6 @@ .mCSB_scrollTools .mCSB_buttonDown, .mCSB_scrollTools .mCSB_buttonLeft, .mCSB_scrollTools .mCSB_buttonRight{ - background-image:url(<%= asset_data_uri('mCSB_buttons.png') %>); background-repeat:no-repeat; opacity:0.4; filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */ diff --git a/app/assets/stylesheets/search.scss.erb b/app/assets/stylesheets/search.scss.erb new file mode 100644 index 00000000..607a561f --- /dev/null +++ b/app/assets/stylesheets/search.scss.erb @@ -0,0 +1,498 @@ +#searchLoading { + height: 24px; + width: 24px; + position: absolute; + top: 4px; + right: 76px; + display: none; +} + +.unauthenticated { + .homePage .sidebarSearchIcon { + border-radius: 2px; + } + + .homePage .sidebarSearchField, + .homePage .sidebarSearch .tt-hint { + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; + } +} + +.explorePage .sidebarSearchField, +.explorePage .sidebarSearch .tt-hint { + width: 380px; + padding: 5px 10px 5px 10px; +} + +.sidebarSearchIcon { + float: left; + width: 72px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; + height: 32px; + background: #4fb5c0 url(<%= asset_data_uri('search.png') %>) no-repeat center center; + background-size: 32px 32px; + cursor: pointer; +} + +.autoOptions #mapContribs { + width: 15px; + height: 15px; + border: 1px solid #424242; + margin-top: 4px; + margin-left: 4px; +} + +.mapContributorsIcon span { + margin-left: 5px; +} + +.mapContributorsIcon li span { + margin-left: 10px; +} + +.searchHeader { + height: 42px; + width: 100%; + position: relative; +} +.searchTopicsHeader { + background: #4fc4a8; +} +.searchMapsHeader { + background: #994fc0; +} +.searchMappersHeader { + background: #c04f4f; +} + +.resultmap, .resulttopic, .resultmapper, .resultnoresult { + min-height: 48px; + display: table; + width: 100%; +} + +.canEditMap button.addToMap { + display: block; +} + +.tipUserImage { + position: absolute; + top: 0px; + left: 7px; + border-radius: 14px; +} + +/* main search selector */ + +.sidebarSearch { + float:left; + height: 32px; + position: relative; + + .twitter-typeahead { + float: left; + } + + .sidebarSearchField { + float: left; + height: 20px; + border-top: 1px solid #BDBDBD; + border-bottom: 1px solid #BDBDBD; + border-left: none; + border-right: none; + padding: 5px 0 5px 0; + width: 0px; + margin: 0; + outline: none; + font-size: 14px; + line-height: 14px; + background: #F5F5F5; + font-family: 'din-medium', helvetica, sans-serif; + color: #424242; + } + + .tt-hint { + color: transparent; + height: 20px; + border-top: 1px solid #BDBDBD; + border-bottom: 1px solid #BDBDBD; + border-left: none; + border-right: none; + padding: 5px 0 5px 0; + width: 0px; + margin: 0; + outline: none; + font-size: 14px; + line-height: 14px; + background: #F5F5F5; + font-family: 'din-medium', helvetica, sans-serif; + } + + .tt-menu { + top: 40px !important; + background: #F5F5F5; + width: 472px; + overflow-y: auto; + overflow-x: visible; + box-shadow: 0 10px 10px rgba(0,0,0,0.19), 0 6px 3px rgba(0,0,0,0.23); + + h3 { + text-transform: uppercase; + color: #F5F5F5; + font-size: 18px; + line-height: 18px; + margin: 12px 0 3px 16px; + float: left; + } + + .limitToMe { + float: left; + width: 12px; + height: 12px; + border: 1px; + color: #000000; + position: absolute; + top: 15px; + left: 136px; + } + + .limitToMeLabel { + float: left; + font-family: 'din-medium', helvetica, sans-serif; + font-size: 12px; + color: #f5f5f5; + margin: 0; + position: absolute; + top: 15px; + left: 156px; + } + + .minimizeResults, + .maximizeResults { + width: 32px; + height: 32px; + background-image: url(<%= asset_data_uri('arrowpermswhite_sprite.png') %>); + background-repeat: no-repeat; + cursor: pointer; + position: absolute; + top: 5px; + left: 410px; + } + .minimizeResults { + background-position: 0 0; + } + .maximizeResults { + background-position: -32px 0; + } + }/* tt-menu */ + + .tt-suggestion { + position: relative; + background: #FFF; + padding: 8px 0; + + > div { + display: table-cell; + } + + &:hover { + background: #E0E0E0; + } + .icon { + width: 32px; + height: 32px; + border-radius:16px; + } + .resultText { + width: 260px; + padding-left: 8px; + vertical-align: middle; + word-wrap: break-word; + } + .resultTitle { + font-weight: normal; + font-size: 16px; + line-height: 20px; + width: 100%; + font-family: 'din-regular', helvetica, sans-serif; + } + .resultDesc { + font-size: 12px; + line-height: 16px; + width: 100%; + font-style: italic; + font-family: helvetica, sans-serif; + } + + .topicMetacode, + .searchResIconWrapper { + vertical-align: middle; + padding: 0 0 0 8px; + width: 70px; + } + }/* tt-suggestion */ + + .tt-dataset { + overflow: visible; + } + + .tt-dataset-maps { + .autoOptions { + width: 84px; + } + }/* .tt-dataset-maps */ + + .tt-dataset-topics { + .topicIcon { + width: 32px; + height: 32px; + margin: 0 auto; + } + .metacodeTip { + display: none; + margin: 0 auto; + } + .tt-cursor .metacodeTip, + .tt-suggestion:hover .metacodeTip { + display: block; + font-family: 'vinyl'; + text-transform: uppercase; + font-style: italic; + font-size: 13px; + margin: 0 5px 0 2px; + text-align: center; + } + }/* tt-dataset-topics */ + + .tt-dataset-mappers { + .icon { + margin: 0px 0px 0px 0px; + } + .mappers .resultText { + width: 150px; + } + .autoOptions { + width: 235px; + } + .mapCount { + top: 8px; + left: 170px; + } + .mapperCreated { + left: 0px; + padding-left: 0px; + font-size: 12px; + font-family: 'din-medium', helvetica, sans-serif; + line-height: 24px; + } + .mapperGeneration { + top: 20px; + left: 0px; + padding-left: 0px; + font-size: 12px; + font-family: 'din-medium', helvetica, sans-serif; + line-height: 24px; + } + }/* tt-dataset-mappers */ + + .autoOptions { + width: 114px; + height: 48px; + position: absolute; + display: none; + top: 8px; + right: 0; + + a, + div, + button { + position: absolute; + margin: 0; + border: none; + outline: none; + } + }/* .autoOptions */ + + .tt-cursor .autoOptions, + .tt-suggestion:hover .autoOptions { + display: block; + } + .tt-suggestion .resultnoresult .autoOptions { + display: none; + } + + .addToMap { + display:none; + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('addtopic_sprite.png') %>); + background-repeat: no-repeat; + background-size: 48px 24px; + top: 12px; + left: 80px; + cursor: pointer; + + &:hover { + background-position: -24px; + } + }/* .addToMap */ + + .topicCount { + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('topic16.png') %>); + background-repeat: no-repeat; + background-position: 0 center; + top: 0; + left: 0; + padding-left: 18px; + font-size: 12px; + line-height: 24px; + } + + .mapCount { + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('metamap16.png') %>); + background-repeat: no-repeat; + background-position: 0 center; + left: 0; + padding-left: 20px; + font-size: 12px; + line-height: 24px; + } + + .synapseCount { + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('synapse16.png') %>); + background-repeat: no-repeat; + background-position: 0 center; + top: 24px; + left: 0; + padding-left: 20px; + font-size: 12px; + line-height: 24px; + } + + .tip { + display: none; + position: absolute; + background: #424242; + width: auto; + top: 2px; + right: 25px; + color: white; + white-space: nowrap; + border-radius: 2px; + font-size: 12px !important; + font-family: 'din-regular'; + line-height: 12px; + padding: 4px 4px 4px; + z-index: 100; + } + + .topicOriginatorIcon { + width: 18px; + height: 18px; + padding: 3px; + top: 0; + left: 44px; + + img { + border-radius: 9px; + } + + .tip { + right: 30px; + top: 1px; + } + + .tip:before { + top: 5px; + right: -4px; + } + }/* .topicOriginatorIcon */ + + .mapContributorsIcon .tip { + right: 40px; + top: -5px; + padding-top: 5px; + padding-bottom: 5px; + } + + .hoverForTip{ + &:hover .tip { + display: block; + } + + .tip li { + padding-left: 28px; + padding-top: 4px; + } + + .tip:before { + content: ''; + position: absolute; + width: 0; + height: 0; + border-left: 4px solid #424242; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + } + + .tip { + right: 30px; + } + .tip:before { + right: -4px; + } + }/* .hoverForTip */ + + .mapContributorsIcon { + height: 24px; + top: 0; + left: 44px; + font-size: 12px; + line-height: 24px; + + .tip:before { + top: 12px; + right: -4px; + } + + .mapContributors { + top: auto; + right: 0; + bottom: 21px; + white-space: normal; + width: 200px; + } + }/* .mapContributorsIcon */ + + .topicPermission, + .mapPermission { + width: 24px; + height: 24px; + background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>); + background-repeat: no-repeat; + background-size: 72px 48px !important; + top: 24px; + left: 44px; + + .commons, + .commons { + background-position: 0 0; + } + .public, + .public { + background-position: -48px 0; + } + .private, + .private { + background-position: -24px 0; + } + }/* .topicPermission, .mapPermission */ +}/* .sidebarSearch */ diff --git a/app/assets/stylesheets/uservoice.css.erb b/app/assets/stylesheets/uservoice.css.erb index df15d675..f633c367 100644 --- a/app/assets/stylesheets/uservoice.css.erb +++ b/app/assets/stylesheets/uservoice.css.erb @@ -6,7 +6,7 @@ } div.uv-icon.uv-bottom-left { - background-image:url(<%= asset_data_uri 'feedback_sprite.png' %>); + background-image: url(<%= asset_data_uri 'feedback_sprite.png' %>); background-repeat: no-repeat; color:#FFFFFF; cursor:pointer; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0a3d12ab..4278637f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery + + before_filter :get_invite_link # this is for global login include ContentHelper @@ -47,7 +49,6 @@ private current_user end - def authenticated? current_user end @@ -55,5 +56,11 @@ private def admin? current_user && current_user.admin end - + + def get_invite_link + unsafe_uri = request.env["REQUEST_URI"] + valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ + safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/" + @invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "") + end end diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index c5535276..1cd0f577 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -26,8 +26,6 @@ class MainController < ApplicationController # get /search/topics?term=SOMETERM def searchtopics - @current = current_user - term = params[:term] user = params[:user] ? params[:user] : false @@ -122,15 +120,13 @@ class MainController < ApplicationController end #read this next line as 'delete a topic if its private and you're either 1. logged out or 2. logged in but not the topic creator - @topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) } + @topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && current_user.id != t.user_id)) } render json: autocomplete_array_json(@topics) end # get /search/maps?term=SOMETERM def searchmaps - @current = current_user - term = params[:term] user = params[:user] ? params[:user] : nil @@ -158,15 +154,13 @@ class MainController < ApplicationController end #read this next line as 'delete a map if its private and you're either 1. logged out or 2. logged in but not the map creator - @maps.to_a.delete_if {|m| m.permission == "private" && (!authenticated? || (authenticated? && @current.id != m.user_id)) } + @maps.to_a.delete_if {|m| m.permission == "private" && (!authenticated? || (authenticated? && current_user.id != m.user_id)) } render json: autocomplete_map_array_json(@maps) end # get /search/mappers?term=SOMETERM def searchmappers - @current = current_user - term = params[:term] if term && !term.empty? && term.downcase[0..3] != "map:" && term.downcase[0..5] != "topic:" && term.downcase != "mapper:" @@ -182,8 +176,6 @@ class MainController < ApplicationController # get /search/synapses?term=SOMETERM OR # get /search/synapses?topic1id=SOMEID&topic2id=SOMEID def searchsynapses - @current = current_user - term = params[:term] topic1id = params[:topic1id] topic2id = params[:topic2id] @@ -214,7 +206,7 @@ class MainController < ApplicationController #permissions @synapses.delete_if {|s| s.permission == "private" && !authenticated? } - @synapses.delete_if {|s| s.permission == "private" && authenticated? && @current.id != s.user_id } + @synapses.delete_if {|s| s.permission == "private" && authenticated? && current_user.id != s.user_id } else @synapses = [] end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb deleted file mode 100644 index 5fff2f1c..00000000 --- a/app/controllers/registrations_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Users::RegistrationsController < Devise::RegistrationsController - protected - def after_sign_up_path_for(resource) - signed_in_root_path(resource) - end - - def after_update_path_for(resource) - signed_in_root_path(resource) - end -end diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index dc36ff28..2c3c08d0 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -50,8 +50,7 @@ class SynapsesController < ApplicationController # DELETE synapses/:id def destroy - @current = current_user - @synapse = Synapse.find(params[:id]).authorize_to_delete(@current) + @synapse = Synapse.find(params[:id]).authorize_to_delete(current_user) @synapse.delete if @synapse respond_to do |format| diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 5fff2f1c..c77edb50 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,4 +1,7 @@ class Users::RegistrationsController < Devise::RegistrationsController + before_filter :configure_sign_up_params, only: [:create] + before_filter :configure_account_update_params, only: [:update] + protected def after_sign_up_path_for(resource) signed_in_root_path(resource) @@ -7,4 +10,14 @@ class Users::RegistrationsController < Devise::RegistrationsController def after_update_path_for(resource) signed_in_root_path(resource) end + + private + def configure_sign_up_params + devise_parameter_sanitizer.for(:sign_up) << [:name, :joinedwithcode] + end + + def configure_account_update_params + puts devise_parameter_sanitizer_for(:account_update) + devise_parameter_sanitizer.for(:account_update) << [:image] + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 52996f49..bb645614 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,4 @@ class UsersController < ApplicationController - before_filter :require_user, only: [:edit, :update, :updatemetacodes] respond_to :html, :json @@ -14,7 +13,6 @@ class UsersController < ApplicationController # GET /users/:id/edit def edit @user = current_user - respond_with(@user) end @@ -22,9 +20,9 @@ class UsersController < ApplicationController def update @user = current_user - if params[:user][:password] == "" && params[:user][:password_confirmation] == "" + if user_params[:password] == "" && user_params[:password_confirmation] == "" # not trying to change the password - if @user.update_attributes(params[:user]) + if @user.update_attributes(user_params.except(:password, :password_confirmation)) if params[:remove_image] == "1" @user.image = nil end @@ -43,7 +41,7 @@ class UsersController < ApplicationController # trying to change the password correct_pass = @user.valid_password?(params[:current_password]) - if correct_pass && @user.update_attributes(params[:user]) + if correct_pass && @user.update_attributes(user_params) if params[:remove_image] == "1" @user.image = nil end @@ -101,8 +99,7 @@ class UsersController < ApplicationController private def user_params - params.require(:user).permit(:name, :email, :image, :password, - :password_confirmation, :code, :joinedwithcode, :remember_me) + params.require(:user).permit(:name, :email, :image, :password, :password_confirmation) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fa7876f5..3db990db 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,7 +9,7 @@ module ApplicationHelper @m = user.settings.metacodes set = get_metacodeset if set - @metacodes = set.metacodes + @metacodes = set.metacodes.to_a else @metacodes = Metacode.where(id: @m).to_a end diff --git a/app/helpers/maps_helper.rb b/app/helpers/maps_helper.rb index 6b3dd7b0..169ee4b9 100644 --- a/app/helpers/maps_helper.rb +++ b/app/helpers/maps_helper.rb @@ -16,7 +16,7 @@ module MapsHelper map['rtype'] = "map" contributorTip = '' - firstContributorImage = asset_path('user.png') + firstContributorImage = 'https://s3.amazonaws.com/metamaps-assets/site/user.png' if m.contributors.count > 0 firstContributorImage = m.contributors[0].image.url(:thirtytwo) m.contributors.each_with_index do |c, index| diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 977e5709..69335da1 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,22 +1,10 @@ module UsersHelper - - ## this one is for building our custom JSON autocomplete format for typeahead + # build custom json autocomplete for typeahead def autocomplete_user_array_json(users) - temp = [] - users.each do |u| - user = {} - user['id'] = u.id - user['label'] = u.name - user['value'] = u.name - user['profile'] = u.image.url(:sixtyfour) - user['mapCount'] = u.maps.count - user['generation'] = u.generation - user['created_at'] = u.created_at.strftime("%m/%d/%Y") - user['rtype'] = "mapper" - - temp.push user + json_users = [] + users.each do |user| + json_users.push user.as_json_for_autocomplete end - return temp + json_users end - end diff --git a/app/models/map.rb b/app/models/map.rb index eab88814..e6a10605 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -12,7 +12,7 @@ class Map < ActiveRecord::Base :thumb => ['188x126#', :png] #:full => ['940x630#', :png] }, - :default_url => ActionController::Base.helpers.asset_path('missing-map.png') + :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ diff --git a/app/models/user.rb b/app/models/user.rb index effa6ec5..ce68d61b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,11 +35,12 @@ class User < ActiveRecord::Base :ninetysix => ['96x96#', :png], :onetwentyeight => ['128x128#', :png] }, - :default_url => ActionController::Base.helpers.asset_path('user.png') + :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/user.png' # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ + # override default as_json def as_json(options={}) { :id => self.id, :name => self.name, @@ -47,27 +48,37 @@ class User < ActiveRecord::Base :admin => self.admin } end + + def as_json_for_autocomplete + json = {} + json['id'] = id + json['label'] = name + json['value'] = name + json['profile'] = image.url(:sixtyfour) + json['mapCount'] = maps.count + json['generation'] = generation + json['created_at'] = created_at.strftime("%m/%d/%Y") + json['rtype'] = "mapper" + json + end + #generate a random 8 letter/digit code that they can use to invite people def generate_code - #generate a random 8 letter/digit code that they can use to invite people self.code = rand(36**8).to_s(36) - $codes.push(self.code) - self.generation = self.get_generation end def get_generation - if self.joinedwithcode == self.code - # if your joinedwithcode equals your code you must be GEN 0 - gen = 0 - elsif self.generation - # if your generation has already been calculated then just return that value - gen = self.generation + calculate_generation() if generation.nil? + generation + end + + def calculate_generation + if code == joinedwithcode + update(generation: 0) else - # if your generation hasn't been calculated, base it off the - # generation of the person whose code you joined with + 1 - gen = User.find_by_code(self.joinedwithcode).get_generation + 1 + update(generation: User.find_by_code(joinedwithcode).generation + 1) end end @@ -75,13 +86,12 @@ class User < ActiveRecord::Base # make sure we always return a UserPreference instance if read_attribute(:settings).nil? write_attribute :settings, UserPreference.new - read_attribute :settings - else - read_attribute :settings end + read_attribute :settings end def settings=(val) write_attribute :settings, val end + end diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index e8b688d5..46ab2edf 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -231,9 +231,8 @@

As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.

Below is a personal invite link containing your unique access code, which can be used multiple times.

- <% mapper = current_user %> -

http://metamaps.cc/join?code=<%= mapper.code %>

- +

<%= @invite_link %> +

diff --git a/app/views/shared/_switchmetacodes.html.erb b/app/views/shared/_switchmetacodes.html.erb index 067d4d6b..e0fcd036 100644 --- a/app/views/shared/_switchmetacodes.html.erb +++ b/app/views/shared/_switchmetacodes.html.erb @@ -19,9 +19,9 @@
<% allMetacodeSets.each_with_index do |m, localindex| %>
Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class with default "from" parameter. @@ -124,6 +131,9 @@ Devise.setup do |config| # The time the user will be remembered without asking for credentials again. config.remember_for = 2.weeks + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false @@ -145,9 +155,6 @@ Devise.setup do |config| # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes - # If true, expires auth token on session timeout. - # config.expire_auth_token_on_timeout = false - # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. @@ -155,7 +162,7 @@ Devise.setup do |config| # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account - # config.unlock_keys = [ :email ] + # config.unlock_keys = [:email] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email @@ -171,16 +178,23 @@ Devise.setup do |config| # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account - # config.reset_password_keys = [ :email ] + # config.reset_password_keys = [:email] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 24.hours + # When set to false, does not sign a user in automatically after their password is + # reset. Defaults to true, so a user is signed in automatically after a reset. + # config.sign_in_after_reset_password = true + # ==> Configuration for :encryptable # Allow you to use another encryption algorithm besides bcrypt (default). You can use # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, @@ -189,10 +203,6 @@ Devise.setup do |config| # REST_AUTH_SITE_KEY to pepper) # config.encryptor = :sha512 - # ==> Configuration for :token_authenticatable - # Defines name of the authentication token params key - # config.token_authentication_key = :auth_token - # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you @@ -240,12 +250,12 @@ Devise.setup do |config| # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # - # mount MyEngine, at: "/my_engine" + # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # - # When using omniauth, Devise cannot automatically set Omniauth path, + # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: - # config.omniauth_path_prefix = "/my_engine/users/auth" + # config.omniauth_path_prefix = '/my_engine/users/auth' end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index d01f375c..26a10f29 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -3,49 +3,50 @@ en: devise: confirmations: - confirmed: "Your account was successfully confirmed. You are now signed in." - send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." failure: already_authenticated: "You are already signed in." - inactive: "Your account was not activated yet." - invalid: "Invalid email or password." - invalid_token: "Invalid authentication token." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." locked: "Your account is locked." - not_found_in_database: "Invalid email or password." - timeout: "Your session expired, please sign in again to continue." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." unauthenticated: "You need to sign in or sign up before continuing." - unconfirmed: "You have to confirm your account before continuing." + unconfirmed: "You have to confirm your email address before continuing." mailer: confirmation_instructions: subject: "Confirmation instructions" reset_password_instructions: subject: "Reset password instructions" unlock_instructions: - subject: "Unlock Instructions" + subject: "Unlock instructions" omniauth_callbacks: failure: "Could not authenticate you from %{kind} because \"%{reason}\"." success: "Successfully authenticated from %{kind} account." passwords: no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." - send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." - updated: "Your password was changed successfully. You are now signed in." - updated_not_active: "Your password was changed successfully." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." registrations: - destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." signed_up: "Welcome! You have signed up successfully." signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." - signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." - update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." - updated: "You updated your account successfully." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." + updated: "Your account has been updated successfully." sessions: signed_in: "Signed in successfully." signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." unlocks: - send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." - send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." unlocked: "Your account has been unlocked successfully. Please sign in to continue." errors: messages: diff --git a/config/routes.rb b/config/routes.rb index e80b837a..a3ab6e3a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,7 +26,7 @@ Metamaps::Application.routes.draw do get 'explore/mapper/:id', to: 'maps#index', as: :usermaps resources :maps, except: [:new, :edit] get 'maps/:id/contains', to: 'maps#contains', as: :contains - get 'maps/:id/upload_screenshot', to: 'maps#screenshot', as: :screenshot + post 'maps/:id/upload_screenshot', to: 'maps#screenshot', as: :screenshot devise_for :users, controllers: { registrations: 'users/registrations', passwords: 'users/passwords', sessions: 'devise/sessions' }, :skip => :sessions diff --git a/config/secrets.yml.default b/config/secrets.yml.default deleted file mode 100644 index 6859262d..00000000 --- a/config/secrets.yml.default +++ /dev/null @@ -1,12 +0,0 @@ -defaults: &defaults - missing_map_png_url: '/assets/missing-map.png' - user_png_url: '/assets/user.png' - -development: - <<: *defaults - -test: - <<: *defaults - -production: - <<: *defaults diff --git a/db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb b/db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb deleted file mode 100644 index c5a5e842..00000000 --- a/db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RemoveAssetPathsFromMetacodes < ActiveRecord::Migration - def change - Metacode.all.each do |metacode| - metacode.icon = metacode.icon.gsub(/^\/assets\//, '') - metacode.save - end - end -end diff --git a/db/migrate/20151028061513_metacode_asset_path_update.rb b/db/migrate/20151028061513_metacode_asset_path_update.rb new file mode 100644 index 00000000..be3607d1 --- /dev/null +++ b/db/migrate/20151028061513_metacode_asset_path_update.rb @@ -0,0 +1,9 @@ +class MetacodeAssetPathUpdate < ActiveRecord::Migration + def change + Metacode.all.each do |metacode| + if metacode.icon.start_with?("/assets/icons/") + metacode.update(icon: metacode.icon.gsub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes")) + end + end + end +end diff --git a/db/seeds.rb b/db/seeds.rb index b6bbd9ca..dc1d6906 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,14 +1,7 @@ # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html ## USERS - User.create({ name: 'user', email: 'user@user.com', @@ -26,286 +19,288 @@ User.create({ joinedwithcode: 'iuytrewq', admin: 'true', }) +## END USERS ## METACODES Metacode.create({ name: 'Action', - icon: '/assets/icons/blueprint_96px/bp_action.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png', color: '#BD6C85', }) Metacode.create({ name: 'Activity', - icon: '/assets/icons/blueprint_96px/bp_activity.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_activity.png', color: '#6EBF65', }) Metacode.create({ name: 'Catalyst', - icon: '/assets/icons/blueprint_96px/bp_catalyst.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_catalyst.png', color: '#EF8964', }) Metacode.create({ name: 'Closed', - icon: '/assets/icons/blueprint_96px/bp_closedissue.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_closedissue.png', color: '#ABB49F', }) Metacode.create({ name: 'Process', - icon: '/assets/icons/blueprint_96px/bp_process.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_process.png', color: '#BDB25E', }) Metacode.create({ - name: 'Future Dev', - icon: '/assets/icons/blueprint_96px/bp_futuredev.png', + name: 'Future', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_futuredev.png', color: '#25A17F', }) Metacode.create({ name: 'Group', - icon: '/assets/icons/blueprint_96px/bp_group.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_group.png', color: '#7076BC', }) Metacode.create({ name: 'Implication', - icon: '/assets/icons/blueprint_96px/bp_implication.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_implication.png', color: '#83DECA', }) Metacode.create({ name: 'Insight', - icon: '/assets/icons/blueprint_96px/bp_insight.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_insight.png', color: '#B074AD', }) Metacode.create({ name: 'Intention', - icon: '/assets/icons/blueprint_96px/bp_intention.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_intention.png', color: '#BAEAFF', }) Metacode.create({ name: 'Knowledge', - icon: '/assets/icons/blueprint_96px/bp_knowledge.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_knowledge.png', color: '#60ACF7', }) Metacode.create({ name: 'Location', - icon: '/assets/icons/blueprint_96px/bp_location.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_location.png', color: '#ABD9A7', }) Metacode.create({ - name: 'Need ', - icon: '/assets/icons/blueprint_96px/bp_need.png', + name: 'Need', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_need.png', color: '#D2A7D4', }) Metacode.create({ - name: 'Open Issue', - icon: '/assets/icons/blueprint_96px/bp_openissue.png', + name: 'Open', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_openissue.png', color: '#9BBF71', }) Metacode.create({ name: 'Opportunity', - icon: '/assets/icons/blueprint_96px/bp_opportunity.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_opportunity.png', color: '#889F64', }) Metacode.create({ name: 'Person', - icon: '/assets/icons/blueprint_96px/bp_person.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_person.png', color: '#DE925F', }) Metacode.create({ name: 'Platform', - icon: '/assets/icons/blueprint_96px/bp_platform.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_platform.png', color: '#21C8FE', }) Metacode.create({ name: 'Problem', - icon: '/assets/icons/blueprint_96px/bp_problem.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_problem.png', color: '#99CFC4', }) Metacode.create({ name: 'Resource', - icon: '/assets/icons/blueprint_96px/bp_resource.png', - color: '#C98C63 ', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_resource.png', + color: '#C98C63', }) Metacode.create({ name: 'Role', - icon: '/assets/icons/blueprint_96px/bp_role.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_role.png', color: '#A8595D', }) Metacode.create({ name: 'Task', - icon: '/assets/icons/blueprint_96px/bp_task.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_task.png', color: '#3397C4', }) Metacode.create({ name: 'Trajectory', - icon: '/assets/icons/blueprint_96px/bp_trajectory.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_trajectory.png', color: '#D3AA4C', }) Metacode.create({ name: 'Argument', - icon: '/assets/icons/generics_96px/gen_argument.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_argument.png', color: '#7FAEFD', }) Metacode.create({ name: 'Con', - icon: '/assets/icons/generics_96px/gen_con.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_con.png', color: '#CF7C74', }) Metacode.create({ name: 'Subject', - icon: '/assets/icons/generics_96px/gen_subject.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_subject.png', color: '#8293D8', }) Metacode.create({ name: 'Decision', - icon: '/assets/icons/generics_96px/gen_decision.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_decision.png', color: '#CCA866', }) Metacode.create({ - name: 'Event ', - icon: '/assets/icons/generics_96px/gen_event.png', + name: 'Event', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_event.png', color: '#F5854B', }) Metacode.create({ name: 'Example', - icon: '/assets/icons/generics_96px/gen_example.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_example.png', color: '#618C61', }) Metacode.create({ name: 'Experience', - icon: '/assets/icons/generics_96px/gen_experience.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_experience.png', color: '#BE995F', }) Metacode.create({ name: 'Feedback', - icon: '/assets/icons/generics_96px/gen_feedback.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_feedback.png', color: '#54A19D', }) Metacode.create({ name: 'Aim', - icon: '/assets/icons/generics_96px/gen_aim.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_aim.png', color: '#B0B0B0', }) Metacode.create({ - name: 'Good Practice', - icon: '/assets/icons/generics_96px/gen_goodpractice.png', + name: 'Good', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_goodpractice.png', color: '#BD9E86', }) Metacode.create({ name: 'Idea', - icon: '/assets/icons/generics_96px/gen_idea.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_idea.png', color: '#C4BC5E', }) Metacode.create({ name: 'List', - icon: '/assets/icons/generics_96px/gen_list.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_list.png', color: '#B7A499', }) Metacode.create({ name: 'Media', - icon: '/assets/icons/generics_96px/gen_media.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_media.png', color: '#6D94CC', }) Metacode.create({ name: 'Metamap', - icon: '/assets/icons/generics_96px/gen_metamap.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_metamap.png', color: '#AEA9FD', }) Metacode.create({ name: 'Model', - icon: '/assets/icons/generics_96px/gen_model.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_model.png', color: '#B385BA', }) Metacode.create({ name: 'Note', - icon: '/assets/icons/generics_96px/gen_note.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_note.png', color: '#A389A1', }) Metacode.create({ name: 'Perspective', - icon: '/assets/icons/generics_96px/gen_perspective.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_perspective.png', color: '#2EB6CC', }) Metacode.create({ name: 'Pro', - icon: '/assets/icons/generics_96px/gen_pro.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_pro.png', color: '#89B879', }) Metacode.create({ name: 'Project', - icon: '/assets/icons/generics_96px/gen_project.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_project.png', color: '#85A050', }) Metacode.create({ name: 'Question', - icon: '/assets/icons/generics_96px/gen_question.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_question.png', color: '#5CB3B3', }) Metacode.create({ name: 'Reference', - icon: '/assets/icons/generics_96px/gen_reference.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_reference.png', color: '#A7A7A7', }) Metacode.create({ name: 'Research', - icon: '/assets/icons/generics_96px/gen_research.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_research.png', color: '#CD8E89', }) Metacode.create({ - name: 'Status update', - icon: '/assets/icons/generics_96px/gen_status.png', + name: 'Status', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_status.png', color: '#EFA7C0', }) Metacode.create({ name: 'Tool', - icon: '/assets/icons/generics_96px/gen_tool.png ', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_tool.png', color: '#828282', }) Metacode.create({ name: 'Wildcard', - icon: '/assets/icons/generics_96px/gen_wildcard.png', + icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_wildcard.png', color: '#73C7DE', }) +## END METACODES diff --git a/CHANGELOG.md b/doc/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to doc/CHANGELOG.md diff --git a/CONTRIBUTING.md b/doc/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to doc/CONTRIBUTING.md diff --git a/MacInstallation.md b/doc/MacInstallation.md similarity index 100% rename from MacInstallation.md rename to doc/MacInstallation.md diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP deleted file mode 100644 index fe41f5cc..00000000 --- a/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -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. diff --git a/UbuntuInstallation.md b/doc/UbuntuInstallation.md similarity index 100% rename from UbuntuInstallation.md rename to doc/UbuntuInstallation.md diff --git a/doc/WindowsInstallation.md b/doc/WindowsInstallation.md new file mode 100644 index 00000000..7e601a08 --- /dev/null +++ b/doc/WindowsInstallation.md @@ -0,0 +1,47 @@ +Before you begin, you'll need to install stuff: + +Ruby, Git, and Rails: http://railsinstaller.org/en +PostgreSQL 9.2: http://www.enterprisedb.com/products-services-training/pgdownload +nodejs: http://nodejs.org/download + +During the installation of the PostgreSQL database, you'll need to choose a database password. Anything is fine, just note down what you choose. + +Once you are ready, create a new folder to hold this and any other git repositories. As an example, let's pretend you've chose C:\git, and made that folder writable by your user account. + +Open a command prompt ("cmd.exe"), and navigate to the folder you chose. Then use the gem command (which is part of Ruby) to install Ruby on Rails. + + cd .\git + gem install rails -v 4.2 + +Now you are ready to clone the Metamaps git repository: + + git clone https://github.com/metamaps/metamaps_gen002.git --branch develop + cd metamaps_gen002 + bundle install + +The third `bundle install` command downloads and installs the rubygem dependencies of Metamaps. + +At this point you should be in C:\git\metamaps_gen002, or whatever equivalent directory you've chosen. The next step is to set up your database configuration. From the metamaps_gen002 directory, run + + start config + +This command will open a Windows Explorer window of the "config" directory of Metamaps. Copy database.yml.default, and rename the copy to database.yml. Edit the file and set the password to be whatever you set up with postgres earlier. Once you're done, then move back into the command prompt. The next few commands will fail unless database.yml is correctly configured and Postgres is running. + + rake db:create + rake db:schema:load + rake db:fixtures:load + +And you're set up! At this point, you should be able to run the server at any time with only one command; you don't need to repeat any of the previous steps again. The command to run the server is: + + rails s + +Navigate your browser to localhost:3000 once you have the server running + +Sign in with the default account + + email: user@user.com + password: toolsplusconsciousness + +OR create a new account at /join, and use access code 'qwertyui' + +Start mapping and programming! diff --git a/doc/metamaps-qa-steps.md b/doc/metamaps-qa-steps.md new file mode 100644 index 00000000..a3f136ca --- /dev/null +++ b/doc/metamaps-qa-steps.md @@ -0,0 +1,39 @@ +# Metamaps Tests + +Run these tests to be reasonably sure that your code changes haven't broken anything. + +### Users & Accounts + + - Create an account using your join code + - Log in to the interface + - Check your user's "generation" + - Edit your profile picture, email, name, and password + - Remove your profile picture + +### Maps, Topics, Synapses, and Permissions + + - Create three maps: private, public, and another public + - Change the last map's permissions to commons + - Change a map's name + - Create a topic on map #1 + - Verify (in a private window or another browser) that the second user can't acccess map #1 + - Create a topic on map #2 + - Verify that the second user **can't** edit map #2 + - Create a topic on map #3 + - Verify that the second user **can** edit map #3 + - Pull a topic from map #1 to map #3 + - Create a private topic on map #1 + - Verify that the private topic can be pulled from map #1 by the same user + - Verify that the private topic can't be pulled from map #1 by another user + +### Mappings + + - Add a number of topics to one of your maps. Reload to see if they are still there. + - Add a number of synapses to one of your maps. Reload to see if they are still there. + - Rearrange one of your maps and save the layout. Reload to see if the layout is preserved. + +### Misc + + - Login as admin. Change metacode sets. + - Set the screenshot for one of your maps, and verify the index of maps is updated. + - Open two browsers on map #3 and verify that realtime editing works (you'll need to be running the realtime server for this to work). diff --git a/metamaps-qa-steps.txt b/metamaps-qa-steps.txt deleted file mode 100644 index d7ef5b98..00000000 --- a/metamaps-qa-steps.txt +++ /dev/null @@ -1,27 +0,0 @@ -Metamaps Test Suite - -1) Log in to the interface -2) Create an account using your join code -3) Check your user's "generation" -4) Create three maps: private, public, and another public -5) Change the last map's permissions to commons -6) Change a map's name -7) Create a topic on map #1 -8) Verify (in a private window or another browser) that the second user can't acccess map #1 -9) Create a topic on map #2 -10) Verify that the second user can't edit map #2 -11) Create a topic on map #3 -12) Verify that the second can edit map #3 -13) Pull a topic from map #1 to map #3 -14) Create a private topic on map #1 -15) Verify that the private topic can be pulled from map #1 by the same user -16) Verify that the private topic can't be pulled from map #1 by another user -17) Login as admin. Change metacode sets. -18) Add a number of topics to one of your maps. Reload to see if they are still there. -19) Add a number of synapses to one of your maps. Reload to see if they are still there. -20) Rearrange one of your maps. Reload to see if the layout is preserved. -21) Set the screenshot for one of your maps, and verify the index of maps is updated. -22) Open two browsers on map #3 and verify that realtime editing works. -23) Log in as admin -24) Open the metacodes editor, and create a metacode. Verify it behaves normally (its icon shows up, you can assign it to topics, etc) -25) Create a new metacode set, and include metacodes. Switch to using this metacode set. Ensure the set shows up in the right click menu on a topic diff --git a/public/404.html b/public/404.html index 643a5ded..da435ea6 100644 --- a/public/404.html +++ b/public/404.html @@ -26,7 +26,7 @@ } body { - background: #d8d9da url(/assets/shattered_@2X.png); + background: #d8d9da url(https://s3.amazonaws.com/metamaps-assets/site/shattered_%402X.png); font-family: 'din-regular', helvetica, sans-serif; color: #424242; text-align: justify; @@ -61,7 +61,7 @@ border-radius: 225px; -webkit-border-radius: 225px; -moz-border-radius: 225px; - background: url(/assets/monkeyselfie.jpg) no-repeat; + background: url(https://s3.amazonaws.com/metamaps-assets/site/monkeyselfie.jpg) no-repeat; float: left; background-position:50% 20%; background-size: 100%;