merge develop with rails4 stuff

This commit is contained in:
Devin Howard 2015-12-07 13:58:42 +08:00
commit 1597665be5
45 changed files with 916 additions and 843 deletions

View file

@ -16,3 +16,16 @@ SSO_KEY
# for a uniq ordered list of env vars: # for a uniq ordered list of env vars:
## grep -rIsoh -P "(?<=ENV)(\.fetch\(|\[).[A-Z_]+.(\)|\])" | grep -oP "[A-Z_]+" | sort -u > temp ## 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

2
.gitignore vendored
View file

@ -24,4 +24,6 @@ log/*.log
tmp tmp
.DS_Store .DS_Store
*/.DS_Store
.DS_Store?
.vagrant .vagrant

1
.ruby-gemset Normal file
View file

@ -0,0 +1 @@
metamaps_gen002

View file

@ -1 +1 @@
2.1.3 ruby-2.1.3

View file

@ -17,7 +17,7 @@ gem 'uservoice-ruby'
gem 'dotenv' gem 'dotenv'
gem 'paperclip' gem 'paperclip'
gem 'aws-sdk' gem 'aws-sdk', '< 2.0'
gem 'jquery-rails' gem 'jquery-rails'
gem 'jquery-ui-rails' gem 'jquery-ui-rails'
@ -54,4 +54,5 @@ group :development, :test do
gem 'better_errors' gem 'better_errors'
gem 'binding_of_caller' gem 'binding_of_caller'
gem 'quiet_assets' gem 'quiet_assets'
gem 'tunemygc'
end end

View file

@ -37,12 +37,11 @@ GEM
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
arel (6.0.3) arel (6.0.3)
aws-sdk (2.1.32) aws-sdk (1.66.0)
aws-sdk-resources (= 2.1.32) aws-sdk-v1 (= 1.66.0)
aws-sdk-core (2.1.32) aws-sdk-v1 (1.66.0)
jmespath (~> 1.0) json (~> 1.4)
aws-sdk-resources (2.1.32) nokogiri (>= 1.4.4)
aws-sdk-core (= 2.1.32)
bcrypt (3.1.10) bcrypt (3.1.10)
best_in_place (3.0.3) best_in_place (3.0.3)
actionpack (>= 3.2) actionpack (>= 3.2)
@ -98,7 +97,6 @@ GEM
jbuilder (2.3.2) jbuilder (2.3.2)
activesupport (>= 3.0.0, < 5) activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2) multi_json (~> 1.2)
jmespath (1.1.3)
jquery-rails (4.0.5) jquery-rails (4.0.5)
rails-dom-testing (~> 1.0) rails-dom-testing (~> 1.0)
railties (>= 4.2.0) railties (>= 4.2.0)
@ -213,6 +211,7 @@ GEM
thor (0.19.1) thor (0.19.1)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (2.0.1) tilt (2.0.1)
tunemygc (1.0.61)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (2.7.2) uglifier (2.7.2)
@ -229,7 +228,7 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
aws-sdk aws-sdk (< 2.0)
best_in_place best_in_place
better_errors better_errors
binding_of_caller binding_of_caller
@ -256,6 +255,7 @@ DEPENDENCIES
redis redis
rspec-rails rspec-rails
sass-rails sass-rails
tunemygc
uglifier uglifier
uservoice-ruby uservoice-ruby

View file

@ -45,7 +45,8 @@ OR create a new account at `/join`, and use access code `qwertyui`
Start mapping and programming! 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] - [For Windows][windows-installation]
## Contributing ## Contributing
@ -72,6 +73,6 @@ Copyright (c) 2015 Connor Turland
[site-beta]: http://metamaps.cc [site-beta]: http://metamaps.cc
[community]: https://plus.google.com/u/0/communities/115060009262157699234 [community]: https://plus.google.com/u/0/communities/115060009262157699234
[license]: https://github.com/metamaps/metamaps_gen002/blob/master/LICENSE [license]: https://github.com/metamaps/metamaps_gen002/blob/master/LICENSE
[contributing]: https://github.com/metamaps/metamaps_gen002/blob/master/CONTRIBUTING.md [contributing]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/CONTRIBUTING.md
[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/master/CONTRIBUTING.md#reporting-bugs-and-other-issues [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/WindowsInstallation.md [windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/WindowsInstallation.md

View file

@ -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!

View file

@ -459,7 +459,7 @@ Metamaps.GlobalUI.Search = {
$('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({ $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({
width: '0' width: '0'
}, 300, function () { }, 300, function () {
$('.sidebarSearchField').typeahead('setQuery', ''); $('.sidebarSearchField').typeahead('val', '');
$('.sidebarSearchField').blur(); $('.sidebarSearchField').blur();
self.changing = false; self.changing = false;
self.isOpen = false; self.isOpen = false;
@ -477,95 +477,109 @@ Metamaps.GlobalUI.Search = {
var topics = { var topics = {
name: 'topics', name: 'topics',
limit: 9999, limit: 9999,
dupChecker: function (datum1, datum2) {
return false; display: function(s) { return s.label; },
}, templates: {
template: $('#topicSearchTemplate').html(), notFound: function(s) {
remote: { return Hogan.compile($('#topicSearchTemplate').html()).render({
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;
},
filter: function (dataset) {
if (dataset.length == 0) {
dataset.push({
value: "No results", value: "No results",
label: "No results", label: "No results",
typeImageURL: "<%= asset_path('icons/wildcard.png') %>", typeImageURL: "<%= asset_path('icons/wildcard.png') %>",
rtype: "noresult" rtype: "noresult"
}); });
}
return dataset;
}
}, },
engine: Hogan, header: topicheader,
header: topicheader suggestion: function(s) {
return Hogan.compile($('#topicSearchTemplate').html()).render(s);
},
},
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 = { var maps = {
name: 'maps', name: 'maps',
limit: 9999, limit: 9999,
dupChecker: function (datum1, datum2) { display: function(s) { return s.label; },
return false; templates: {
}, notFound: function(s) {
template: $('#mapSearchTemplate').html(), return Hogan.compile($('#mapSearchTemplate').html()).render({
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;
},
filter: function (dataset) {
if (dataset.length == 0) {
dataset.push({
value: "No results", value: "No results",
label: "No results", label: "No results",
rtype: "noresult" rtype: "noresult"
}); });
}
return dataset;
}
}, },
engine: Hogan, header: mapheader,
header: mapheader suggestion: function(s) {
return Hogan.compile($('#mapSearchTemplate').html()).render(s);
},
},
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 = { var mappers = {
name: 'mappers', name: 'mappers',
limit: 9999, limit: 9999,
dupChecker: function (datum1, datum2) { display: function(s) { return s.label; },
return false; templates: {
}, notFound: function(s) {
template: $('#mapperSearchTemplate').html(), return Hogan.compile($('#mapperSearchTemplate').html()).render({
remote: {
url: '/search/mappers?term=%QUERY',
filter: function (dataset) {
if (dataset.length == 0) {
dataset.push({
profile: "<%= asset_path('user.png') %>",
value: "No results", value: "No results",
label: "No results", label: "No results",
rtype: "noresult" rtype: "noresult",
profile: "<%= asset_path('user.png') %>",
}); });
}
return dataset;
}
}, },
engine: Hogan, header: mapperheader,
header: mapperheader suggestion: function(s) {
return Hogan.compile($('#mapperSearchTemplate').html()).render(s);
},
},
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 //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.initSearchOptions();
self.hideLoader(); self.hideLoader();
var h = $(window).height(); 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 // 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 // don't do it, if they clicked on a 'addToMap' button
$('.sidebarSearch button.addToMap').click(function (event) { $('.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 // 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() === "") { if ($(this).val() === "") {
self.hideLoader(); self.hideLoader();
} }
@ -635,7 +649,7 @@ Metamaps.GlobalUI.Search = {
$('.limitToMe').unbind().bind("change", function (e) { $('.limitToMe').unbind().bind("change", function (e) {
// set the value of the search equal to itself to retrigger the autocomplete event // set the value of the search equal to itself to retrigger the autocomplete event
self.isOpen = false; self.isOpen = false;
$('.sidebarSearchField').typeahead('setQuery', $('.sidebarSearchField').val()); $('.sidebarSearchField').typeahead('val', $('.sidebarSearchField').val());
setTimeout(function () { setTimeout(function () {
self.isOpen = true; self.isOpen = true;
}, 2000); }, 2000);

View file

@ -656,7 +656,7 @@ Metamaps.Create = {
self.newSelectedMetacodeNames = self.selectedMetacodeNames.slice(0); self.newSelectedMetacodeNames = self.selectedMetacodeNames.slice(0);
self.newSelectedMetacodes = self.selectedMetacodes.slice(0); self.newSelectedMetacodes = self.selectedMetacodes.slice(0);
} }
$('#metacodeSwitchTabs').tabs("select", self.selectedMetacodeSetIndex); $('#metacodeSwitchTabs').tabs("option", "active", self.selectedMetacodeSetIndex);
$('#topic_name').focus(); $('#topic_name').focus();
}, },
newTopic: { newTopic: {
@ -3301,24 +3301,32 @@ Metamaps.Filter = {
// ['Topics', 'Synapses'] as 'collection' // ['Topics', 'Synapses'] as 'collection'
if (typeof collection === "object") { if (typeof collection === "object") {
Metamaps[collection[0]].each(function(model) { Metamaps[collection[0]].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop); newList.push(prop);
} }
}
}); });
Metamaps[collection[1]].each(function(model) { Metamaps[collection[1]].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop); newList.push(prop);
} }
}
}); });
} } else if (typeof collection === "string") {
else if (typeof collection === "string") {
Metamaps[collection].each(function(model) { Metamaps[collection].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop); newList.push(prop);
} }
}
}); });
} }

View file

@ -2146,6 +2146,7 @@ and it won't be important on password protected instances */
display: block; display: block;
width: 100%; width: 100%;
padding: 4px 0 !important; padding: 4px 0 !important;
outline: none;
} }
.ui-tabs-vertical .ui-tabs-panel { .ui-tabs-vertical .ui-tabs-panel {
padding: 0 !important; padding: 0 !important;
@ -2182,6 +2183,7 @@ and it won't be important on password protected instances */
} }
#metacodeSwitchTabs li.ui-state-active a { #metacodeSwitchTabs li.ui-state-active a {
color: #00BCD4; color: #00BCD4;
cursor: pointer;
} }
.metacodeSwitchTab { .metacodeSwitchTab {
max-height: 300px; max-height: 300px;

View file

@ -150,470 +150,6 @@
height: 32px; 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 */ /* end upperLeftUI */
/* upperRightUI */ /* upperRightUI */

View file

@ -162,7 +162,6 @@
.mCSB_scrollTools .mCSB_buttonDown, .mCSB_scrollTools .mCSB_buttonDown,
.mCSB_scrollTools .mCSB_buttonLeft, .mCSB_scrollTools .mCSB_buttonLeft,
.mCSB_scrollTools .mCSB_buttonRight{ .mCSB_scrollTools .mCSB_buttonRight{
background-image:url(<%= asset_data_uri('mCSB_buttons.png') %>);
background-repeat:no-repeat; background-repeat:no-repeat;
opacity:0.4; opacity:0.4;
filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */ filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */

View file

@ -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 */

View file

@ -1,6 +1,8 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery protect_from_forgery
before_filter :get_invite_link
# this is for global login # this is for global login
include ContentHelper include ContentHelper
@ -47,7 +49,6 @@ private
current_user current_user
end end
def authenticated? def authenticated?
current_user current_user
end end
@ -56,4 +57,10 @@ private
current_user && current_user.admin current_user && current_user.admin
end 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 end

View file

@ -26,8 +26,6 @@ class MainController < ApplicationController
# get /search/topics?term=SOMETERM # get /search/topics?term=SOMETERM
def searchtopics def searchtopics
@current = current_user
term = params[:term] term = params[:term]
user = params[:user] ? params[:user] : false user = params[:user] ? params[:user] : false
@ -122,15 +120,13 @@ class MainController < ApplicationController
end 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 #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) render json: autocomplete_array_json(@topics)
end end
# get /search/maps?term=SOMETERM # get /search/maps?term=SOMETERM
def searchmaps def searchmaps
@current = current_user
term = params[:term] term = params[:term]
user = params[:user] ? params[:user] : nil user = params[:user] ? params[:user] : nil
@ -158,15 +154,13 @@ class MainController < ApplicationController
end 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 #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) render json: autocomplete_map_array_json(@maps)
end end
# get /search/mappers?term=SOMETERM # get /search/mappers?term=SOMETERM
def searchmappers def searchmappers
@current = current_user
term = params[:term] term = params[:term]
if term && !term.empty? && term.downcase[0..3] != "map:" && term.downcase[0..5] != "topic:" && term.downcase != "mapper:" 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?term=SOMETERM OR
# get /search/synapses?topic1id=SOMEID&topic2id=SOMEID # get /search/synapses?topic1id=SOMEID&topic2id=SOMEID
def searchsynapses def searchsynapses
@current = current_user
term = params[:term] term = params[:term]
topic1id = params[:topic1id] topic1id = params[:topic1id]
topic2id = params[:topic2id] topic2id = params[:topic2id]
@ -214,7 +206,7 @@ class MainController < ApplicationController
#permissions #permissions
@synapses.delete_if {|s| s.permission == "private" && !authenticated? } @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 else
@synapses = [] @synapses = []
end end

View file

@ -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

View file

@ -50,8 +50,7 @@ class SynapsesController < ApplicationController
# DELETE synapses/:id # DELETE synapses/:id
def destroy def destroy
@current = current_user @synapse = Synapse.find(params[:id]).authorize_to_delete(current_user)
@synapse = Synapse.find(params[:id]).authorize_to_delete(@current)
@synapse.delete if @synapse @synapse.delete if @synapse
respond_to do |format| respond_to do |format|

View file

@ -1,4 +1,7 @@
class Users::RegistrationsController < Devise::RegistrationsController class Users::RegistrationsController < Devise::RegistrationsController
before_filter :configure_sign_up_params, only: [:create]
before_filter :configure_account_update_params, only: [:update]
protected protected
def after_sign_up_path_for(resource) def after_sign_up_path_for(resource)
signed_in_root_path(resource) signed_in_root_path(resource)
@ -7,4 +10,14 @@ class Users::RegistrationsController < Devise::RegistrationsController
def after_update_path_for(resource) def after_update_path_for(resource)
signed_in_root_path(resource) signed_in_root_path(resource)
end 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 end

View file

@ -1,5 +1,4 @@
class UsersController < ApplicationController class UsersController < ApplicationController
before_filter :require_user, only: [:edit, :update, :updatemetacodes] before_filter :require_user, only: [:edit, :update, :updatemetacodes]
respond_to :html, :json respond_to :html, :json
@ -14,7 +13,6 @@ class UsersController < ApplicationController
# GET /users/:id/edit # GET /users/:id/edit
def edit def edit
@user = current_user @user = current_user
respond_with(@user) respond_with(@user)
end end
@ -22,9 +20,9 @@ class UsersController < ApplicationController
def update def update
@user = current_user @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 # 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" if params[:remove_image] == "1"
@user.image = nil @user.image = nil
end end
@ -43,7 +41,7 @@ class UsersController < ApplicationController
# trying to change the password # trying to change the password
correct_pass = @user.valid_password?(params[:current_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" if params[:remove_image] == "1"
@user.image = nil @user.image = nil
end end
@ -101,8 +99,7 @@ class UsersController < ApplicationController
private private
def user_params def user_params
params.require(:user).permit(:name, :email, :image, :password, params.require(:user).permit(:name, :email, :image, :password, :password_confirmation)
:password_confirmation, :code, :joinedwithcode, :remember_me)
end end
end end

View file

@ -9,7 +9,7 @@ module ApplicationHelper
@m = user.settings.metacodes @m = user.settings.metacodes
set = get_metacodeset set = get_metacodeset
if set if set
@metacodes = set.metacodes @metacodes = set.metacodes.to_a
else else
@metacodes = Metacode.where(id: @m).to_a @metacodes = Metacode.where(id: @m).to_a
end end

View file

@ -16,7 +16,7 @@ module MapsHelper
map['rtype'] = "map" map['rtype'] = "map"
contributorTip = '' contributorTip = ''
firstContributorImage = asset_path('user.png') firstContributorImage = 'https://s3.amazonaws.com/metamaps-assets/site/user.png'
if m.contributors.count > 0 if m.contributors.count > 0
firstContributorImage = m.contributors[0].image.url(:thirtytwo) firstContributorImage = m.contributors[0].image.url(:thirtytwo)
m.contributors.each_with_index do |c, index| m.contributors.each_with_index do |c, index|

View file

@ -1,22 +1,10 @@
module UsersHelper module UsersHelper
# build custom json autocomplete for typeahead
## this one is for building our custom JSON autocomplete format for typeahead
def autocomplete_user_array_json(users) def autocomplete_user_array_json(users)
temp = [] json_users = []
users.each do |u| users.each do |user|
user = {} json_users.push user.as_json_for_autocomplete
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
end end
return temp json_users
end end
end end

View file

@ -12,7 +12,7 @@ class Map < ActiveRecord::Base
:thumb => ['188x126#', :png] :thumb => ['188x126#', :png]
#:full => ['940x630#', :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 # Validate the attached image is image/jpg, image/png, etc
validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/

View file

@ -35,11 +35,12 @@ class User < ActiveRecord::Base
:ninetysix => ['96x96#', :png], :ninetysix => ['96x96#', :png],
:onetwentyeight => ['128x128#', :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 # Validate the attached image is image/jpg, image/png, etc
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
# override default as_json
def as_json(options={}) def as_json(options={})
{ :id => self.id, { :id => self.id,
:name => self.name, :name => self.name,
@ -48,26 +49,36 @@ class User < ActiveRecord::Base
} }
end end
def generate_code 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 #generate a random 8 letter/digit code that they can use to invite people
def generate_code
self.code = rand(36**8).to_s(36) self.code = rand(36**8).to_s(36)
$codes.push(self.code) $codes.push(self.code)
self.generation = self.get_generation self.generation = self.get_generation
end end
def get_generation def get_generation
if self.joinedwithcode == self.code calculate_generation() if generation.nil?
# if your joinedwithcode equals your code you must be GEN 0 generation
gen = 0 end
elsif self.generation
# if your generation has already been calculated then just return that value def calculate_generation
gen = self.generation if code == joinedwithcode
update(generation: 0)
else else
# if your generation hasn't been calculated, base it off the update(generation: User.find_by_code(joinedwithcode).generation + 1)
# generation of the person whose code you joined with + 1
gen = User.find_by_code(self.joinedwithcode).get_generation + 1
end end
end end
@ -75,13 +86,12 @@ class User < ActiveRecord::Base
# make sure we always return a UserPreference instance # make sure we always return a UserPreference instance
if read_attribute(:settings).nil? if read_attribute(:settings).nil?
write_attribute :settings, UserPreference.new write_attribute :settings, UserPreference.new
read_attribute :settings
else
read_attribute :settings
end end
read_attribute :settings
end end
def settings=(val) def settings=(val)
write_attribute :settings, val write_attribute :settings, val
end end
end end

View file

@ -231,9 +231,8 @@
<p>As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.</p> <p>As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.</p>
<p>Below is a personal invite link containing your unique access code, which can be used multiple times.</p> <p>Below is a personal invite link containing your unique access code, which can be used multiple times.</p>
<div id="joinCodesBox"> <div id="joinCodesBox">
<% mapper = current_user %> <p class="joinCodes"><%= @invite_link %>
<p class="joinCodes">http://metamaps.cc/join?code=<%= mapper.code %></p> <button class="button" onclick="Metamaps.GlobalUI.shareInvite('<%= @invite_link %>');">COPY INVITE LINK!</button>
<button class="button" onclick="Metamaps.GlobalUI.shareInvite('http://metamaps.cc/join?code=<%= mapper.code %>');">COPY INVITE LINK!</button>
</div> </div>
</div> </div>

View file

@ -19,9 +19,9 @@
<div id="metacodeSwitchTabs"> <div id="metacodeSwitchTabs">
<ul> <ul>
<% allMetacodeSets.each do |m| %> <% allMetacodeSets.each do |m| %>
<li><a href="#metacodeSwitchTabs<%= m.id %>" data-set-id="<%= m.id %>"><%= m.name %></a></li> <li><a href="#metacodeSwitchTabs<%= m.id %>" data-set-id="<%= m.id %>" data-bypass="true"><%= m.name %></a></li>
<% end %> <% end %>
<li><a href="#metacodeSwitchTabsCustom" data-set-id="custom" id="metacodeSetCustom">CUSTOM SELECTION</a></li> <li><a href="#metacodeSwitchTabsCustom" data-set-id="custom" data-bypass="true" id="metacodeSetCustom">CUSTOM SELECTION</a></li>
</ul> </ul>
<% allMetacodeSets.each_with_index do |m, localindex| %> <% allMetacodeSets.each_with_index do |m, localindex| %>
<div id="metacodeSwitchTabs<%= m.id %>" <div id="metacodeSwitchTabs<%= m.id %>"

View file

@ -2,7 +2,7 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all' require 'rails/all'
Bundler.require(:default, Rails.env) Bundler.require(*Rails.groups)
module Metamaps module Metamaps
class Application < Rails::Application class Application < Rails::Application

View file

@ -1,6 +1,13 @@
# Use this hook to configure devise mailer, warden hooks and so forth. # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model. # Many of these configuration options can be set straight in your model.
Devise.setup do |config| Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '4d38a819bcea6314ffccb156a8e84b1b52c51ed446d11877c973791b3cd88449e9dbd7990cbc6e7f37d84702168ec36391467000c842ed5bed4f0b05df2b9507'
# ==> Mailer Configuration # ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer, # 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. # 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. # The time the user will be remembered without asking for credentials again.
config.remember_for = 2.weeks 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. # If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false # 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. # time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 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 # ==> Configuration for :lockable
# Defines which strategy will be used to lock an account. # Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in. # :failed_attempts = Locks an account after a number of failed attempts to sign in.
@ -171,6 +178,9 @@ Devise.setup do |config|
# Time interval to unlock the account if :time is enabled as unlock_strategy. # Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour # config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable # ==> Configuration for :recoverable
# #
# Defines which key will be used when recovering the password for an account # Defines which key will be used when recovering the password for an account
@ -181,6 +191,10 @@ Devise.setup do |config|
# change their passwords. # change their passwords.
config.reset_password_within = 24.hours 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 # ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use # Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, # :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) # REST_AUTH_SITE_KEY to pepper)
# config.encryptor = :sha512 # config.encryptor = :sha512
# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
# config.token_authentication_key = :auth_token
# ==> Scopes configuration # ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for # 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 # "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. # is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as: # 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: # The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine # 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: # 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 end

View file

@ -3,49 +3,50 @@
en: en:
devise: devise:
confirmations: confirmations:
confirmed: "Your account was successfully confirmed. You are now signed in." confirmed: "Your email address has been successfully confirmed."
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." 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 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 for how to confirm your email address in a few minutes."
failure: failure:
already_authenticated: "You are already signed in." already_authenticated: "You are already signed in."
inactive: "Your account was not activated yet." inactive: "Your account is not activated yet."
invalid: "Invalid email or password." invalid: "Invalid %{authentication_keys} or password."
invalid_token: "Invalid authentication token."
locked: "Your account is locked." locked: "Your account is locked."
not_found_in_database: "Invalid email or password." last_attempt: "You have one more attempt before your account is locked."
timeout: "Your session expired, please sign in again to continue." 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." 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: mailer:
confirmation_instructions: confirmation_instructions:
subject: "Confirmation instructions" subject: "Confirmation instructions"
reset_password_instructions: reset_password_instructions:
subject: "Reset password instructions" subject: "Reset password instructions"
unlock_instructions: unlock_instructions:
subject: "Unlock Instructions" subject: "Unlock instructions"
omniauth_callbacks: omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"." failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account." success: "Successfully authenticated from %{kind} account."
passwords: 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." 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." 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: "Your password has been changed successfully. You are now signed in."
updated_not_active: "Your password was changed successfully." updated_not_active: "Your password has been changed successfully."
registrations: 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: "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_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_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." 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 click on the confirm link to finalize confirming your new email address." 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: "You updated your account successfully." updated: "Your account has been updated successfully."
sessions: sessions:
signed_in: "Signed in successfully." signed_in: "Signed in successfully."
signed_out: "Signed out successfully." signed_out: "Signed out successfully."
already_signed_out: "Signed out successfully."
unlocks: unlocks:
send_instructions: "You will receive an email with instructions about how to unlock your account 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 about how to unlock it 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." unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors: errors:
messages: messages:

View file

@ -26,7 +26,7 @@ Metamaps::Application.routes.draw do
get 'explore/mapper/:id', to: 'maps#index', as: :usermaps get 'explore/mapper/:id', to: 'maps#index', as: :usermaps
resources :maps, except: [:new, :edit] resources :maps, except: [:new, :edit]
get 'maps/:id/contains', to: 'maps#contains', as: :contains 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 devise_for :users, controllers: { registrations: 'users/registrations', passwords: 'users/passwords', sessions: 'devise/sessions' }, :skip => :sessions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,14 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values. # 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). # 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 ## USERS
User.create({ User.create({
name: 'user', name: 'user',
email: 'user@user.com', email: 'user@user.com',
@ -26,286 +19,288 @@ User.create({
joinedwithcode: 'iuytrewq', joinedwithcode: 'iuytrewq',
admin: 'true', admin: 'true',
}) })
## END USERS
## METACODES ## METACODES
Metacode.create({ Metacode.create({
name: 'Action', 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', color: '#BD6C85',
}) })
Metacode.create({ Metacode.create({
name: 'Activity', 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', color: '#6EBF65',
}) })
Metacode.create({ Metacode.create({
name: 'Catalyst', 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', color: '#EF8964',
}) })
Metacode.create({ Metacode.create({
name: 'Closed', 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', color: '#ABB49F',
}) })
Metacode.create({ Metacode.create({
name: 'Process', 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', color: '#BDB25E',
}) })
Metacode.create({ Metacode.create({
name: 'Future Dev', name: 'Future',
icon: '/assets/icons/blueprint_96px/bp_futuredev.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_futuredev.png',
color: '#25A17F', color: '#25A17F',
}) })
Metacode.create({ Metacode.create({
name: 'Group', 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', color: '#7076BC',
}) })
Metacode.create({ Metacode.create({
name: 'Implication', 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', color: '#83DECA',
}) })
Metacode.create({ Metacode.create({
name: 'Insight', 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', color: '#B074AD',
}) })
Metacode.create({ Metacode.create({
name: 'Intention', 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', color: '#BAEAFF',
}) })
Metacode.create({ Metacode.create({
name: 'Knowledge', 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', color: '#60ACF7',
}) })
Metacode.create({ Metacode.create({
name: 'Location', 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', color: '#ABD9A7',
}) })
Metacode.create({ Metacode.create({
name: 'Need', name: 'Need',
icon: '/assets/icons/blueprint_96px/bp_need.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_need.png',
color: '#D2A7D4', color: '#D2A7D4',
}) })
Metacode.create({ Metacode.create({
name: 'Open Issue', name: 'Open',
icon: '/assets/icons/blueprint_96px/bp_openissue.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_openissue.png',
color: '#9BBF71', color: '#9BBF71',
}) })
Metacode.create({ Metacode.create({
name: 'Opportunity', 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', color: '#889F64',
}) })
Metacode.create({ Metacode.create({
name: 'Person', 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', color: '#DE925F',
}) })
Metacode.create({ Metacode.create({
name: 'Platform', 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', color: '#21C8FE',
}) })
Metacode.create({ Metacode.create({
name: 'Problem', 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', color: '#99CFC4',
}) })
Metacode.create({ Metacode.create({
name: 'Resource', name: 'Resource',
icon: '/assets/icons/blueprint_96px/bp_resource.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_resource.png',
color: '#C98C63', color: '#C98C63',
}) })
Metacode.create({ Metacode.create({
name: 'Role', 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', color: '#A8595D',
}) })
Metacode.create({ Metacode.create({
name: 'Task', 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', color: '#3397C4',
}) })
Metacode.create({ Metacode.create({
name: 'Trajectory', 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', color: '#D3AA4C',
}) })
Metacode.create({ Metacode.create({
name: 'Argument', 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', color: '#7FAEFD',
}) })
Metacode.create({ Metacode.create({
name: 'Con', 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', color: '#CF7C74',
}) })
Metacode.create({ Metacode.create({
name: 'Subject', 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', color: '#8293D8',
}) })
Metacode.create({ Metacode.create({
name: 'Decision', 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', color: '#CCA866',
}) })
Metacode.create({ Metacode.create({
name: 'Event', name: 'Event',
icon: '/assets/icons/generics_96px/gen_event.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_event.png',
color: '#F5854B', color: '#F5854B',
}) })
Metacode.create({ Metacode.create({
name: 'Example', 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', color: '#618C61',
}) })
Metacode.create({ Metacode.create({
name: 'Experience', 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', color: '#BE995F',
}) })
Metacode.create({ Metacode.create({
name: 'Feedback', 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', color: '#54A19D',
}) })
Metacode.create({ Metacode.create({
name: 'Aim', 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', color: '#B0B0B0',
}) })
Metacode.create({ Metacode.create({
name: 'Good Practice', name: 'Good',
icon: '/assets/icons/generics_96px/gen_goodpractice.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_goodpractice.png',
color: '#BD9E86', color: '#BD9E86',
}) })
Metacode.create({ Metacode.create({
name: 'Idea', 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', color: '#C4BC5E',
}) })
Metacode.create({ Metacode.create({
name: 'List', 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', color: '#B7A499',
}) })
Metacode.create({ Metacode.create({
name: 'Media', 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', color: '#6D94CC',
}) })
Metacode.create({ Metacode.create({
name: 'Metamap', 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', color: '#AEA9FD',
}) })
Metacode.create({ Metacode.create({
name: 'Model', 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', color: '#B385BA',
}) })
Metacode.create({ Metacode.create({
name: 'Note', 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', color: '#A389A1',
}) })
Metacode.create({ Metacode.create({
name: 'Perspective', 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', color: '#2EB6CC',
}) })
Metacode.create({ Metacode.create({
name: 'Pro', 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', color: '#89B879',
}) })
Metacode.create({ Metacode.create({
name: 'Project', 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', color: '#85A050',
}) })
Metacode.create({ Metacode.create({
name: 'Question', 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', color: '#5CB3B3',
}) })
Metacode.create({ Metacode.create({
name: 'Reference', 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', color: '#A7A7A7',
}) })
Metacode.create({ Metacode.create({
name: 'Research', 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', color: '#CD8E89',
}) })
Metacode.create({ Metacode.create({
name: 'Status update', name: 'Status',
icon: '/assets/icons/generics_96px/gen_status.png', icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_status.png',
color: '#EFA7C0', color: '#EFA7C0',
}) })
Metacode.create({ Metacode.create({
name: 'Tool', 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', color: '#828282',
}) })
Metacode.create({ Metacode.create({
name: 'Wildcard', 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', color: '#73C7DE',
}) })
## END METACODES

View file

@ -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.

View file

@ -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!

39
doc/metamaps-qa-steps.md Normal file
View file

@ -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).

View file

@ -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

View file

@ -26,7 +26,7 @@
} }
body { 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; font-family: 'din-regular', helvetica, sans-serif;
color: #424242; color: #424242;
text-align: justify; text-align: justify;
@ -61,7 +61,7 @@
border-radius: 225px; border-radius: 225px;
-webkit-border-radius: 225px; -webkit-border-radius: 225px;
-moz-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; float: left;
background-position:50% 20%; background-position:50% 20%;
background-size: 100%; background-size: 100%;