commit
b43804bf80
158 changed files with 5932 additions and 3470 deletions
49
.example-env
49
.example-env
|
@ -1,14 +1,43 @@
|
|||
RAILS_ENV=development
|
||||
export DB_USERNAME='postgres'
|
||||
export DB_PASSWORD='3112'
|
||||
export DB_HOST='localhost'
|
||||
export DB_PORT='5432'
|
||||
export DB_NAME='metamap002'
|
||||
|
||||
AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY
|
||||
BUNDLE_GEMFILE
|
||||
SMTP_DOMAIN
|
||||
SMTP_PASSWORD
|
||||
SMTP_PORT
|
||||
SMTP_SERVER
|
||||
SMTP_USERNAME
|
||||
SSO_KEY
|
||||
export REALTIME_SERVER='http://localhost:5001'
|
||||
export MAILER_DEFAULT_URL='localhost:3000'
|
||||
export DEVISE_MAILER_SENDER='team@metamaps.cc'
|
||||
export DEVISE_SECRET_KEY='f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73ee6c94675b62fe1f6d52fa7ba8196b33031f0d2f3b67e27ea07693c52ecebccb01700cad614'
|
||||
|
||||
# # you can safely leave these blank, unless you're deploying an instance, in
|
||||
# # which case you'll need to set them up
|
||||
#
|
||||
# export S3_BUCKET_NAME
|
||||
# export AWS_ACCESS_KEY_ID
|
||||
# export AWS_SECRET_ACCESS_KEY
|
||||
# export SSO_KEY
|
||||
#
|
||||
# export SMTP_DOMAIN
|
||||
# export SMTP_PASSWORD
|
||||
# export SMTP_PORT
|
||||
# export SMTP_SERVER
|
||||
# export SMTP_USERNAME
|
||||
|
||||
#ruby garbage collection stuff
|
||||
|
||||
export RUBY_GC_TUNE=0 #set to 1 to enable GC test
|
||||
export RUBY_GC_TOKEN=4f4380fc9a2857d1f008005a3eb86928
|
||||
export RUBY_GC_HEAP_INIT_SLOTS=186426
|
||||
export RUBY_GC_HEAP_FREE_SLOTS=559278
|
||||
export RUBY_GC_HEAP_GROWTH_FACTOR=1.03
|
||||
export RUBY_GC_HEAP_GROWTH_MAX_SLOTS=74570
|
||||
export RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.4
|
||||
export RUBY_GC_MALLOC_LIMIT=32883406
|
||||
export RUBY_GC_MALLOC_LIMIT_MAX=69055153
|
||||
export RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.68
|
||||
export RUBY_GC_OLDMALLOC_LIMIT=32509481
|
||||
export RUBY_GC_OLDMALLOC_LIMIT_MAX=68269910
|
||||
export RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=1.4
|
||||
|
||||
## find the ENV currently in use in the app using :
|
||||
## grep -rIso -P "(?<=ENV)(\.fetch\(|\[).[A-Z_]+.(\)|\])"
|
||||
|
|
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -4,21 +4,21 @@
|
|||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
#assety stuff
|
||||
realtime/node_modules
|
||||
config/database.yml
|
||||
public/assets
|
||||
|
||||
#secrets and config
|
||||
.env
|
||||
#public/assets
|
||||
|
||||
# Ignore bundler config
|
||||
.bundle
|
||||
|
||||
# Ignore the default SQLite database.
|
||||
db/*.sqlite3
|
||||
|
||||
# Ignore all logfiles and tempfiles.
|
||||
log/*.log
|
||||
tmp
|
||||
|
||||
.DS_Store
|
||||
|
||||
*/.DS_Store
|
||||
.DS_Store?
|
||||
.vagrant
|
||||
|
|
2
.rspec
Normal file
2
.rspec
Normal file
|
@ -0,0 +1,2 @@
|
|||
--color
|
||||
--require spec_helper
|
1
.ruby-gemset
Normal file
1
.ruby-gemset
Normal file
|
@ -0,0 +1 @@
|
|||
metamaps_gen002
|
|
@ -1 +1 @@
|
|||
2.1.3
|
||||
ruby-2.1.3
|
||||
|
|
49
Gemfile
49
Gemfile
|
@ -1,15 +1,12 @@
|
|||
source 'https://rubygems.org'
|
||||
ruby '2.1.3'
|
||||
|
||||
gem 'rails', '3.2.17'
|
||||
|
||||
# Bundle edge Rails instead:
|
||||
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||
gem 'rails', '4.2.4'
|
||||
|
||||
gem 'devise'
|
||||
gem 'redis'
|
||||
gem 'pg'
|
||||
gem 'cancan'
|
||||
gem 'cancancan'
|
||||
gem 'formula'
|
||||
gem 'formtastic'
|
||||
gem 'json'
|
||||
|
@ -20,7 +17,11 @@ gem 'uservoice-ruby'
|
|||
gem 'dotenv'
|
||||
|
||||
gem 'paperclip'
|
||||
gem 'aws-sdk'
|
||||
gem 'aws-sdk', '< 2.0'
|
||||
|
||||
gem 'jquery-rails'
|
||||
gem 'jquery-ui-rails'
|
||||
gem 'jbuilder'
|
||||
|
||||
#gem 'therubyracer' #optional
|
||||
#gem 'rb-readline'
|
||||
|
@ -29,32 +30,30 @@ gem 'aws-sdk'
|
|||
# in production environments by default.
|
||||
group :assets do
|
||||
gem 'sass-rails'
|
||||
gem 'coffee-rails', '~> 3.2.1'
|
||||
gem 'coffee-rails'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer'
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
gem 'uglifier'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'rspec-rails'
|
||||
gem 'factory_girl_rails'
|
||||
gem 'shoulda-matchers'
|
||||
end
|
||||
|
||||
group :production do #this is used on heroku
|
||||
#gem 'rmagick'
|
||||
gem 'rails_12factor'
|
||||
end
|
||||
|
||||
gem 'jquery-rails', '2.1.2'
|
||||
|
||||
# To use ActiveModel has_secure_password
|
||||
# gem 'bcrypt-ruby', '~> 3.0.0'
|
||||
|
||||
# To use Jbuilder templates for JSON
|
||||
gem 'jbuilder', '0.8.2'
|
||||
|
||||
# Use unicorn as the web server
|
||||
# gem 'unicorn'
|
||||
|
||||
# Deploy with Capistrano
|
||||
# gem 'capistrano'
|
||||
|
||||
# To use debugger
|
||||
# gem 'ruby-debug19', :require => 'ruby-debug'
|
||||
|
||||
group :development, :test do
|
||||
gem 'pry-rails'
|
||||
gem 'pry-byebug'
|
||||
gem 'better_errors'
|
||||
gem 'binding_of_caller'
|
||||
gem 'quiet_assets'
|
||||
gem 'tunemygc'
|
||||
end
|
||||
|
|
339
Gemfile.lock
339
Gemfile.lock
|
@ -1,152 +1,222 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.2.17)
|
||||
actionpack (= 3.2.17)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (3.2.17)
|
||||
activemodel (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
builder (~> 3.0.0)
|
||||
actionmailer (4.2.4)
|
||||
actionpack (= 4.2.4)
|
||||
actionview (= 4.2.4)
|
||||
activejob (= 4.2.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.4)
|
||||
actionview (= 4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
rack (~> 1.4.5)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.2.1)
|
||||
activemodel (3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.17)
|
||||
activemodel (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.17)
|
||||
activemodel (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
activesupport (3.2.17)
|
||||
i18n (~> 0.6, >= 0.6.4)
|
||||
multi_json (~> 1.0)
|
||||
arel (3.0.3)
|
||||
aws-sdk (1.54.0)
|
||||
aws-sdk-v1 (= 1.54.0)
|
||||
aws-sdk-v1 (1.54.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
activejob (4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.4)
|
||||
activemodel (= 4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.4)
|
||||
i18n (~> 0.7)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
arel (6.0.3)
|
||||
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.7)
|
||||
bcrypt (3.1.7-x86-mingw32)
|
||||
best_in_place (2.1.0)
|
||||
jquery-rails
|
||||
rails (~> 3.1)
|
||||
builder (3.0.4)
|
||||
cancan (1.6.10)
|
||||
bcrypt (3.1.10)
|
||||
best_in_place (3.0.3)
|
||||
actionpack (>= 3.2)
|
||||
railties (>= 3.2)
|
||||
better_errors (2.1.1)
|
||||
coderay (>= 1.0.0)
|
||||
erubis (>= 2.6.6)
|
||||
rack (>= 0.9.0)
|
||||
binding_of_caller (0.7.2)
|
||||
debug_inspector (>= 0.0.1)
|
||||
builder (3.2.2)
|
||||
byebug (5.0.0)
|
||||
columnize (= 0.9.0)
|
||||
cancancan (1.13.1)
|
||||
climate_control (0.0.3)
|
||||
activesupport (>= 3.0)
|
||||
cocaine (0.5.4)
|
||||
cocaine (0.5.7)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coffee-rails (3.2.2)
|
||||
coderay (1.1.0)
|
||||
coffee-rails (4.1.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
coffee-script (2.3.0)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.8.0)
|
||||
devise (3.4.0)
|
||||
coffee-script-source (1.9.1.1)
|
||||
columnize (0.9.0)
|
||||
debug_inspector (0.0.2)
|
||||
devise (3.5.2)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
responders
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
dotenv (2.0.0)
|
||||
diff-lcs (1.2.5)
|
||||
dotenv (2.0.2)
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.1)
|
||||
execjs (2.6.0)
|
||||
ezcrypto (0.7.2)
|
||||
formtastic (3.0.0)
|
||||
actionpack (>= 3.2.13)
|
||||
formula (1.0.1)
|
||||
rails (> 3.0.0)
|
||||
hike (1.2.3)
|
||||
i18n (0.6.11)
|
||||
jbuilder (0.8.2)
|
||||
factory_girl (4.5.0)
|
||||
activesupport (>= 3.0.0)
|
||||
journey (1.0.4)
|
||||
jquery-rails (2.1.2)
|
||||
railties (>= 3.1.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
json (1.8.1)
|
||||
kaminari (0.16.1)
|
||||
factory_girl_rails (4.5.0)
|
||||
factory_girl (~> 4.5.0)
|
||||
railties (>= 3.0.0)
|
||||
formtastic (3.1.3)
|
||||
actionpack (>= 3.2.13)
|
||||
formula (1.1.1)
|
||||
rails (> 3.0.0)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
i18n (0.7.0)
|
||||
jbuilder (2.3.2)
|
||||
activesupport (>= 3.0.0, < 5)
|
||||
multi_json (~> 1.2)
|
||||
jquery-rails (4.0.5)
|
||||
rails-dom-testing (~> 1.0)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (5.0.5)
|
||||
railties (>= 3.2.16)
|
||||
json (1.8.3)
|
||||
kaminari (0.16.3)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.6.0)
|
||||
multi_json (1.10.1)
|
||||
nokogiri (1.6.3.1)
|
||||
mini_portile (= 0.6.0)
|
||||
nokogiri (1.6.3.1-x86-mingw32)
|
||||
mini_portile (= 0.6.0)
|
||||
loofah (2.0.3)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
method_source (0.8.2)
|
||||
mime-types (2.6.2)
|
||||
mimemagic (0.3.0)
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.8.2)
|
||||
multi_json (1.11.2)
|
||||
nokogiri (1.6.6.2)
|
||||
mini_portile (~> 0.6.0)
|
||||
oauth (0.4.7)
|
||||
orm_adapter (0.5.0)
|
||||
paperclip (4.2.0)
|
||||
activemodel (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.5.3)
|
||||
paperclip (4.3.1)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
cocaine (~> 0.5.5)
|
||||
mime-types
|
||||
pg (0.17.1)
|
||||
pg (0.17.1-x86-mingw32)
|
||||
polyglot (0.3.5)
|
||||
rack (1.4.5)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-ssl (1.3.4)
|
||||
rack
|
||||
rack-test (0.6.2)
|
||||
mimemagic (= 0.3.0)
|
||||
pg (0.18.3)
|
||||
pry (0.10.3)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
pry-byebug (3.2.0)
|
||||
byebug (~> 5.0)
|
||||
pry (~> 0.10)
|
||||
pry-rails (0.3.4)
|
||||
pry (>= 0.9.10)
|
||||
quiet_assets (1.1.0)
|
||||
railties (>= 3.1, < 5.0)
|
||||
rack (1.6.4)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.17)
|
||||
actionmailer (= 3.2.17)
|
||||
actionpack (= 3.2.17)
|
||||
activerecord (= 3.2.17)
|
||||
activeresource (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.17)
|
||||
rails3-jquery-autocomplete (1.0.14)
|
||||
rails (>= 3.0)
|
||||
railties (3.2.17)
|
||||
actionpack (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rails (4.2.4)
|
||||
actionmailer (= 4.2.4)
|
||||
actionpack (= 4.2.4)
|
||||
actionview (= 4.2.4)
|
||||
activejob (= 4.2.4)
|
||||
activemodel (= 4.2.4)
|
||||
activerecord (= 4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.4)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.7)
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.2)
|
||||
loofah (~> 2.0)
|
||||
rails3-jquery-autocomplete (1.0.15)
|
||||
rails (>= 3.2)
|
||||
rails_12factor (0.0.3)
|
||||
rails_serve_static_assets
|
||||
rails_stdout_logging
|
||||
rails_serve_static_assets (0.0.4)
|
||||
rails_stdout_logging (0.0.4)
|
||||
railties (4.2.4)
|
||||
actionpack (= 4.2.4)
|
||||
activesupport (= 4.2.4)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.3.2)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
redis (3.1.0)
|
||||
responders (1.1.1)
|
||||
railties (>= 3.2, < 4.2)
|
||||
sass (3.4.5)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
sprockets (2.2.2)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.4.2)
|
||||
redis (3.2.1)
|
||||
responders (2.1.0)
|
||||
railties (>= 4.2.0, < 5)
|
||||
rspec-core (3.3.2)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-expectations (3.3.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-mocks (3.3.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-rails (3.3.3)
|
||||
actionpack (>= 3.0, < 4.3)
|
||||
activesupport (>= 3.0, < 4.3)
|
||||
railties (>= 3.0, < 4.3)
|
||||
rspec-core (~> 3.3.0)
|
||||
rspec-expectations (~> 3.3.0)
|
||||
rspec-mocks (~> 3.3.0)
|
||||
rspec-support (~> 3.3.0)
|
||||
rspec-support (3.3.0)
|
||||
sass (3.4.19)
|
||||
sass-rails (5.0.4)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
shoulda-matchers (3.0.1)
|
||||
activesupport (>= 4.0.0)
|
||||
slop (3.6.0)
|
||||
sprockets (3.4.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (2.3.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.4)
|
||||
tilt (1.4.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.41)
|
||||
uglifier (2.5.3)
|
||||
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)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
uservoice-ruby (0.0.11)
|
||||
|
@ -158,26 +228,39 @@ GEM
|
|||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
aws-sdk
|
||||
aws-sdk (< 2.0)
|
||||
best_in_place
|
||||
cancan
|
||||
coffee-rails (~> 3.2.1)
|
||||
better_errors
|
||||
binding_of_caller
|
||||
cancancan
|
||||
coffee-rails
|
||||
devise
|
||||
dotenv
|
||||
factory_girl_rails
|
||||
formtastic
|
||||
formula
|
||||
jbuilder (= 0.8.2)
|
||||
jquery-rails (= 2.1.2)
|
||||
jbuilder
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
json
|
||||
kaminari
|
||||
paperclip
|
||||
pg
|
||||
rails (= 3.2.17)
|
||||
pry-byebug
|
||||
pry-rails
|
||||
quiet_assets
|
||||
rails (= 4.2.4)
|
||||
rails3-jquery-autocomplete
|
||||
rails_12factor
|
||||
redis
|
||||
rspec-rails
|
||||
sass-rails
|
||||
uglifier (>= 1.0.3)
|
||||
shoulda-matchers
|
||||
tunemygc
|
||||
uglifier
|
||||
uservoice-ruby
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
If you are doing an upgrade and or recent pull for changes you will need to change your default ruby package from 2.1.1 to ruby 2.1.2
|
||||
|
||||
install homebrew
|
||||
|
||||
\curl -sSL https://get.rvm.io | bash -s stable --rails
|
||||
|
||||
rvm install 2.1.3 --with-gcc=clang
|
||||
|
||||
rvm use 2.1.3
|
||||
|
||||
gem install lunchy
|
||||
|
||||
(http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/)
|
||||
|
||||
|
||||
brew install postgresql
|
||||
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
|
||||
createuser metamaps -P -s -d
|
||||
|
||||
set a password
|
||||
|
||||
lunchy start postgres
|
||||
|
||||
|
||||
cd into the metamaps directory
|
||||
|
||||
bundle install
|
||||
|
||||
|
||||
copy the database.yml.default file and rename it database.yml
|
||||
make sure the username and password match the POSTGRES username and password you set
|
||||
|
||||
|
||||
http://nodejs.org/ hit install, download, open, install
|
||||
|
||||
|
||||
rake db:create
|
||||
rake db:schema:load
|
||||
rake db:fixtures:load
|
||||
rails s
|
||||
|
||||
( to start the server)
|
|
@ -2,6 +2,7 @@ Metamaps
|
|||
=======
|
||||
|
||||
[![Join the chat at https://gitter.im/metamaps/metamaps_gen002](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/metamaps/metamaps_gen002?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
![Build Status](https://jenkins.devinhoward.ca/job/metamaps_gen002.develop/badge/icon)
|
||||
|
||||
Welcome to the Metamaps GitHub repo.
|
||||
|
||||
|
@ -72,7 +73,7 @@ Copyright (c) 2015 Connor Turland
|
|||
[site-blog]: http://blog.metamaps.cc
|
||||
[site-beta]: http://metamaps.cc
|
||||
[community]: https://plus.google.com/u/0/communities/115060009262157699234
|
||||
[license]: https://github.com/metamaps/metamaps_gen002/blob/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
|
||||
[license]: https://github.com/metamaps/metamaps_gen002/blob/develop/LICENSE
|
||||
[contributing]: https://github.com/metamaps/metamaps_gen002/blob/develop/doc/CONTRIBUTING.md
|
||||
[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/develop/doc/CONTRIBUTING.md#reporting-bugs-and-other-issues
|
||||
[windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/develop/doc/WindowsInstallation.md
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
Firstly this walkthrough is done with a 14.04 32bit install of Ubuntu.
|
||||
|
||||
All commands that I could are terminal based.
|
||||
|
||||
Lets check if all updates for the system are installed first
|
||||
|
||||
in terminal type
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
now we need to install git
|
||||
|
||||
sudo apt-get install git
|
||||
|
||||
lets get our RVM installed (Ruby Version Manager) now this is fun because the package you will get from apt-get is outdated.
|
||||
|
||||
so we are going to use CURL to get RVM
|
||||
|
||||
sudo apt-get install curl
|
||||
|
||||
then lets install RVM with curl like this
|
||||
|
||||
curl -L get.rvm.io | bash -s stable
|
||||
|
||||
PATH=$PATH:$HOME/.rvm/bin
|
||||
|
||||
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile"
|
||||
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
||||
|
||||
source ~/.rvm/scripts/rvm
|
||||
|
||||
now we can actually install RVM
|
||||
|
||||
rvm requirements
|
||||
|
||||
running this will check your system for requirements as well so you will need to put your system password in.
|
||||
|
||||
alright now we can download metamaps from the master using git
|
||||
|
||||
git clone https://github.com/metamaps/metamaps_gen002.git
|
||||
|
||||
now there is a couple other things we are going to need which is nodejs, postgresql, libpq-dev and redis-server
|
||||
|
||||
sudo apt-get install nodejs
|
||||
|
||||
sudo apt-get install postgresql
|
||||
|
||||
sudo apt-get install libpq-dev
|
||||
|
||||
sudo apt-get install redis-server
|
||||
|
||||
Furthermore, if you want to be able to work on profile picture uploading, or use it
|
||||
you'll need ImageMagick. On Ubuntu, you can just go find ImageMagick in the Ubuntu Software Centre
|
||||
|
||||
Install the specific version of ruby needed this will take some time
|
||||
|
||||
rvm install ruby-2.1.3
|
||||
|
||||
Now we also need to rename your database file which is in ./config/database.default.yml to database.yml
|
||||
|
||||
now run inside your metamaps_gen002 folder
|
||||
|
||||
bundle install
|
||||
|
||||
in your top lvl directory for metamaps this is a lengthy process so you might want to go and make a coffee or something :)
|
||||
|
||||
alright now we need to make sure your postgres password is the same as it is listed in the DB file so we are going to set it by
|
||||
|
||||
sudo -u postgres psql
|
||||
|
||||
Select postgres like this
|
||||
|
||||
\password postgres
|
||||
|
||||
set the password to 3112
|
||||
|
||||
Then to quit
|
||||
|
||||
\q
|
||||
|
||||
now we can run the rake install and db creation
|
||||
|
||||
rake db:create
|
||||
|
||||
rake db:schema:load
|
||||
|
||||
rake db:fixtures:load
|
||||
|
||||
Execute the server:
|
||||
|
||||
rails s
|
||||
|
||||
and dont forget to run the other server for realtime...
|
||||
open a new terminal
|
||||
navigate to ./realtime and run
|
||||
|
||||
sudo apt-get install npm
|
||||
npm install
|
||||
nodejs realtime-server.js
|
||||
|
||||
Now you're all set enjoy your personal server of metamaps :)
|
||||
|
||||
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!
|
|
@ -1,45 +0,0 @@
|
|||
If you have any trouble with this process, contact us at team@metamaps.cc, and one of our developers may be able to help you out.
|
||||
|
||||
First, http://railsinstaller.org/en. This will install Ruby, Rails, and Git for you.
|
||||
|
||||
Once you've done that, you will need to download PostgreSQL and node.js:
|
||||
|
||||
- http://nodejs.org/en/download/
|
||||
- http://www.postgresql.org/download/windows/
|
||||
|
||||
Now open a terminal, and navigate to the folder that you want to download the metamaps files to and run the following:
|
||||
|
||||
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!
|
BIN
app/assets/images/.DS_Store
vendored
BIN
app/assets/images/.DS_Store
vendored
Binary file not shown.
File diff suppressed because one or more lines are too long
2451
app/assets/javascripts/lib/typeahead.bundle.js
Normal file
2451
app/assets/javascripts/lib/typeahead.bundle.js
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -3127,7 +3127,7 @@ var Canvas;
|
|||
ctx = base.getCtx(),
|
||||
scale = base.scaleOffsetX;
|
||||
//var pattern = new Image();
|
||||
//pattern.src = "/assets/cubes.png";
|
||||
//pattern.src = "<%= asset_path('cubes.png') %>";
|
||||
//var ptrn = ctx.createPattern(pattern, 'repeat');
|
||||
//ctx.fillStyle = ptrn;
|
||||
ctx.fillStyle = Metamaps.Settings.colors.background;
|
|
@ -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: "/assets/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: "/assets/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();
|
||||
}
|
||||
|
@ -600,14 +614,14 @@ Metamaps.GlobalUI.Search = {
|
|||
|
||||
self.hideLoader();
|
||||
|
||||
if (datum.rtype != "noresult") {
|
||||
if (["topic", "map", "mapper"].indexOf(datum.rtype) !== -1) {
|
||||
self.close(0, true);
|
||||
var win;
|
||||
if (dataset == "topics") {
|
||||
if (datum.rtype == "topic") {
|
||||
Metamaps.Router.topics(datum.id);
|
||||
} else if (dataset == "maps") {
|
||||
} else if (datum.rtype == "map") {
|
||||
Metamaps.Router.maps(datum.id);
|
||||
} else if (dataset == "mappers") {
|
||||
} else if (datum.rtype == "mapper") {
|
||||
Metamaps.Router.explore("mapper", datum.id);
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +630,7 @@ Metamaps.GlobalUI.Search = {
|
|||
var self = Metamaps.GlobalUI.Search;
|
||||
|
||||
function toggleResultSet(set) {
|
||||
var s = $('.tt-dataset-' + set + ' .tt-suggestions');
|
||||
var s = $('.tt-dataset-' + set + ' .tt-dataset');
|
||||
if (s.css('height') == '0px') {
|
||||
s.css({
|
||||
'height': 'auto',
|
||||
|
@ -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);
|
||||
|
@ -658,4 +672,4 @@ Metamaps.GlobalUI.Search = {
|
|||
showLoader: function () {
|
||||
$('#searchLoading').show();
|
||||
}
|
||||
};
|
||||
};
|
|
@ -29,10 +29,10 @@ Metamaps.JIT = {
|
|||
$(".takeScreenshot").click(Metamaps.Map.exportImage);
|
||||
|
||||
self.topicDescImage = new Image();
|
||||
self.topicDescImage.src = '/assets/topic_description_signifier.png';
|
||||
self.topicDescImage.src = '<%= asset_path('topic_description_signifier.png') %>';
|
||||
|
||||
self.topicLinkImage = new Image();
|
||||
self.topicLinkImage.src = '/assets/topic_link_signifier.png';
|
||||
self.topicLinkImage.src = '<%= asset_path('topic_link_signifier.png') %>';
|
||||
},
|
||||
/**
|
||||
* convert our topic JSON into something JIT can use
|
|
@ -37,7 +37,7 @@ Metamaps.Settings = {
|
|||
background: '#18202E',
|
||||
text: '#DDD'
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Metamaps.Touch = {
|
||||
|
@ -157,7 +157,7 @@ Metamaps.Backbone.init = function () {
|
|||
this.on('saved', this.savedEvent);
|
||||
this.on('nowPrivate', function(){
|
||||
var removeTopicData = {
|
||||
topicid: this.id
|
||||
mappableid: this.id
|
||||
};
|
||||
|
||||
$(document).trigger(Metamaps.JIT.events.removeTopic, [removeTopicData]);
|
||||
|
@ -165,7 +165,7 @@ Metamaps.Backbone.init = function () {
|
|||
this.on('noLongerPrivate', function(){
|
||||
var newTopicData = {
|
||||
mappingid: this.getMapping().id,
|
||||
topicid: this.id
|
||||
mappableid: this.id
|
||||
};
|
||||
|
||||
$(document).trigger(Metamaps.JIT.events.newTopic, [newTopicData]);
|
||||
|
@ -194,7 +194,8 @@ Metamaps.Backbone.init = function () {
|
|||
|
||||
return Metamaps.Mappings.findWhere({
|
||||
map_id: Metamaps.Active.Map.id,
|
||||
topic_id: this.isNew() ? this.cid : this.id
|
||||
mappable_type: "Topic",
|
||||
mappable_id: this.isNew() ? this.cid : this.id
|
||||
});
|
||||
},
|
||||
createNode: function () {
|
||||
|
@ -320,14 +321,14 @@ Metamaps.Backbone.init = function () {
|
|||
this.on('noLongerPrivate', function(){
|
||||
var newSynapseData = {
|
||||
mappingid: this.getMapping().id,
|
||||
synapseid: this.id
|
||||
mappableid: this.id
|
||||
};
|
||||
|
||||
$(document).trigger(Metamaps.JIT.events.newSynapse, [newSynapseData]);
|
||||
});
|
||||
this.on('nowPrivate', function(){
|
||||
$(document).trigger(Metamaps.JIT.events.removeSynapse, [{
|
||||
synapseid: this.id
|
||||
mappableid: this.id
|
||||
}]);
|
||||
});
|
||||
|
||||
|
@ -336,7 +337,7 @@ Metamaps.Backbone.init = function () {
|
|||
prepareLiForFilter: function () {
|
||||
var li = '';
|
||||
li += '<li data-id="' + this.get('desc') + '">';
|
||||
li += '<img src="/assets/synapse16.png"';
|
||||
li += '<img src="<%= asset_path('synapse16.png') %>"';
|
||||
li += ' alt="synapse icon" />';
|
||||
li += '<p>' + this.get('desc') + '</p></li>';
|
||||
return li;
|
||||
|
@ -370,7 +371,8 @@ Metamaps.Backbone.init = function () {
|
|||
|
||||
return Metamaps.Mappings.findWhere({
|
||||
map_id: Metamaps.Active.Map.id,
|
||||
synapse_id: this.isNew() ? this.cid : this.id
|
||||
mappable_type: "Synapse",
|
||||
mappable_id: this.isNew() ? this.cid : this.id
|
||||
});
|
||||
},
|
||||
createEdge: function () {
|
||||
|
@ -457,11 +459,11 @@ Metamaps.Backbone.init = function () {
|
|||
return Metamaps.Map.get(this.get('map_id'));
|
||||
},
|
||||
getTopic: function () {
|
||||
if (this.get('category') === 'Topic') return Metamaps.Topic.get(this.get('topic_id'));
|
||||
if (this.get('mappable_type') === 'Topic') return Metamaps.Topic.get(this.get('mappable_id'));
|
||||
else return false;
|
||||
},
|
||||
getSynapse: function () {
|
||||
if (this.get('category') === 'Synapse') return Metamaps.Synapse.get(this.get('synapse_id'));
|
||||
if (this.get('mappable_type') === 'Synapse') return Metamaps.Synapse.get(this.get('mappable_id'));
|
||||
else return false;
|
||||
}
|
||||
});
|
||||
|
@ -654,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: {
|
||||
|
@ -664,21 +666,36 @@ Metamaps.Create = {
|
|||
Metamaps.Create.newTopic.name = $(this).val();
|
||||
});
|
||||
|
||||
var topicBloodhound = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: '/topics/autocomplete_topic?term=%QUERY',
|
||||
wildcard: '%QUERY',
|
||||
},
|
||||
});
|
||||
|
||||
// initialize the autocomplete results for the metacode spinner
|
||||
$('#topic_name').typeahead([
|
||||
$('#topic_name').typeahead(
|
||||
{
|
||||
highlight: true,
|
||||
minLength: 2,
|
||||
},
|
||||
[{
|
||||
name: 'topic_autocomplete',
|
||||
limit: 8,
|
||||
template: $('#topicAutocompleteTemplate').html(),
|
||||
remote: {
|
||||
url: '/topics/autocomplete_topic?term=%QUERY'
|
||||
display: function (s) { return s.label; },
|
||||
templates: {
|
||||
suggestion: function(s) {
|
||||
return Hogan.compile($('#topicAutocompleteTemplate').html()).render(s);
|
||||
},
|
||||
},
|
||||
engine: Hogan
|
||||
}
|
||||
]);
|
||||
source: topicBloodhound,
|
||||
}]
|
||||
);
|
||||
|
||||
// tell the autocomplete to submit the form with the topic you clicked on if you pick from the autocomplete
|
||||
$('#topic_name').bind('typeahead:selected', function (event, datum, dataset) {
|
||||
$('#topic_name').bind('typeahead:select', function (event, datum, dataset) {
|
||||
Metamaps.Topic.getTopicFromAutocomplete(datum.id);
|
||||
});
|
||||
|
||||
|
@ -711,7 +728,7 @@ Metamaps.Create = {
|
|||
},
|
||||
hide: function () {
|
||||
$('#new_topic').fadeOut('fast');
|
||||
$("#topic_name").typeahead('setQuery', '');
|
||||
$("#topic_name").typeahead('val', '');
|
||||
Metamaps.Create.newTopic.beingCreated = false;
|
||||
}
|
||||
},
|
||||
|
@ -723,32 +740,62 @@ Metamaps.Create = {
|
|||
Metamaps.Create.newSynapse.description = $(this).val();
|
||||
});
|
||||
|
||||
// initialize the autocomplete results for synapse creation
|
||||
$('#synapse_desc').typeahead([
|
||||
{
|
||||
name: 'synapse_autocomplete',
|
||||
template: "<div class='genericSynapseDesc'>{{label}}</div>",
|
||||
remote: {
|
||||
url: '/search/synapses?term=%QUERY'
|
||||
var synapseBloodhound = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: '/search/synapses?term=%QUERY',
|
||||
wildcard: '%QUERY',
|
||||
},
|
||||
});
|
||||
var existingSynapseBloodhound = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: {
|
||||
url: '/search/synapses?topic1id=%TOPIC1&topic2id=%TOPIC2',
|
||||
prepare: function(query, settings) {
|
||||
var self = Metamaps.Create.newSynapse;
|
||||
if (Metamaps.Selected.Nodes.length < 2) {
|
||||
settings.url = settings.url.replace("%TOPIC1", self.topic1id).replace("%TOPIC2", self.topic2id);
|
||||
return settings;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
engine: Hogan
|
||||
},
|
||||
});
|
||||
|
||||
// initialize the autocomplete results for synapse creation
|
||||
$('#synapse_desc').typeahead(
|
||||
{
|
||||
highlight: true,
|
||||
minLength: 2,
|
||||
},
|
||||
[{
|
||||
name: 'synapse_autocomplete',
|
||||
display: function(s) { return s.label; },
|
||||
templates: {
|
||||
suggestion: function(s) {
|
||||
return Hogan.compile("<div class='genericSynapseDesc'>{{label}}</div>").render(s);
|
||||
},
|
||||
},
|
||||
source: synapseBloodhound,
|
||||
},
|
||||
{
|
||||
name: 'existing_synapses',
|
||||
limit: 50,
|
||||
template: $('#synapseAutocompleteTemplate').html(),
|
||||
remote: {
|
||||
url: '/search/synapses',
|
||||
replace: function () {
|
||||
return self.getSearchQuery();
|
||||
}
|
||||
display: function(s) { return s.label; },
|
||||
templates: {
|
||||
suggestion: function(s) {
|
||||
return Hogan.compile($('#synapseAutocompleteTemplate').html()).render(s);
|
||||
},
|
||||
header: "<h3>Existing synapses</h3>"
|
||||
},
|
||||
engine: Hogan,
|
||||
header: "<h3>Existing synapses</h3>"
|
||||
}
|
||||
]);
|
||||
source: existingSynapseBloodhound,
|
||||
}]
|
||||
);
|
||||
|
||||
$('#synapse_desc').bind('typeahead:selected', function (event, datum, dataset) {
|
||||
$('#synapse_desc').bind('typeahead:select', function (event, datum, dataset) {
|
||||
if (datum.id) { // if they clicked on an existing synapse get it
|
||||
Metamaps.Synapse.getSynapseFromAutocomplete(datum.id);
|
||||
}
|
||||
|
@ -771,7 +818,7 @@ Metamaps.Create = {
|
|||
},
|
||||
hide: function () {
|
||||
$('#new_synapse').fadeOut('fast');
|
||||
$("#synapse_desc").typeahead('setQuery', '');
|
||||
$("#synapse_desc").typeahead('val', '');
|
||||
Metamaps.Create.newSynapse.beingCreated = false;
|
||||
Metamaps.Create.newTopic.addSynapse = false;
|
||||
Metamaps.Create.newSynapse.topic1id = 0;
|
||||
|
@ -779,13 +826,6 @@ Metamaps.Create = {
|
|||
Metamaps.Mouse.synapseStartCoordinates = [];
|
||||
Metamaps.Visualize.mGraph.plot();
|
||||
},
|
||||
getSearchQuery: function () {
|
||||
var self = Metamaps.Create.newSynapse;
|
||||
|
||||
if (Metamaps.Selected.Nodes.length < 2) {
|
||||
return '/search/synapses?topic1id=' + self.topic1id + '&topic2id=' + self.topic2id;
|
||||
} else return '';
|
||||
}
|
||||
}
|
||||
}; // end Metamaps.Create
|
||||
|
||||
|
@ -888,8 +928,11 @@ Metamaps.TopicCard = {
|
|||
setTimeout(function () {
|
||||
var text = $(element).val();
|
||||
if (event.type=="paste" || (event.type=="keyup" && event.which==13)){
|
||||
if (text.slice(0, 4) !== 'http') {
|
||||
text='http://'+text;
|
||||
// TODO evaluate converting this to '//' no matter what (infer protocol)
|
||||
if (text.slice(0, 7) !== 'http://' &&
|
||||
text.slice(0, 8) !== 'https://' &&
|
||||
text.slice(0, 2) !== '//') {
|
||||
text='//'+text;
|
||||
}
|
||||
topic.save({
|
||||
link: text
|
||||
|
@ -1528,8 +1571,6 @@ Metamaps.SynapseCard = {
|
|||
////////////////////// END TOPIC AND SYNAPSE CARDS //////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* VISUALIZE
|
||||
|
@ -1859,7 +1900,7 @@ Metamaps.Util = {
|
|||
return (url.match(/\.(jpeg|jpg|gif|png)$/) != null);
|
||||
},
|
||||
checkURLisYoutubeVideo: function (url) {
|
||||
return (url.match(/^http:\/\/(?:www\.)?youtube.com\/watch\?(?=[^?]*v=\w+)(?:[^\s?]+)?$/) != null);
|
||||
return (url.match(/^https?:\/\/(?:www\.)?youtube.com\/watch\?(?=[^?]*v=\w+)(?:[^\s?]+)?$/) != null);
|
||||
}
|
||||
}; // end Metamaps.Util
|
||||
|
||||
|
@ -1869,9 +1910,6 @@ Metamaps.Util = {
|
|||
*
|
||||
*/
|
||||
Metamaps.Realtime = {
|
||||
stringForLocalhost: 'http://localhost:5001',
|
||||
stringForMetamaps: 'http://metamaps.cc:5001',
|
||||
stringForHeroku: 'http://gentle-savannah-1303.herokuapp.com',
|
||||
socket: null,
|
||||
isOpen: false,
|
||||
changing: false,
|
||||
|
@ -1895,9 +1933,7 @@ Metamaps.Realtime = {
|
|||
});
|
||||
$('body').click(self.close);
|
||||
|
||||
var railsEnv = $('body').data('env');
|
||||
var whichToConnect = railsEnv === 'development' ? self.stringForLocalhost : self.stringForHeroku;
|
||||
self.socket = io.connect(whichToConnect);
|
||||
self.socket = io.connect('<%= ENV['REALTIME_SERVER'] %>');
|
||||
self.socket.on('connect', function () {
|
||||
self.startActiveMap();
|
||||
});
|
||||
|
@ -2505,12 +2541,12 @@ Metamaps.Realtime = {
|
|||
|
||||
if (!self.status) return;
|
||||
|
||||
function test() {
|
||||
function waitThenRenderTopic() {
|
||||
if (topic && mapping && mapper) {
|
||||
Metamaps.Topic.renderTopic(mapping, topic, false, false);
|
||||
}
|
||||
else if (!cancel) {
|
||||
setTimeout(test, 10);
|
||||
setTimeout(waitThenRenderTopic, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2523,7 +2559,7 @@ Metamaps.Realtime = {
|
|||
Metamaps.Mapper.get(data.mapperid, mapperCallback);
|
||||
}
|
||||
$.ajax({
|
||||
url: "/topics/" + data.topicid + ".json",
|
||||
url: "/topics/" + data.mappableid + ".json",
|
||||
success: function (response) {
|
||||
Metamaps.Topics.add(response);
|
||||
topic = Metamaps.Topics.get(response.id);
|
||||
|
@ -2543,7 +2579,7 @@ Metamaps.Realtime = {
|
|||
}
|
||||
});
|
||||
|
||||
test();
|
||||
waitThenRenderTopic();
|
||||
},
|
||||
// removeTopic
|
||||
sendDeleteTopic: function (data) {
|
||||
|
@ -2570,7 +2606,7 @@ Metamaps.Realtime = {
|
|||
|
||||
if (!self.status) return;
|
||||
|
||||
var topic = Metamaps.Topics.get(data.topicid);
|
||||
var topic = Metamaps.Topics.get(data.mappableid);
|
||||
if (topic) {
|
||||
var node = topic.get('node');
|
||||
var mapping = topic.getMapping();
|
||||
|
@ -2598,7 +2634,7 @@ Metamaps.Realtime = {
|
|||
|
||||
if (!self.status) return;
|
||||
|
||||
function test() {
|
||||
function waitThenRenderSynapse() {
|
||||
if (synapse && mapping && mapper) {
|
||||
topic1 = synapse.getTopic1();
|
||||
node1 = topic1.get('node');
|
||||
|
@ -2608,7 +2644,7 @@ Metamaps.Realtime = {
|
|||
Metamaps.Synapse.renderSynapse(mapping, synapse, node1, node2, false);
|
||||
}
|
||||
else if (!cancel) {
|
||||
setTimeout(test, 10);
|
||||
setTimeout(waitThenRenderSynapse, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2621,7 +2657,7 @@ Metamaps.Realtime = {
|
|||
Metamaps.Mapper.get(data.mapperid, mapperCallback);
|
||||
}
|
||||
$.ajax({
|
||||
url: "/synapses/" + data.synapseid + ".json",
|
||||
url: "/synapses/" + data.mappableid + ".json",
|
||||
success: function (response) {
|
||||
Metamaps.Synapses.add(response);
|
||||
synapse = Metamaps.Synapses.get(response.id);
|
||||
|
@ -2640,7 +2676,7 @@ Metamaps.Realtime = {
|
|||
cancel = true;
|
||||
}
|
||||
});
|
||||
test();
|
||||
waitThenRenderSynapse();
|
||||
},
|
||||
// deleteSynapse
|
||||
sendDeleteSynapse: function (data) {
|
||||
|
@ -2668,7 +2704,7 @@ Metamaps.Realtime = {
|
|||
|
||||
if (!self.status) return;
|
||||
|
||||
var synapse = Metamaps.Synapses.get(data.synapseid);
|
||||
var synapse = Metamaps.Synapses.get(data.mappableid);
|
||||
if (synapse) {
|
||||
var edge = synapse.get('edge');
|
||||
var mapping = synapse.getMapping();
|
||||
|
@ -2778,12 +2814,12 @@ Metamaps.Control = {
|
|||
|
||||
var permToDelete = Metamaps.Active.Mapper.id === topic.get('user_id') || Metamaps.Active.Mapper.get('admin');
|
||||
if (permToDelete) {
|
||||
var topicid = topic.id;
|
||||
var mappableid = topic.id;
|
||||
var mapping = node.getData('mapping');
|
||||
topic.destroy();
|
||||
Metamaps.Mappings.remove(mapping);
|
||||
$(document).trigger(Metamaps.JIT.events.deleteTopic, [{
|
||||
topicid: topicid
|
||||
mappableid: mappableid
|
||||
}]);
|
||||
Metamaps.Control.hideNode(nodeid);
|
||||
} else {
|
||||
|
@ -2822,12 +2858,12 @@ Metamaps.Control = {
|
|||
}
|
||||
|
||||
var topic = node.getData('topic');
|
||||
var topicid = topic.id;
|
||||
var mappableid = topic.id;
|
||||
var mapping = node.getData('mapping');
|
||||
mapping.destroy();
|
||||
Metamaps.Topics.remove(topic);
|
||||
$(document).trigger(Metamaps.JIT.events.removeTopic, [{
|
||||
topicid: topicid
|
||||
mappableid: mappableid
|
||||
}]);
|
||||
Metamaps.Control.hideNode(nodeid);
|
||||
},
|
||||
|
@ -2951,7 +2987,7 @@ Metamaps.Control = {
|
|||
Metamaps.Control.hideEdge(edge);
|
||||
}
|
||||
|
||||
var synapseid = synapse.id;
|
||||
var mappableid = synapse.id;
|
||||
synapse.destroy();
|
||||
|
||||
// the server will destroy the mapping, we just need to remove it here
|
||||
|
@ -2962,7 +2998,7 @@ Metamaps.Control = {
|
|||
delete edge.data.$displayIndex;
|
||||
}
|
||||
$(document).trigger(Metamaps.JIT.events.deleteSynapse, [{
|
||||
synapseid: synapseid
|
||||
mappableid: mappableid
|
||||
}]);
|
||||
} else {
|
||||
Metamaps.GlobalUI.notifyUser('Only synapses you created can be deleted');
|
||||
|
@ -3007,7 +3043,7 @@ Metamaps.Control = {
|
|||
|
||||
var synapse = edge.getData("synapses")[index];
|
||||
var mapping = edge.getData("mappings")[index];
|
||||
var synapseid = synapse.id;
|
||||
var mappableid = synapse.id;
|
||||
mapping.destroy();
|
||||
|
||||
Metamaps.Synapses.remove(synapse);
|
||||
|
@ -3018,7 +3054,7 @@ Metamaps.Control = {
|
|||
delete edge.data.$displayIndex;
|
||||
}
|
||||
$(document).trigger(Metamaps.JIT.events.removeSynapse, [{
|
||||
synapseid: synapseid
|
||||
mappableid: mappableid
|
||||
}]);
|
||||
},
|
||||
hideSelectedEdges: function () {
|
||||
|
@ -3262,26 +3298,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);
|
||||
|
@ -4018,14 +4062,14 @@ Metamaps.Topic = {
|
|||
var mappingSuccessCallback = function (mappingModel, response) {
|
||||
var newTopicData = {
|
||||
mappingid: mappingModel.id,
|
||||
topicid: mappingModel.get('topic_id')
|
||||
mappableid: mappingModel.get('mappable_id')
|
||||
};
|
||||
|
||||
$(document).trigger(Metamaps.JIT.events.newTopic, [newTopicData]);
|
||||
};
|
||||
var topicSuccessCallback = function (topicModel, response) {
|
||||
if (Metamaps.Active.Map) {
|
||||
mapping.save({ topic_id: topicModel.id }, {
|
||||
mapping.save({ mappable_id: topicModel.id }, {
|
||||
success: mappingSuccessCallback,
|
||||
error: function (model, response) {
|
||||
console.log('error saving mapping to database');
|
||||
|
@ -4075,10 +4119,10 @@ Metamaps.Topic = {
|
|||
Metamaps.Topics.add(topic);
|
||||
|
||||
var mapping = new Metamaps.Backbone.Mapping({
|
||||
category: "Topic",
|
||||
xloc: Metamaps.Create.newTopic.x,
|
||||
yloc: Metamaps.Create.newTopic.y,
|
||||
topic_id: topic.cid
|
||||
mappable_id: topic.cid,
|
||||
mappable_type: "Topic",
|
||||
});
|
||||
Metamaps.Mappings.add(mapping);
|
||||
|
||||
|
@ -4097,10 +4141,10 @@ Metamaps.Topic = {
|
|||
var topic = self.get(id);
|
||||
|
||||
var mapping = new Metamaps.Backbone.Mapping({
|
||||
category: "Topic",
|
||||
xloc: Metamaps.Create.newTopic.x,
|
||||
yloc: Metamaps.Create.newTopic.y,
|
||||
topic_id: topic.id
|
||||
mappable_type: "Topic",
|
||||
mappable_id: topic.id,
|
||||
});
|
||||
Metamaps.Mappings.add(mapping);
|
||||
|
||||
|
@ -4115,10 +4159,10 @@ Metamaps.Topic = {
|
|||
|
||||
var nextCoords = Metamaps.Map.getNextCoord();
|
||||
var mapping = new Metamaps.Backbone.Mapping({
|
||||
category: "Topic",
|
||||
xloc: nextCoords.x,
|
||||
yloc: nextCoords.y,
|
||||
topic_id: topic.id
|
||||
mappable_type: "Topic",
|
||||
mappable_id: topic.id,
|
||||
});
|
||||
Metamaps.Mappings.add(mapping);
|
||||
|
||||
|
@ -4189,14 +4233,14 @@ Metamaps.Synapse = {
|
|||
var mappingSuccessCallback = function (mappingModel, response) {
|
||||
var newSynapseData = {
|
||||
mappingid: mappingModel.id,
|
||||
synapseid: mappingModel.get('synapse_id')
|
||||
mappableid: mappingModel.get('mappable_id')
|
||||
};
|
||||
|
||||
$(document).trigger(Metamaps.JIT.events.newSynapse, [newSynapseData]);
|
||||
};
|
||||
var synapseSuccessCallback = function (synapseModel, response) {
|
||||
if (Metamaps.Active.Map) {
|
||||
mapping.save({ synapse_id: synapseModel.id }, {
|
||||
mapping.save({ mappable_id: synapseModel.id }, {
|
||||
success: mappingSuccessCallback
|
||||
});
|
||||
}
|
||||
|
@ -4246,15 +4290,15 @@ Metamaps.Synapse = {
|
|||
node1 = synapsesToCreate[i];
|
||||
topic1 = node1.getData('topic');
|
||||
synapse = new Metamaps.Backbone.Synapse({
|
||||
desc: Metamaps.Create.newSynapse.description,
|
||||
desc: Metamaps.Create.newSynapse.description,// || "",
|
||||
node1_id: topic1.isNew() ? topic1.cid : topic1.id,
|
||||
node2_id: topic2.isNew() ? topic2.cid : topic2.id,
|
||||
});
|
||||
Metamaps.Synapses.add(synapse);
|
||||
|
||||
mapping = new Metamaps.Backbone.Mapping({
|
||||
category: "Synapse",
|
||||
synapse_id: synapse.cid
|
||||
mappable_type: "Synapse",
|
||||
mappable_id: synapse.cid,
|
||||
});
|
||||
Metamaps.Mappings.add(mapping);
|
||||
|
||||
|
@ -4274,8 +4318,8 @@ Metamaps.Synapse = {
|
|||
var synapse = self.get(id);
|
||||
|
||||
var mapping = new Metamaps.Backbone.Mapping({
|
||||
category: "Synapse",
|
||||
synapse_id: synapse.id
|
||||
mappable_type: "Synapse",
|
||||
mappable_id: synapse.id,
|
||||
});
|
||||
Metamaps.Mappings.add(mapping);
|
||||
|
||||
|
@ -4755,7 +4799,7 @@ Metamaps.Map.InfoBox = {
|
|||
obj["map_creator_tip"] = isCreator ? self.changePermissionText : "";
|
||||
obj["contributors_class"] = Metamaps.Mappers.length > 1 ? "multiple" : "";
|
||||
obj["contributors_class"] += Metamaps.Mappers.length === 2 ? " mTwo" : "";
|
||||
obj["contributor_image"] = Metamaps.Mappers.length > 0 ? Metamaps.Mappers.models[0].get("image") : "/assets/user.png";
|
||||
obj["contributor_image"] = Metamaps.Mappers.length > 0 ? Metamaps.Mappers.models[0].get("image") : "<%= asset_path('user.png') %>";
|
||||
obj["contributor_list"] = self.createContributorList();
|
||||
obj["user_name"] = isCreator ? "You" : map.get("user_name");
|
||||
obj["created_at"] = map.get("created_at_clean");
|
||||
|
@ -4852,7 +4896,7 @@ Metamaps.Map.InfoBox = {
|
|||
if (Metamaps.Mappers.length === 2) contributors_class = "multiple mTwo";
|
||||
else if (Metamaps.Mappers.length > 2) contributors_class = "multiple";
|
||||
|
||||
var contributors_image = "/assets/user.png";
|
||||
var contributors_image = "<%= asset_path('user.png') %>";
|
||||
if (Metamaps.Mappers.length > 0) {
|
||||
// get the first contributor and use their image
|
||||
contributors_image = Metamaps.Mappers.models[0].get("image");
|
||||
|
@ -5033,7 +5077,7 @@ Metamaps.Account = {
|
|||
var self = Metamaps.Account;
|
||||
|
||||
$('.userImageDiv canvas').remove();
|
||||
$('.userImageDiv img').attr('src', '/assets/user.png').show();
|
||||
$('.userImageDiv img').attr('src', '<%= asset_path('user.png') %>').show();
|
||||
$('.userImageMenu').hide();
|
||||
|
||||
var input = $('#user_image');
|
|
@ -78,7 +78,7 @@ html {
|
|||
|
||||
}
|
||||
body {
|
||||
background: #d8d9da url(shattered_@2X.png);
|
||||
background: #d8d9da url(<%= asset_data_uri('shattered_@2X.png') %>);
|
||||
font-family: 'din-medium', helvetica, sans-serif;
|
||||
color: #424242;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
@ -300,7 +300,7 @@ input[type="submit"]:active {
|
|||
display: none;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background-image: url(photo.png);
|
||||
background-image: url(<%= asset_data_uri('photo.png') %>);
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
left: 22px;
|
||||
|
@ -413,7 +413,7 @@ input[type="submit"]:active {
|
|||
|
||||
}
|
||||
.accountName:hover .nameEdit:after {
|
||||
background:url(edit.png)no-repeat;
|
||||
background: url(<%= asset_data_uri('edit.png') %>) no-repeat;
|
||||
content:" ";
|
||||
position:absolute;
|
||||
width:25px;
|
||||
|
@ -547,7 +547,7 @@ input[type="submit"]:active {
|
|||
display: block;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
background-image: url(metacodesettings_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('metacodesettings_sprite.png') %>);
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
top: 20px;
|
||||
|
@ -652,7 +652,7 @@ label {
|
|||
box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
.headertop .tab {
|
||||
background: url(tab.png) no-repeat 0 0;
|
||||
background: url('tab.png') no-repeat 0 0;
|
||||
position: absolute;
|
||||
top: -11px;
|
||||
right: -2px;
|
||||
|
@ -719,7 +719,7 @@ label {
|
|||
.accountInnerArrow {
|
||||
width:16px;
|
||||
height:16px;
|
||||
background-image: url(arrowdown_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowdown_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
position:absolute;
|
||||
top: 8px;
|
||||
|
@ -783,7 +783,7 @@ label {
|
|||
position:absolute;
|
||||
pointer-events:none;
|
||||
background-repeat:no-repeat;
|
||||
background-image: url(user_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('user_sprite.png') %>);
|
||||
}
|
||||
.accountSettings .accountIcon {
|
||||
background-position: 0 0;
|
||||
|
@ -813,7 +813,7 @@ li.accountInvite span {
|
|||
padding: 9px 0 9px 62px;
|
||||
}
|
||||
.accountImage {
|
||||
background-image: url(user.png);
|
||||
background-image: url(<%= asset_data_uri 'user.png' %>);
|
||||
background-size: 84px 84px;
|
||||
background-repeat: no-repeat;
|
||||
height:84px;
|
||||
|
@ -1145,7 +1145,7 @@ h3.realtimeBoxTitle {
|
|||
position: absolute;
|
||||
top: 4px;
|
||||
right: 0;
|
||||
background-image: url('junto24_sprite.png');
|
||||
background-image: url(<%= asset_data_uri('junto24_sprite.png') %>);
|
||||
}
|
||||
.realtimeMapperList .littleRtOff .littleJuntoIcon {
|
||||
background-position: 0 0;
|
||||
|
@ -1222,7 +1222,7 @@ h3.realtimeBoxTitle {
|
|||
position: absolute;
|
||||
top: 0;
|
||||
left: 4px;
|
||||
background-image: url(context_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('context_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
|
@ -1238,7 +1238,7 @@ h3.realtimeBoxTitle {
|
|||
}
|
||||
|
||||
.rightclickmenu .rc-center .rc-icon {
|
||||
background-image: url(context_topicview_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('context_topicview_sprite.png') %>);
|
||||
}
|
||||
.rightclickmenu .rc-popout .rc-icon {
|
||||
background-position: 0 -72px;
|
||||
|
@ -1251,7 +1251,7 @@ h3.realtimeBoxTitle {
|
|||
}
|
||||
.rightclickmenu .rc-siblings .rc-icon {
|
||||
background-position: 0 -24px;
|
||||
background-image: url(context_topicview_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('context_topicview_sprite.png') %>);
|
||||
}
|
||||
.rightclickmenu .expandLi {
|
||||
position: absolute;
|
||||
|
@ -1259,7 +1259,7 @@ h3.realtimeBoxTitle {
|
|||
right: 8px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url(arrowright_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowright_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
|
@ -1294,7 +1294,7 @@ h3.realtimeBoxTitle {
|
|||
position: absolute;
|
||||
top: 0;
|
||||
left: 4px;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
background-size: 72px 48px;
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
|
@ -1339,7 +1339,7 @@ h3.realtimeBoxTitle {
|
|||
right: 4px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url(arrowright_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowright_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
|
@ -1373,13 +1373,14 @@ h3.realtimeBoxTitle {
|
|||
|
||||
/* topic and synapse autocomplete */
|
||||
|
||||
#new_topic .tt-suggestion.tt-is-under-cursor,
|
||||
#new_topic .tt-suggestion.tt-is-under-mouse-cursor,
|
||||
#new_synapse .tt-suggestion.tt-is-under-cursor,
|
||||
#new_synapse .tt-suggestion.tt-is-under-mouse-cursor {
|
||||
#new_topic .tt-suggestion:hover,
|
||||
#new_topic .tt-suggestion.tt-cursor,
|
||||
#new_synapse .tt-suggestion:hover,
|
||||
#new_synapse .tt-suggestion.tt-cursor {
|
||||
background: #E0E0E0;
|
||||
}
|
||||
#new_topic .tt-suggestion,
|
||||
#new_synapse .tt-dataset h3,
|
||||
#new_synapse .tt-suggestion {
|
||||
background: #F5F5F5;
|
||||
position: relative;
|
||||
|
@ -1418,15 +1419,15 @@ h3.realtimeBoxTitle {
|
|||
top: 8px;
|
||||
right: 8px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(arrowright_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowright_sprite.png') %>);
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
#new_topic .tt-suggestion.tt-is-under-cursor .expandTopicMetadata,
|
||||
#new_topic .tt-suggestion.tt-is-under-mouse-cursor .expandTopicMetadata {
|
||||
#new_topic .tt-suggestion:hover .expandTopicMetadata,
|
||||
#new_topic .tt-suggestion.tt-cursor .expandTopicMetadata {
|
||||
display: block;
|
||||
}
|
||||
#new_topic .tt-suggestion.tt-is-under-cursor .topicMetadata,
|
||||
#new_topic .tt-suggestion.tt-is-under-mouse-cursor .topicMetadata {
|
||||
#new_topic .tt-suggestion:hover .topicMetadata,
|
||||
#new_topic .tt-suggestion.tt-cursor .topicMetadata {
|
||||
display: block;
|
||||
}
|
||||
#new_topic .topicMetadata {
|
||||
|
@ -1444,7 +1445,7 @@ h3.realtimeBoxTitle {
|
|||
width: 32px;
|
||||
height: 32px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
position: absolute;
|
||||
bottom: 4px;
|
||||
right: 4px;
|
||||
|
@ -1464,7 +1465,7 @@ h3.realtimeBoxTitle {
|
|||
#new_topic .topicNumMaps {
|
||||
height: 14px;
|
||||
padding: 1px 0 1px 32px;
|
||||
background-image: url(metamap16.png);
|
||||
background-image: url(<%= asset_data_uri('metamap16.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 8px 0;
|
||||
position: absolute;
|
||||
|
@ -1473,7 +1474,7 @@ h3.realtimeBoxTitle {
|
|||
#new_topic .topicNumSynapses {
|
||||
height: 14px;
|
||||
padding: 1px 0 1px 32px;
|
||||
background-image: url(synapse16.png);
|
||||
background-image: url(<%= asset_data_uri('synapse16.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 8px 0;
|
||||
position: absolute;
|
||||
|
@ -1563,7 +1564,7 @@ h3.realtimeBoxTitle {
|
|||
width: 32px;
|
||||
height: 32px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
}
|
||||
/* map info box */
|
||||
/* map info box */
|
||||
|
@ -1603,7 +1604,7 @@ h3.realtimeBoxTitle {
|
|||
resize: none;
|
||||
}
|
||||
.mapInfoBox.canEdit #mapInfoName:hover {
|
||||
background-image: url(edit.png);
|
||||
background-image: url(<%= asset_data_uri('edit.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom right;
|
||||
cursor: text;
|
||||
|
@ -1757,11 +1758,11 @@ h3.realtimeBoxTitle {
|
|||
}
|
||||
|
||||
.mapTopics {
|
||||
background-image: url(topic32.png);
|
||||
background-image: url(<%= asset_data_uri('topic32.png') %>);
|
||||
background-position: 13px center;
|
||||
}
|
||||
.mapSynapses {
|
||||
background-image: url(synapse32padded.png);
|
||||
background-image: url(<%= asset_data_uri('synapse32padded.png') %>);
|
||||
background-position: 13px center;
|
||||
}
|
||||
.mapInfoBox .mapPermission {
|
||||
|
@ -1771,7 +1772,7 @@ h3.realtimeBoxTitle {
|
|||
padding: 0;
|
||||
margin: 8px 30px 8px 10px;
|
||||
position: relative;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
}
|
||||
.mapInfoBox .mapPermission.commons {
|
||||
background-position: 0 0;
|
||||
|
@ -1783,12 +1784,12 @@ h3.realtimeBoxTitle {
|
|||
background-position: -32px 0;
|
||||
}
|
||||
.yourMap .mapPermission:hover {
|
||||
background-image: url(arrowperms_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowperms_sprite.png') %>);
|
||||
cursor: pointer;
|
||||
background-position: -32px 0;
|
||||
}
|
||||
.yourMap .mapPermission.minimize {
|
||||
background-image: url(arrowperms_sprite.png) !important;
|
||||
background-image: url(<%= asset_data_uri('arrowperms_sprite.png') %>) !important;
|
||||
cursor: pointer;
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
@ -1803,7 +1804,7 @@ h3.realtimeBoxTitle {
|
|||
width: 32px;
|
||||
height: 32px;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
}
|
||||
.mapInfoBox .mapPermission .permissionSelect .commons {
|
||||
background-position: 0 0;
|
||||
|
@ -1850,7 +1851,7 @@ h3.realtimeBoxTitle {
|
|||
width: 340px;
|
||||
}
|
||||
.mapInfoBox.canEdit .mapInfoDesc:hover {
|
||||
background-image: url(edit.png);
|
||||
background-image: url(<%= asset_data_uri('edit.png') %>);
|
||||
background-position: top right;
|
||||
background-repeat: no-repeat;
|
||||
cursor: text;
|
||||
|
@ -1895,7 +1896,7 @@ h3.realtimeBoxTitle {
|
|||
.mapInfoShareIcon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background-image: url(share_sprite_mapinfo.png);
|
||||
background-image: url(<%= asset_data_uri('share_sprite_mapinfo.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
margin: 4px auto 0;
|
||||
background-position: 0 -24px;
|
||||
|
@ -1916,7 +1917,7 @@ and it won't be important on password protected instances */
|
|||
width: 16px;
|
||||
height: 16px;
|
||||
margin: 8px auto 0;
|
||||
background-image: url(remove_mapinfo_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('remove_mapinfo_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: -16px 0;
|
||||
}
|
||||
|
@ -1977,7 +1978,7 @@ and it won't be important on password protected instances */
|
|||
border: solid 2px #000;
|
||||
}
|
||||
#lightbox_overlay #lightbox_main a#lightbox_close {
|
||||
background-image: url(xlightbox.png);
|
||||
background-image: url(<%= asset_data_uri('xlightbox.png') %>);
|
||||
cursor: pointer;
|
||||
height: 32px;
|
||||
outline-style: none;
|
||||
|
@ -2076,7 +2077,7 @@ and it won't be important on password protected instances */
|
|||
color: #00bcd4;
|
||||
}
|
||||
.lightbox_links .lightboxAboutIcon {
|
||||
background-image: url(about_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('about_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
width:32px;
|
||||
height:32px;
|
||||
|
@ -2145,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;
|
||||
|
@ -2181,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;
|
||||
|
@ -2351,15 +2354,15 @@ and it won't be important on password protected instances */
|
|||
opacity: 0.7;
|
||||
}
|
||||
#chromeIcon {
|
||||
background: url(/assets/browser_icons.png) no-repeat;
|
||||
background: url(<%= asset_data_uri 'browser_icons.png' %>) no-repeat;
|
||||
}
|
||||
|
||||
#fireFoxIcon {
|
||||
background: url(/assets/browser_icons.png) no-repeat -105px 0;
|
||||
background: url(<%= asset_data_uri 'browser_icons.png' %>) no-repeat -105px 0;
|
||||
}
|
||||
|
||||
#safariIcon {
|
||||
background: url(/assets/browser_icons.png) no-repeat -220px 0;
|
||||
background: url(<%= asset_data_uri 'browser_icons.png' %>) no-repeat -220px 0;
|
||||
}
|
||||
|
||||
#chromeIcon:hover{
|
||||
|
@ -2496,7 +2499,7 @@ and it won't be important on password protected instances */
|
|||
position: relative;
|
||||
}
|
||||
.new_map .mapPermIcon {
|
||||
background-image: url(permissions64sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions64sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
width:64px;
|
||||
height:64px;
|
||||
|
@ -2611,7 +2614,7 @@ and it won't be important on password protected instances */
|
|||
}
|
||||
|
||||
#zoomIn {
|
||||
background: #424242 url(zoom_sprite.png) no-repeat;
|
||||
background: #424242 url(<%= asset_data_uri('zoom_sprite.png') %>) no-repeat;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: inline-block;
|
||||
|
@ -2623,7 +2626,7 @@ and it won't be important on password protected instances */
|
|||
}
|
||||
|
||||
#zoomOut {
|
||||
background: #424242 url(zoom_sprite.png) no-repeat;
|
||||
background: #424242 url(<%= asset_data_uri('zoom_sprite.png') %>) no-repeat;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: inline-block;
|
||||
|
@ -2635,7 +2638,7 @@ and it won't be important on password protected instances */
|
|||
}
|
||||
|
||||
#centerMap {
|
||||
background: #424242 url(extents_sprite.png) no-repeat;
|
||||
background: #424242 url(<%= asset_data_uri('extents_sprite.png') %>) no-repeat;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: inline-block;
|
||||
|
@ -2940,7 +2943,7 @@ and it won't be important on password protected instances */
|
|||
.compassArrow {
|
||||
display: none;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(compass_arrow.png);
|
||||
background-image: url(<%= asset_data_uri('compass_arrow.png') %>);
|
||||
width: 48px;
|
||||
height: 32px;
|
||||
position: absolute;
|
|
@ -85,7 +85,7 @@
|
|||
padding: 0 16px;
|
||||
}
|
||||
.canEdit #titleActivator:hover {
|
||||
background-image: url(edit.png);
|
||||
background-image: url(<%= asset_data_uri('edit.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom right;
|
||||
cursor: text;
|
||||
|
@ -148,7 +148,7 @@
|
|||
margin-right: 8px;
|
||||
}
|
||||
.canEdit .CardOnGraph .best_in_place_desc:hover {
|
||||
background-image: url(edit.png);
|
||||
background-image: url(<%= asset_data_uri('edit.png') %>);
|
||||
background-position: top right;
|
||||
background-repeat: no-repeat;
|
||||
cursor: text;
|
||||
|
@ -244,7 +244,7 @@
|
|||
left: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-image: url(map32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('map32_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
cursor: pointer;
|
||||
|
@ -335,7 +335,7 @@
|
|||
left: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-image: url(synapse32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('synapse32_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
@ -382,7 +382,7 @@
|
|||
min-width: 32px;
|
||||
margin-top: 8px;
|
||||
margin-left: 8px;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
background-position: 0 0;
|
||||
}
|
||||
.mapPerm.co {
|
||||
|
@ -396,12 +396,12 @@
|
|||
}
|
||||
|
||||
.yourTopic .mapPerm:hover, .yourEdge .mapPerm:hover {
|
||||
background-image: url(arrowperms_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowperms_sprite.png') %>);
|
||||
background-position: -32px 0;
|
||||
cursor:pointer;
|
||||
}
|
||||
.yourTopic .mapPerm.minimize, .yourEdge .mapPerm.minimize {
|
||||
background-image: url(arrowperms_sprite.png) !important;
|
||||
background-image: url(<%= asset_data_uri('arrowperms_sprite.png') %>) !important;
|
||||
background-position: 0 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ cursor: pointer;
|
|||
height: 32px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
background-image: url(permissions32_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>);
|
||||
}
|
||||
.mapPerm .permissionSelect .commons {
|
||||
background-position: 0 0;
|
||||
|
@ -462,7 +462,7 @@ cursor: pointer;
|
|||
right: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url(arrowright_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowright_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ background-color: #E0E0E0;
|
|||
right: 8px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url(arrowright_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowright_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
|
@ -648,10 +648,10 @@ background-color: #E0E0E0;
|
|||
left: 12px;
|
||||
}
|
||||
#linkIcon {
|
||||
background-image: url(link_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('link_sprite.png') %>);
|
||||
}
|
||||
#uploadIcon {
|
||||
background-image: url(upload_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('upload_sprite.png') %>);
|
||||
}
|
||||
#addlink:hover #linkIcon, #addupload:hover #uploadIcon {
|
||||
background-position: 0 -24px;
|
||||
|
@ -690,7 +690,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
height: 24px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
background-image: url(link_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('link_sprite.png') %>);
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
height: 32px;
|
||||
cursor: pointer;
|
||||
float:none;
|
||||
background-image: url(remove.png);
|
||||
background-image: url(<%= asset_data_uri('remove.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
}
|
||||
|
||||
#linkremove {
|
||||
background-image: url(/assets/remove.png);
|
||||
background-image: url(<%= asset_data_uri 'remove.png' %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
width: 24px;
|
||||
|
@ -781,7 +781,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
}
|
||||
|
||||
#editSynUpperBar {
|
||||
background: #FFFFFF url(synapse32.png) no-repeat 8px center;
|
||||
background: #FFFFFF url(<%= asset_data_uri('synapse32.png') %>) no-repeat 8px center;
|
||||
min-height: 48px;
|
||||
height: 48px;
|
||||
border-bottom: 1px solid #222222;
|
||||
|
@ -814,7 +814,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
}
|
||||
|
||||
.canEdit #edit_synapse_desc:hover {
|
||||
background-image: url(edit.png);
|
||||
background-image: url(<%= asset_data_uri('edit.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 164px center;
|
||||
cursor: text;
|
||||
|
@ -841,7 +841,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
height: 24px;
|
||||
top: 12px;
|
||||
right: 8px;
|
||||
background-image: url(arrowdown_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('arrowdown_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 4px -12px;
|
||||
}
|
||||
|
@ -923,11 +923,11 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
background-repeat: no-repeat;
|
||||
}
|
||||
#edit_synapse_right {
|
||||
background-image: url(synapsedirectionright_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('synapsedirectionright_sprite.png') %>);
|
||||
right: 16px;
|
||||
}
|
||||
#edit_synapse_left {
|
||||
background-image: url(synapsedirectionleft_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('synapsedirectionleft_sprite.png') %>);
|
||||
right: 56px;
|
||||
}
|
||||
#edit_synapse_left.checked, #edit_synapse_right.checked {
|
||||
|
@ -1103,7 +1103,7 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
}
|
||||
|
||||
.mapperMetadata {
|
||||
background: url(profile_card_sprite.png) no-repeat center 0;
|
||||
background: url(<%= asset_data_uri('profile_card_sprite.png') %>) no-repeat center 0;
|
||||
height: 64px;
|
||||
width: 160px;
|
||||
margin: 16px auto 0;
|
||||
|
@ -1126,4 +1126,4 @@ font-family: 'din-regular', helvetica, sans-serif;
|
|||
}
|
||||
.mapperMetadata .metadataSynapses {
|
||||
color: #DAB539;
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
@font-face {
|
||||
font-family: 'din-medium';
|
||||
src: url('/assets/Fonts/din.eot');
|
||||
src: url('/assets/Fonts/din.eot?#iefix') format('embedded-opentype'),
|
||||
url('/assets/Fonts/din.woff') format('woff'),
|
||||
url('/assets/Fonts/din.ttf') format('truetype'),
|
||||
url('/assets/Fonts/din.svg#din-medium') format('svg');
|
||||
src: url(<%= asset_path 'Fonts/din.eot' %>);
|
||||
src: url(<%= asset_path 'Fonts/din.eot?#iefix' %>) format('embedded-opentype'),
|
||||
url(<%= asset_path 'Fonts/din.woff' %>) format('woff'),
|
||||
url(<%= asset_path 'Fonts/din.ttf' %>) format('truetype'),
|
||||
url(<%= asset_path 'Fonts/din.svg#din-medium' %>) format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'din-regular';
|
||||
src: url('/assets/Fonts/din-reg.eot');
|
||||
src: url('/assets/Fonts/din-reg.eot?#iefix') format('embedded-opentype'),
|
||||
url('/assets/Fonts/din-reg.woff') format('woff'),
|
||||
url('/assets/Fonts/din-reg.ttf') format('truetype'),
|
||||
url('/assets/Fonts/din-reg.svg#din-reg') format('svg');
|
||||
src: url(<%= asset_path 'Fonts/din-reg.eot' %>);
|
||||
src: url(<%= asset_path 'Fonts/din-reg.eot?#iefix' %>) format('embedded-opentype'),
|
||||
url(<%= asset_path 'Fonts/din-reg.woff' %>) format('woff'),
|
||||
url(<%= asset_path 'Fonts/din-reg.ttf' %>) format('truetype'),
|
||||
url(<%= asset_path 'Fonts/din-reg.svg#din-reg' %>) format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@
|
|||
width: 40px;
|
||||
height: 32px;
|
||||
background-color: #757575;
|
||||
background-image: url(home_light.png);
|
||||
background-image: url(<%= asset_data_uri('home_light.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
border-top-left-radius: 2px;
|
||||
|
@ -142,7 +142,7 @@
|
|||
float:left;
|
||||
}
|
||||
.homeButton:hover {
|
||||
background-image: url(home_light.png);
|
||||
background-image: url(<%= asset_data_uri('home_light.png') %>);
|
||||
}
|
||||
.homeButton a {
|
||||
display:block;
|
||||
|
@ -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('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(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-suggestions {
|
||||
overflow: visible;
|
||||
}
|
||||
.sidebarSearch .tt-suggestion {
|
||||
position: relative;
|
||||
background: #FFF;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.sidebarSearch .tt-is-under-cursor,
|
||||
.sidebarSearch .tt-is-under-mouse-cursor {
|
||||
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(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(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(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(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(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 */
|
||||
|
@ -665,7 +201,7 @@
|
|||
.upperRightIcon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-image: url('topright_sprite.png');
|
||||
background-image: url(<%= asset_data_uri('topright_sprite.png') %>);
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -816,12 +352,12 @@
|
|||
}
|
||||
|
||||
.fullWidthWrapper.withPartners {
|
||||
background: url(homepage_bg_fade.png) no-repeat center -300px;
|
||||
background: url(<%= asset_data_uri('homepage_bg_fade.png') %>) no-repeat center -300px;
|
||||
}
|
||||
.homeWrapper.homePartners {
|
||||
padding: 64px 0 280px;
|
||||
height: 96px;
|
||||
background: url(partner_logos.png) no-repeat 0 64px;
|
||||
background: url(<%= asset_data_uri('partner_logos.png') %>) no-repeat 0 64px;
|
||||
}
|
||||
|
||||
.github-fork-ribbon-wrapper {
|
||||
|
@ -863,7 +399,7 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
.openCheatsheet {
|
||||
background-image: url('help_sprite.png');
|
||||
background-image: url(<%= asset_data_uri('help_sprite.png') %>);
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
.openCheatsheet:hover {
|
||||
|
@ -872,7 +408,7 @@
|
|||
.mapInfoIcon {
|
||||
position: relative;
|
||||
top: 56px; /* puts it just offscreen */
|
||||
background-image: url('mapinfo_sprite.png');
|
||||
background-image: url(<%= asset_data_uri('mapinfo_sprite.png') %>);
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
.mapInfoIcon:hover {
|
||||
|
@ -918,7 +454,7 @@
|
|||
.takeScreenshot {
|
||||
margin-bottom: 5px;
|
||||
border-radius: 2px;
|
||||
background-image: url(screenshot_sprite.png);
|
||||
background-image: url(<%= asset_data_uri 'screenshot_sprite.png' %>);
|
||||
display: none;
|
||||
}
|
||||
.takeScreenshot:hover {
|
||||
|
@ -931,7 +467,7 @@
|
|||
.zoomExtents {
|
||||
margin-bottom:5px;
|
||||
border-radius: 2px;
|
||||
background-image: url(extents_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('extents_sprite.png') %>);
|
||||
}
|
||||
|
||||
.zoomExtents:hover {
|
||||
|
@ -1076,7 +612,7 @@
|
|||
}
|
||||
|
||||
.zoomIn {
|
||||
background-image: url(zoom_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('zoom_sprite.png') %>);
|
||||
background-position: 0 /…0;
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
|
@ -1085,7 +621,7 @@
|
|||
background-position: -32px 0;
|
||||
}
|
||||
.zoomOut {
|
||||
background-image: url(zoom_sprite.png);
|
||||
background-image: url(<%= asset_data_uri('zoom_sprite.png') %>);
|
||||
background-position:0 -32px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
|
@ -1163,15 +699,15 @@
|
|||
left:5px;
|
||||
}
|
||||
.exploreMapsCenter .myMaps .exploreMapsIcon {
|
||||
background-image: url(exploremaps_sprite.png);
|
||||
background-image: url(<%= asset_data_uri 'exploremaps_sprite.png' %>);
|
||||
background-position: 0 0;
|
||||
}
|
||||
.exploreMapsCenter .activeMaps .exploreMapsIcon {
|
||||
background-image: url(exploremaps_sprite.png);
|
||||
background-image: url(<%= asset_data_uri 'exploremaps_sprite.png' %>);
|
||||
background-position: -32px 0;
|
||||
}
|
||||
.exploreMapsCenter .featuredMaps .exploreMapsIcon {
|
||||
background-image: url(exploremaps_sprite.png);
|
||||
background-image: url(<%= asset_data_uri 'exploremaps_sprite.png' %>);
|
||||
background-position: -64px 0;
|
||||
}
|
||||
.myMaps:hover .exploreMapsIcon, .myMaps.active .exploreMapsIcon {
|
||||
|
@ -1212,7 +748,7 @@
|
|||
|
||||
/* feedback */
|
||||
body a#barometer_tab {
|
||||
background-image: url(feedback_sprite.png);
|
||||
background-image: url(<%= asset_path 'feedback_sprite.png' %>);
|
||||
background-position: 0 0;
|
||||
background-color: transparent;
|
||||
height: 110px;
|
||||
|
@ -1227,4 +763,4 @@ box-shadow: 0px 1px 1.5px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.24);
|
|||
|
||||
body a#barometer_tab:hover {
|
||||
background-position: 0 -110px;
|
||||
}
|
||||
}
|
|
@ -243,25 +243,25 @@ body .ui-tooltip { border-width: 2px; }
|
|||
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }
|
||||
.ui-widget .ui-widget { font-size: 1em; }
|
||||
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }
|
||||
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
|
||||
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(<%= asset_data_uri('ui-bg_flat_75_ffffff_40x100.png') %>)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }
|
||||
.ui-widget-content a { color: #222222/*{fcContent}*/; }
|
||||
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
|
||||
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(<%= asset_data_uri('images/ui-bg_highlight-soft_75_cccccc_1x100.png') %>)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }
|
||||
.ui-widget-header a { color: #222222/*{fcHeader}*/; }
|
||||
|
||||
/* Interaction states
|
||||
----------------------------------*/
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(<%= asset_data_uri('images/ui-bg_glass_75_e6e6e6_1x400.png') %>)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }
|
||||
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }
|
||||
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 0px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
|
||||
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 0px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(<%= asset_data_uri('images/ui-bg_glass_75_dadada_1x400.png') %>)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }
|
||||
.ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121/*{fcHover}*/; text-decoration: none; }
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(<%= asset_data_uri('images/ui-bg_glass_65_ffffff_1x400.png') %>)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }
|
||||
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
|
||||
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(<%= asset_data_uri('images/ui-bg_glass_55_fbf9ee_1x400.png') %>)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }
|
||||
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }
|
||||
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
|
||||
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(<%= asset_data_uri('images/ui-bg_glass_95_fef1ec_1x400.png') %>)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }
|
||||
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }
|
||||
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }
|
||||
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
||||
|
@ -273,14 +273,14 @@ body .ui-tooltip { border-width: 2px; }
|
|||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
|
||||
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }
|
||||
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }
|
||||
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }
|
||||
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }
|
||||
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }
|
||||
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }
|
||||
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }
|
||||
.ui-icon { width: 16px; height: 16px; background-image: url(<%= asset_data_uri('images/ui-icons_222222_256x240.png') %>)/*{iconsContent}*/; }
|
||||
.ui-widget-content .ui-icon {background-image: url(<%= asset_data_uri('images/ui-icons_222222_256x240.png') %>)/*{iconsContent}*/; }
|
||||
.ui-widget-header .ui-icon {background-image: url(<%= asset_data_uri('images/ui-icons_222222_256x240.png') %>)/*{iconsHeader}*/; }
|
||||
.ui-state-default .ui-icon { background-image: url(<%= asset_data_uri('images/ui-icons_888888_256x240.png') %>)/*{iconsDefault}*/; }
|
||||
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(<%= asset_data_uri('images/ui-icons_454545_256x240.png') %>)/*{iconsHover}*/; }
|
||||
.ui-state-active .ui-icon {background-image: url(<%= asset_data_uri('images/ui-icons_454545_256x240.png') %>)/*{iconsActive}*/; }
|
||||
.ui-state-highlight .ui-icon {background-image: url(<%= asset_data_uri('images/ui-icons_2e83ff_256x240.png') %>)/*{iconsHighlight}*/; }
|
||||
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(<%= asset_data_uri('images/ui-icons_cd0a0a_256x240.png') %>)/*{iconsError}*/; }
|
||||
|
||||
/* positioning */
|
||||
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||
|
@ -470,5 +470,5 @@ body .ui-tooltip { border-width: 2px; }
|
|||
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
|
||||
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
|
||||
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(<%= asset_data_uri('images/ui-bg_flat_0_aaaaaa_40x100.png') %>)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
|
||||
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/<%= asset_data_uri('ui-bg_flat_0_aaaaaa_40x100.png') %>)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }
|
|
@ -162,7 +162,6 @@
|
|||
.mCSB_scrollTools .mCSB_buttonDown,
|
||||
.mCSB_scrollTools .mCSB_buttonLeft,
|
||||
.mCSB_scrollTools .mCSB_buttonRight{
|
||||
background-image:url(mCSB_buttons.png);
|
||||
background-repeat:no-repeat;
|
||||
opacity:0.4;
|
||||
filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */
|
||||
|
@ -471,4 +470,4 @@
|
|||
}
|
||||
.mCS-dark-thin>.mCSB_scrollTools .mCSB_buttonRight{
|
||||
background-position:-80px -56px;
|
||||
}
|
||||
}
|
492
app/assets/stylesheets/search.scss.erb
Normal file
492
app/assets/stylesheets/search.scss.erb
Normal file
|
@ -0,0 +1,492 @@
|
|||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
.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 */
|
|
@ -6,7 +6,7 @@
|
|||
}
|
||||
|
||||
div.uv-icon.uv-bottom-left {
|
||||
background-image:url(feedback_sprite.png);
|
||||
background-image: url(<%= asset_data_uri 'feedback_sprite.png' %>);
|
||||
background-repeat: no-repeat;
|
||||
color:#FFFFFF;
|
||||
cursor:pointer;
|
||||
|
@ -22,4 +22,4 @@ div.uv-icon.uv-bottom-left {
|
|||
|
||||
div.uv-icon.uv-bottom-left:hover {
|
||||
background-position: 0 -110px;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
|
||||
before_filter :get_invite_link
|
||||
|
||||
# this is for global login
|
||||
include ContentHelper
|
||||
|
@ -9,7 +11,13 @@ class ApplicationController < ActionController::Base
|
|||
helper_method :admin?
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
sign_in_url = url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => 'http')
|
||||
unsafe_uri = request.env["REQUEST_URI"]
|
||||
if unsafe_uri.starts_with?('http') && !unsafe_uri.starts_with?('https')
|
||||
protocol = 'http'
|
||||
else
|
||||
protocol = 'https'
|
||||
end
|
||||
sign_in_url = url_for(:action => 'new', :controller => 'sessions', :only_path => false, :protocol => protocol)
|
||||
|
||||
if request.referer == sign_in_url
|
||||
super
|
||||
|
@ -37,7 +45,7 @@ private
|
|||
end
|
||||
|
||||
def require_admin
|
||||
unless authenticated? && user.admin
|
||||
unless authenticated? && admin?
|
||||
redirect_to root_url, notice: "You need to be an admin for that."
|
||||
return false
|
||||
end
|
||||
|
@ -47,13 +55,18 @@ private
|
|||
current_user
|
||||
end
|
||||
|
||||
|
||||
def authenticated?
|
||||
current_user
|
||||
end
|
||||
|
||||
def admin?
|
||||
current_user && current_user.admin
|
||||
authenticated? && current_user.admin
|
||||
end
|
||||
|
||||
def get_invite_link
|
||||
unsafe_uri = request.env["REQUEST_URI"] || 'https://metamaps.cc'
|
||||
valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/
|
||||
safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : '//metamaps.cc/'
|
||||
@invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -68,25 +66,20 @@ class MainController < ApplicationController
|
|||
else
|
||||
search = term.downcase + '%'
|
||||
|
||||
if !user
|
||||
@topics = Topic.where('LOWER("name") like ?', search).where('metacode_id = ?', filterByMetacode.id).order('"name"')
|
||||
@topics2 = Topic.where('LOWER("name") like ?', '%' + search).where('metacode_id = ?', filterByMetacode.id).order('"name"')
|
||||
@topics3 = Topic.where('LOWER("desc") like ?', '%' + search).where('metacode_id = ?', filterByMetacode.id).order('"name"')
|
||||
@topics4 = Topic.where('LOWER("link") like ?', '%' + search).where('metacode_id = ?', filterByMetacode.id).order('"name"')
|
||||
@topics = @topics + (@topics2 - @topics)
|
||||
@topics = @topics + (@topics3 - @topics)
|
||||
@topics = @topics + (@topics4 - @topics)
|
||||
|
||||
elsif user
|
||||
@topics = Topic.where('LOWER("name") like ?', search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"')
|
||||
@topics2 = Topic.where('LOWER("name") like ?', '%' + search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"')
|
||||
@topics3 = Topic.where('LOWER("desc") like ?', '%' + search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"')
|
||||
@topics4 = Topic.where('LOWER("link") like ?', '%' + search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"')
|
||||
@topics = @topics + (@topics2 - @topics)
|
||||
@topics = @topics + (@topics3 - @topics)
|
||||
@topics = @topics + (@topics4 - @topics)
|
||||
|
||||
if user
|
||||
@topics = Set.new(Topic.where('LOWER("name") like ?', search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"'))
|
||||
@topics2 = Set.new(Topic.where('LOWER("name") like ?', '%' + search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"'))
|
||||
@topics3 = Set.new(Topic.where('LOWER("desc") like ?', '%' + search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"'))
|
||||
@topics4 = Set.new(Topic.where('LOWER("link") like ?', '%' + search).where('metacode_id = ? AND user_id = ?', filterByMetacode.id, user).order('"name"'))
|
||||
else
|
||||
@topics = Set.new(Topic.where('LOWER("name") like ?', search).where('metacode_id = ?', filterByMetacode.id).order('"name"'))
|
||||
@topics2 = Set.new(Topic.where('LOWER("name") like ?', '%' + search).where('metacode_id = ?', filterByMetacode.id).order('"name"'))
|
||||
@topics3 = Set.new(Topic.where('LOWER("desc") like ?', '%' + search).where('metacode_id = ?', filterByMetacode.id).order('"name"'))
|
||||
@topics4 = Set.new(Topic.where('LOWER("link") like ?', '%' + search).where('metacode_id = ?', filterByMetacode.id).order('"name"'))
|
||||
end
|
||||
|
||||
#get unique elements only through the magic of Sets
|
||||
@topics = (@topics + @topics2 + @topics3 + @topics4).to_a
|
||||
end
|
||||
elsif desc
|
||||
search = '%' + term.downcase + '%'
|
||||
|
@ -127,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.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
|
||||
|
||||
|
@ -163,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.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:"
|
||||
|
||||
|
@ -187,19 +176,17 @@ 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]
|
||||
|
||||
|
||||
if term && !term.empty?
|
||||
@synapses = Synapse.select('DISTINCT "desc"').where('LOWER("desc") like ?', '%' + term.downcase + '%').order('"desc"')
|
||||
@synapses = Synapse.where('LOWER("desc") like ?', '%' + term.downcase + '%').order('"desc"')
|
||||
|
||||
# remove any duplicate synapse types that just differ by
|
||||
# leading or trailing whitespaces
|
||||
collectedDesc = []
|
||||
@synapses.delete_if {|s|
|
||||
@synapses.to_a.uniq(&:desc).delete_if {|s|
|
||||
desc = s.desc == nil || s.desc == "" ? "" : s.desc.strip
|
||||
if collectedDesc.index(desc) == nil
|
||||
collectedDesc.push(desc)
|
||||
|
@ -211,23 +198,20 @@ class MainController < ApplicationController
|
|||
|
||||
#limit to 5 results
|
||||
@synapses = @synapses.slice(0,5)
|
||||
|
||||
render json: autocomplete_synapse_generic_json(@synapses)
|
||||
|
||||
elsif topic1id && !topic1id.empty?
|
||||
@one = Synapse.where('node1_id = ? AND node2_id = ?', topic1id, topic2id)
|
||||
@two = Synapse.where('node2_id = ? AND node1_id = ?', topic1id, topic2id)
|
||||
@synapses = @one + @two
|
||||
@synapses.sort! {|s1,s2| s1.desc <=> s2.desc }
|
||||
@synapses.sort! {|s1,s2| s1.desc <=> s2.desc }.to_a
|
||||
|
||||
#read this next line as 'delete a synapse if its private and you're either 1. logged out or 2. logged in but not the synapse creator
|
||||
@synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
|
||||
render json: autocomplete_synapse_array_json(@synapses)
|
||||
#permissions
|
||||
@synapses.delete_if {|s| s.permission == "private" && !authenticated? }
|
||||
@synapses.delete_if {|s| s.permission == "private" && authenticated? && current_user.id != s.user_id }
|
||||
else
|
||||
@synapses = []
|
||||
render json: autocomplete_synapse_array_json(@synapses)
|
||||
end
|
||||
|
||||
render json: autocomplete_synapse_array_json(@synapses)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ class MappingsController < ApplicationController
|
|||
|
||||
# POST /mappings.json
|
||||
def create
|
||||
@mapping = Mapping.new(params[:mapping])
|
||||
@mapping = Mapping.new(mapping_params)
|
||||
|
||||
@mapping.map.touch(:updated_at)
|
||||
|
||||
|
@ -30,7 +30,7 @@ class MappingsController < ApplicationController
|
|||
|
||||
@mapping.map.touch(:updated_at)
|
||||
|
||||
if @mapping.update_attributes(params[:mapping])
|
||||
if @mapping.update_attributes(mapping_params)
|
||||
head :no_content
|
||||
else
|
||||
render json: @mapping.errors, status: :unprocessable_entity
|
||||
|
@ -48,4 +48,10 @@ class MappingsController < ApplicationController
|
|||
|
||||
head :no_content
|
||||
end
|
||||
|
||||
private
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def mapping_params
|
||||
params.require(:mapping).permit(:id, :xloc, :yloc, :mappable_id, :mappable_type, :map_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -72,14 +72,10 @@ class MapsController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.html {
|
||||
@allmappers = @map.contributors
|
||||
@alltopics = @map.topics.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
@allsynapses = @map.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@allmappings = @map.mappings.delete_if {|m|
|
||||
if m.category == "Synapse"
|
||||
object = m.synapse
|
||||
elsif m.category == "Topic"
|
||||
object = m.topic
|
||||
end
|
||||
@alltopics = @map.topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
@allsynapses = @map.synapses.to_a.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@allmappings = @map.mappings.to_a.delete_if {|m|
|
||||
object = m.mappable
|
||||
!object || (object.permission == "private" && (!authenticated? || (authenticated? && @current.id != object.user_id)))
|
||||
}
|
||||
|
||||
|
@ -100,14 +96,10 @@ class MapsController < ApplicationController
|
|||
end
|
||||
|
||||
@allmappers = @map.contributors
|
||||
@alltopics = @map.topics.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
@allsynapses = @map.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@allmappings = @map.mappings.delete_if {|m|
|
||||
if m.category == "Synapse"
|
||||
object = m.synapse
|
||||
elsif m.category == "Topic"
|
||||
object = m.topic
|
||||
end
|
||||
@alltopics = @map.topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
@allsynapses = @map.synapses.to_a.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@allmappings = @map.mappings.to_a.delete_if {|m|
|
||||
object = m.mappable
|
||||
!object || (object.permission == "private" && (!authenticated? || (authenticated? && @current.id != object.user_id)))
|
||||
}
|
||||
|
||||
|
@ -141,10 +133,9 @@ class MapsController < ApplicationController
|
|||
@all.each do |topic|
|
||||
topic = topic.split('/')
|
||||
@mapping = Mapping.new()
|
||||
@mapping.category = "Topic"
|
||||
@mapping.user = @user
|
||||
@mapping.map = @map
|
||||
@mapping.topic = Topic.find(topic[0])
|
||||
@mapping.mappable = Topic.find(topic[0])
|
||||
@mapping.xloc = topic[1]
|
||||
@mapping.yloc = topic[2]
|
||||
@mapping.save
|
||||
|
@ -155,10 +146,9 @@ class MapsController < ApplicationController
|
|||
@synAll = @synAll.split(',')
|
||||
@synAll.each do |synapse_id|
|
||||
@mapping = Mapping.new()
|
||||
@mapping.category = "Synapse"
|
||||
@mapping.user = @user
|
||||
@mapping.map = @map
|
||||
@mapping.synapse = Synapse.find(synapse_id)
|
||||
@mapping.mappable = Synapse.find(synapse_id)
|
||||
@mapping.save
|
||||
end
|
||||
end
|
||||
|
@ -180,7 +170,7 @@ class MapsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if !@map
|
||||
format.json { render json: "unauthorized" }
|
||||
elsif @map.update_attributes(params[:map])
|
||||
elsif @map.update_attributes(map_params)
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.json { render json: @map.errors, status: :unprocessable_entity }
|
||||
|
@ -218,15 +208,7 @@ class MapsController < ApplicationController
|
|||
|
||||
@map = Map.find(params[:id]).authorize_to_delete(@current)
|
||||
|
||||
if @map
|
||||
@mappings = @map.mappings
|
||||
|
||||
@mappings.each do |mapping|
|
||||
mapping.delete
|
||||
end
|
||||
|
||||
@map.delete
|
||||
end
|
||||
@map.delete if @map
|
||||
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
|
@ -238,4 +220,11 @@ class MapsController < ApplicationController
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def map_params
|
||||
params.require(:map).permit(:id, :name, :arranged, :desc, :permission, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class MetacodeSetsController < ApplicationController
|
||||
|
||||
before_filter :require_admin
|
||||
|
||||
|
||||
# GET /metacode_sets
|
||||
# GET /metacode_sets.json
|
||||
def index
|
||||
|
@ -45,7 +45,7 @@ class MetacodeSetsController < ApplicationController
|
|||
# POST /metacode_sets.json
|
||||
def create
|
||||
@user = current_user
|
||||
@metacode_set = MetacodeSet.new(params[:metacode_set])
|
||||
@metacode_set = MetacodeSet.new(metacode_set_params)
|
||||
@metacode_set.user_id = @user.id
|
||||
|
||||
respond_to do |format|
|
||||
|
@ -70,7 +70,7 @@ class MetacodeSetsController < ApplicationController
|
|||
@metacode_set = MetacodeSet.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @metacode_set.update_attributes(params[:metacode_set])
|
||||
if @metacode_set.update_attributes(metacode_set_params)
|
||||
|
||||
# build an array of the IDs of the metacodes currently in the set
|
||||
@currentMetacodes = @metacode_set.metacodes.map{ |m| m.id.to_s }
|
||||
|
@ -116,4 +116,11 @@ class MetacodeSetsController < ApplicationController
|
|||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def metacode_set_params
|
||||
params.require(:metacode_set).permit(:desc, :mapperContributed, :name)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
class MetacodesController < ApplicationController
|
||||
|
||||
before_filter :require_admin, except: [:index]
|
||||
|
||||
# GET /metacodes
|
||||
# GET /metacodes.json
|
||||
def index
|
||||
|
||||
@metacodes = Metacode.order("name").all
|
||||
@metacodes.map do |metacode|
|
||||
metacode.icon = ActionController::Base.helpers.asset_path(metacode.icon)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -51,7 +52,7 @@ class MetacodesController < ApplicationController
|
|||
# POST /metacodes
|
||||
# POST /metacodes.json
|
||||
def create
|
||||
@metacode = Metacode.new(params[:metacode])
|
||||
@metacode = Metacode.new(metacode_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @metacode.save
|
||||
|
@ -70,7 +71,7 @@ class MetacodesController < ApplicationController
|
|||
@metacode = Metacode.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @metacode.update_attributes(params[:metacode])
|
||||
if @metacode.update_attributes(metacode_params)
|
||||
format.html { redirect_to metacodes_url, notice: 'Metacode was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
|
@ -93,4 +94,11 @@ class MetacodesController < ApplicationController
|
|||
# format.json { head :no_content }
|
||||
# end
|
||||
# end
|
||||
|
||||
private
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def metacode_params
|
||||
params.require(:metacode).permit(:id, :name, :icon, :color)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
|
@ -21,7 +21,8 @@ class SynapsesController < ApplicationController
|
|||
# POST /synapses
|
||||
# POST /synapses.json
|
||||
def create
|
||||
@synapse = Synapse.new(params[:synapse])
|
||||
@synapse = Synapse.new(synapse_params)
|
||||
@synapse.update_attribute :desc, "" if @synapse.desc.nil?
|
||||
|
||||
respond_to do |format|
|
||||
if @synapse.save
|
||||
|
@ -36,9 +37,10 @@ class SynapsesController < ApplicationController
|
|||
# PUT /synapses/1.json
|
||||
def update
|
||||
@synapse = Synapse.find(params[:id])
|
||||
@synapse.update_attribute :desc, "" if @synapse.desc.nil?
|
||||
|
||||
respond_to do |format|
|
||||
if @synapse.update_attributes(params[:synapse])
|
||||
if @synapse.update_attributes(synapse_params)
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.json { render json: @synapse.errors, status: :unprocessable_entity }
|
||||
|
@ -48,20 +50,17 @@ class SynapsesController < ApplicationController
|
|||
|
||||
# DELETE synapses/:id
|
||||
def destroy
|
||||
@current = current_user
|
||||
@synapse = Synapse.find(params[:id]).authorize_to_delete(@current)
|
||||
|
||||
if @synapse
|
||||
@synapse.mappings.each do |m|
|
||||
m.map.touch(:updated_at)
|
||||
m.delete
|
||||
end
|
||||
|
||||
@synapse.delete
|
||||
end
|
||||
@synapse = Synapse.find(params[:id]).authorize_to_delete(current_user)
|
||||
@synapse.delete if @synapse
|
||||
|
||||
respond_to do |format|
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def synapse_params
|
||||
params.require(:synapse).permit(:id, :desc, :category, :weight, :permission, :node1_id, :node2_id, :user_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,12 +10,11 @@ class TopicsController < ApplicationController
|
|||
@current = current_user
|
||||
term = params[:term]
|
||||
if term && !term.empty?
|
||||
# !connor term here needs to have .downcase
|
||||
@topics = Topic.where('LOWER("name") like ?', term.downcase + '%').order('"name"')
|
||||
|
||||
#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.delete_if {|t| t.permission == "private" &&
|
||||
@topics.to_a.delete_if {|t| t.permission == "private" &&
|
||||
(!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
else
|
||||
@topics = []
|
||||
|
@ -35,7 +34,7 @@ class TopicsController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.html {
|
||||
@alltopics = ([@topic] + @topic.relatives).delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) } # should limit to topics visible to user
|
||||
@allsynapses = @topic.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@allsynapses = @topic.synapses.to_a.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
|
||||
@allcreators = []
|
||||
@alltopics.each do |t|
|
||||
|
@ -64,8 +63,8 @@ class TopicsController < ApplicationController
|
|||
redirect_to root_url, notice: "Access denied. That topic is private." and return
|
||||
end
|
||||
|
||||
@alltopics = @topic.relatives.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
@allsynapses = @topic.synapses.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@alltopics = @topic.relatives.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) }
|
||||
@allsynapses = @topic.synapses.to_a.delete_if {|s| s.permission == "private" && (!authenticated? || (authenticated? && @current.id != s.user_id)) }
|
||||
@allcreators = []
|
||||
@allcreators.push(@topic.user)
|
||||
@alltopics.each do |t|
|
||||
|
@ -101,7 +100,7 @@ class TopicsController < ApplicationController
|
|||
|
||||
@topicsAlreadyHas = params[:network] ? params[:network].split(',') : []
|
||||
|
||||
@alltopics = @topic.relatives.delete_if {|t|
|
||||
@alltopics = @topic.relatives.to_a.delete_if {|t|
|
||||
@topicsAlreadyHas.index(t.id.to_s) != nil ||
|
||||
(t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)))
|
||||
}
|
||||
|
@ -133,7 +132,7 @@ class TopicsController < ApplicationController
|
|||
|
||||
@topicsAlreadyHas = params[:network] ? params[:network].split(',') : []
|
||||
|
||||
@alltopics = @topic.relatives.delete_if {|t|
|
||||
@alltopics = @topic.relatives.to_a.delete_if {|t|
|
||||
@topicsAlreadyHas.index(t.id.to_s) != nil ||
|
||||
(params[:metacode] && t.metacode_id.to_s != params[:metacode]) ||
|
||||
(t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)))
|
||||
|
@ -141,7 +140,7 @@ class TopicsController < ApplicationController
|
|||
|
||||
@alltopics.uniq!
|
||||
|
||||
@allsynapses = @topic.synapses.delete_if {|s|
|
||||
@allsynapses = @topic.synapses.to_a.delete_if {|s|
|
||||
(s.topic1 == @topic && @alltopics.index(s.topic2) == nil) ||
|
||||
(s.topic2 == @topic && @alltopics.index(s.topic1) == nil)
|
||||
}
|
||||
|
@ -172,7 +171,7 @@ class TopicsController < ApplicationController
|
|||
# POST /topics
|
||||
# POST /topics.json
|
||||
def create
|
||||
@topic = Topic.new(params[:topic])
|
||||
@topic = Topic.new(topic_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @topic.save
|
||||
|
@ -189,7 +188,7 @@ class TopicsController < ApplicationController
|
|||
@topic = Topic.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @topic.update_attributes(params[:topic])
|
||||
if @topic.update_attributes(topic_params)
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.json { render json: @topic.errors, status: :unprocessable_entity }
|
||||
|
@ -201,36 +200,16 @@ class TopicsController < ApplicationController
|
|||
def destroy
|
||||
@current = current_user
|
||||
@topic = Topic.find(params[:id]).authorize_to_delete(@current)
|
||||
|
||||
if @topic
|
||||
@synapses = @topic.synapses
|
||||
@mappings = @topic.mappings
|
||||
|
||||
@synapses.each do |synapse|
|
||||
synapse.mappings.each do |m|
|
||||
|
||||
@map = m.map
|
||||
@map.touch(:updated_at)
|
||||
|
||||
m.delete
|
||||
end
|
||||
|
||||
synapse.delete
|
||||
end
|
||||
|
||||
@mappings.each do |mapping|
|
||||
|
||||
@map = mapping.map
|
||||
@map.touch(:updated_at)
|
||||
|
||||
mapping.delete
|
||||
end
|
||||
|
||||
@topic.delete
|
||||
end
|
||||
@topic.delete if @topic
|
||||
|
||||
respond_to do |format|
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def topic_params
|
||||
params.require(:topic).permit(:id, :name, :desc, :link, :permission, :user_id, :metacode_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,4 +3,4 @@ class Users::PasswordsController < Devise::PasswordsController
|
|||
def after_resetting_password_path_for(resource)
|
||||
signed_in_root_path(resource)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
class UsersController < ApplicationController
|
||||
|
||||
before_filter :require_user, only: [:edit, :update, :updatemetacodes]
|
||||
|
||||
respond_to :html, :json
|
||||
|
||||
|
||||
# GET /users/1.json
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
|
@ -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
|
||||
|
@ -98,4 +96,9 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :email, :image, :password, :password_confirmation)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +1,18 @@
|
|||
module ApplicationHelper
|
||||
def get_metacodeset
|
||||
@m = user.settings.metacodes
|
||||
set = @m[0].include?("metacodeset") ? MetacodeSet.find(@m[0].sub("metacodeset-","").to_i) : false
|
||||
return set
|
||||
end
|
||||
|
||||
def user_metacodes
|
||||
@m = user.settings.metacodes
|
||||
set = get_metacodeset
|
||||
if set
|
||||
@metacodes = set.metacodes.to_a
|
||||
else
|
||||
@metacodes = Metacode.where(id: @m).to_a
|
||||
end
|
||||
@metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module MapsHelper
|
|||
map['rtype'] = "map"
|
||||
|
||||
contributorTip = ''
|
||||
firstContributorImage = '/assets/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|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
class InMetacodeSet < ActiveRecord::Base
|
||||
belongs_to :metacode, :class_name => "Metacode", :foreign_key => "metacode_id"
|
||||
belongs_to :metacode_set, :class_name => "MetacodeSet", :foreign_key => "metacode_set_id"
|
||||
# attr_accessible :title, :body
|
||||
end
|
||||
|
|
|
@ -2,18 +2,21 @@ class Map < ActiveRecord::Base
|
|||
|
||||
belongs_to :user
|
||||
|
||||
has_many :topicmappings, :class_name => 'Mapping', :conditions => {:category => 'Topic'}
|
||||
has_many :synapsemappings, :class_name => 'Mapping', :conditions => {:category => 'Synapse'}
|
||||
|
||||
has_many :topics, :through => :topicmappings
|
||||
has_many :synapses, :through => :synapsemappings
|
||||
has_many :topicmappings, -> { Mapping.topicmapping }, class_name: :Mapping, dependent: :destroy
|
||||
has_many :synapsemappings, -> { Mapping.synapsemapping }, class_name: :Mapping, dependent: :destroy
|
||||
has_many :topics, through: :topicmappings, source: :mappable, source_type: "Topic"
|
||||
has_many :synapses, through: :synapsemappings, source: :mappable, source_type: "Synapse"
|
||||
|
||||
# This method associates the attribute ":image" with a file attachment
|
||||
has_attached_file :screenshot, :styles => {
|
||||
:thumb => ['188x126#', :png]
|
||||
#:full => ['940x630#', :png]
|
||||
},
|
||||
:default_url => "/assets/missing-map.png"
|
||||
:default_url => 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png'
|
||||
validates :name, presence: true
|
||||
validates :arranged, inclusion: { in: [true, false] }
|
||||
validates :permission, presence: true
|
||||
validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) }
|
||||
|
||||
# Validate the attached image is image/jpg, image/png, etc
|
||||
validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/
|
||||
|
@ -23,13 +26,7 @@ class Map < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def mk_permission
|
||||
if self.permission == "commons"
|
||||
"co"
|
||||
elsif self.permission == "public"
|
||||
"pu"
|
||||
elsif self.permission == "private"
|
||||
"pr"
|
||||
end
|
||||
Perm.short(permission)
|
||||
end
|
||||
|
||||
#return an array of the contributors to the map
|
||||
|
@ -110,14 +107,6 @@ class Map < ActiveRecord::Base
|
|||
end
|
||||
return self
|
||||
end
|
||||
|
||||
# returns Boolean if user allowed to view Topic, Synapse, or Map
|
||||
def authorize_to_view(user)
|
||||
if (self.permission == "private" && self.user != user)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def decode_base64(imgBase64)
|
||||
decoded_data = Base64.decode64(imgBase64)
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
class Mapping < ActiveRecord::Base
|
||||
|
||||
belongs_to :topic, :class_name => "Topic", :foreign_key => "topic_id"
|
||||
belongs_to :synapse, :class_name => "Synapse", :foreign_key => "synapse_id"
|
||||
scope :topicmapping, -> { where(mappable_type: :Topic) }
|
||||
scope :synapsemapping, -> { where(mappable_type: :Synapse) }
|
||||
|
||||
belongs_to :mappable, polymorphic: true
|
||||
|
||||
belongs_to :map, :class_name => "Map", :foreign_key => "map_id"
|
||||
|
||||
belongs_to :user
|
||||
|
|
|
@ -13,5 +13,4 @@ class Metacode < ActiveRecord::Base
|
|||
return true if self.metacode_sets.include? metacode_set
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class MetacodeSet < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
attr_accessible :desc, :mapperContributed, :name
|
||||
has_many :in_metacode_sets
|
||||
has_many :metacodes, :through => :in_metacode_sets
|
||||
end
|
||||
|
|
|
@ -5,9 +5,14 @@ class Synapse < ActiveRecord::Base
|
|||
belongs_to :topic1, :class_name => "Topic", :foreign_key => "node1_id"
|
||||
belongs_to :topic2, :class_name => "Topic", :foreign_key => "node2_id"
|
||||
|
||||
has_many :mappings
|
||||
has_many :mappings, as: :mappable, dependent: :destroy
|
||||
has_many :maps, :through => :mappings
|
||||
|
||||
validates :desc, length: { minimum: 0, allow_nil: false }
|
||||
|
||||
validates :permission, presence: true
|
||||
validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) }
|
||||
|
||||
def user_name
|
||||
self.user.name
|
||||
end
|
||||
|
@ -46,13 +51,4 @@ class Synapse < ActiveRecord::Base
|
|||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# returns Boolean if user allowed to view Topic, Synapse, or Map
|
||||
def authorize_to_view(user)
|
||||
if (self.permission == "private" && self.user != user)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,13 +3,16 @@ class Topic < ActiveRecord::Base
|
|||
|
||||
belongs_to :user
|
||||
|
||||
has_many :synapses1, :class_name => 'Synapse', :foreign_key => 'node1_id'
|
||||
has_many :synapses2, :class_name => 'Synapse', :foreign_key => 'node2_id'
|
||||
has_many :synapses1, :class_name => 'Synapse', :foreign_key => 'node1_id', dependent: :destroy
|
||||
has_many :synapses2, :class_name => 'Synapse', :foreign_key => 'node2_id', dependent: :destroy
|
||||
has_many :topics1, :through => :synapses2, :source => :topic1
|
||||
has_many :topics2, :through => :synapses1, :source => :topic2
|
||||
|
||||
has_many :mappings
|
||||
has_many :mappings, as: :mappable, dependent: :destroy
|
||||
has_many :maps, :through => :mappings
|
||||
|
||||
validates :permission, presence: true
|
||||
validates :permission, inclusion: { in: Perm::ISSIONS.map(&:to_s) }
|
||||
|
||||
# This method associates the attribute ":image" with a file attachment
|
||||
has_attached_file :image
|
||||
|
@ -39,27 +42,27 @@ class Topic < ActiveRecord::Base
|
|||
belongs_to :metacode
|
||||
|
||||
def user_name
|
||||
self.user.name
|
||||
user.name
|
||||
end
|
||||
|
||||
def user_image
|
||||
self.user.image.url
|
||||
user.image.url
|
||||
end
|
||||
|
||||
def map_count
|
||||
self.maps.count
|
||||
maps.count
|
||||
end
|
||||
|
||||
def synapse_count
|
||||
self.synapses.count
|
||||
synapses.count
|
||||
end
|
||||
|
||||
def inmaps
|
||||
self.maps.map(&:name)
|
||||
maps.map(&:name)
|
||||
end
|
||||
|
||||
def inmapsLinks
|
||||
self.maps.map(&:id)
|
||||
maps.map(&:id)
|
||||
end
|
||||
|
||||
def as_json(options={})
|
||||
|
@ -71,24 +74,18 @@ class Topic < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def mk_permission
|
||||
if self.permission == "commons"
|
||||
"co"
|
||||
elsif self.permission == "public"
|
||||
"pu"
|
||||
elsif self.permission == "private"
|
||||
"pr"
|
||||
end
|
||||
Perm.short(permission)
|
||||
end
|
||||
|
||||
# has no viewable synapses helper function
|
||||
def has_viewable_synapses(current)
|
||||
result = false
|
||||
self.synapses.each do |synapse|
|
||||
if synapse.authorize_to_view(current)
|
||||
synapses.each do |synapse|
|
||||
if synapse.authorize_to_show(current)
|
||||
result = true
|
||||
end
|
||||
end
|
||||
return result
|
||||
result
|
||||
end
|
||||
|
||||
##### PERMISSIONS ######
|
||||
|
@ -117,12 +114,4 @@ class Topic < ActiveRecord::Base
|
|||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# returns Boolean if user allowed to view Topic, Synapse, or Map
|
||||
def authorize_to_view(user)
|
||||
if (self.permission == "private" && self.user != user)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,12 +7,10 @@ class User < ActiveRecord::Base
|
|||
has_many :maps
|
||||
has_many :mappings
|
||||
|
||||
before_create :generate_code
|
||||
after_create :generate_code
|
||||
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable
|
||||
|
||||
attr_accessible :name, :email, :image, :password, :password_confirmation, :code, :joinedwithcode, :remember_me
|
||||
|
||||
serialize :settings, UserPreference
|
||||
|
||||
validates :password, :presence => true,
|
||||
|
@ -37,11 +35,12 @@ class User < ActiveRecord::Base
|
|||
:ninetysix => ['96x96#', :png],
|
||||
:onetwentyeight => ['128x128#', :png]
|
||||
},
|
||||
:default_url => "/assets/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,
|
||||
|
@ -49,27 +48,32 @@ 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)
|
||||
|
||||
self.code ||= rand(36**8).to_s(36)
|
||||
$codes.push(self.code)
|
||||
|
||||
self.generation = self.get_generation
|
||||
self.generation = 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
|
||||
def get_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
|
||||
|
||||
|
@ -77,13 +81,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
|
||||
|
|
37
app/services/perm.rb
Normal file
37
app/services/perm.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
class Perm
|
||||
# e.g. Perm::ISSIONS
|
||||
ISSIONS = [:commons, :public, :private]
|
||||
|
||||
class << self
|
||||
|
||||
def short(permission)
|
||||
case permission
|
||||
when :commons
|
||||
"co"
|
||||
when :public
|
||||
"pu"
|
||||
when :private
|
||||
"pr"
|
||||
else
|
||||
fail "Invalid permission"
|
||||
end
|
||||
end
|
||||
|
||||
def long(perm)
|
||||
case perm
|
||||
when "co"
|
||||
:commons
|
||||
when "pu"
|
||||
:public
|
||||
when "pr"
|
||||
:private
|
||||
else
|
||||
fail "Invalid short permission"
|
||||
end
|
||||
end
|
||||
|
||||
def valid?(permission)
|
||||
ISSIONS.include? permission
|
||||
end
|
||||
end
|
||||
end
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<div id="rightAboutParms">
|
||||
<p>PRIVATE BETA</p>
|
||||
<p>2.6</p>
|
||||
<p>2.7</p>
|
||||
<p>Nov 29, 2014</p>
|
||||
</div>
|
||||
<div class="clearfloat">
|
||||
|
@ -46,6 +46,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<% # TODO enable ssl on blog.metamaps.cc %>
|
||||
<a id="lightbox_blog" href="http://blog.metamaps.cc" target="_blank">
|
||||
<div class="lightboxAboutIcon"></div>
|
||||
blog
|
||||
|
@ -58,7 +59,8 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a id="lightbox_term" data-bypass="true" href="http://metamaps.cc/maps/331" target="_blank">
|
||||
<% # TODO switch to https:// once we're confident %>
|
||||
<a id="lightbox_term" data-bypass="true" href="//metamaps.cc/maps/331" target="_blank">
|
||||
<div class="lightboxAboutIcon"></div>
|
||||
terms
|
||||
</a>
|
||||
|
@ -115,7 +117,7 @@
|
|||
<li>Google Plus <a href="https://plus.google.com/communities/115060009262157699234" target="_blank">*</a></li>
|
||||
<li>Hackpad <a href="http://metamaps.hackpad.com/" target="_blank">*</a></li>
|
||||
<li>Loomio <a href="https://www.loomio.org/g/bu3L1tIW/topos-ffo" target="_blank">*</a></li>
|
||||
<li>Twitter <a href="http://twitter.com/metamapps" target="_blank">*</a></li>
|
||||
<li>Twitter <a href="https://twitter.com/metamapps" target="_blank">*</a></li>
|
||||
<li>Hipchat</li>
|
||||
<li>Google Hangouts</li>
|
||||
<li>Vimeo </li>
|
||||
|
@ -140,7 +142,7 @@
|
|||
<ul><li>Google Analytics</li></ul>
|
||||
<br>
|
||||
<h4 id="colophonSection">Support</h4>
|
||||
<ul><li>Uservoice <a href="http://support.metamaps.cc/" target="_blank">*</a></li></ul>
|
||||
<ul><li>Uservoice <a href="http://metamapscc.uservoice.com/" target="_blank">*</a></li></ul>
|
||||
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
|
@ -152,7 +154,8 @@
|
|||
<a id="chromeIcon" href="https://www.google.com/chrome/browser/" target="_blank">Chrome</a>
|
||||
<a id="fireFoxIcon" href="https://www.mozilla.org/en-US/firefox/new/" target="_blank">Firefox</a>
|
||||
<a id="safariIcon" href="http://support.apple.com/downloads/#safari" target="_blank">Safari</a>
|
||||
<p id="noIEbody">While it's downloading, explore our <a href="http://blog.metamaps.cc/">blog</a>,<br> watch the <a href="http://vimeo.com/88334167">tutorials</a>, or visit our <a href="http://support.metamaps.cc/">knowledge base</a>!
|
||||
<% # TODO https for blog.metamaps.cc %>
|
||||
<p id="noIEbody">While it's downloading, explore our <a href="http://blog.metamaps.cc/">blog</a>,<br> watch the <a href="http://vimeo.com/88334167">tutorials</a>, or visit our <a href="http://metamapscc.uservoice.com/">knowledge base</a>!
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -200,13 +203,14 @@
|
|||
|
||||
<p>Want to help with design, code, community building, or communications for Metamaps? We're an open value network, which for us means we want to invite and empower peers to participate in creating value together.
|
||||
|
||||
<% # TODO change this link to https once it works %>
|
||||
<p>To be a <b>USER</b>, request an invite! We'll expect you to abide by our <a href="http://metamaps.cc/maps/331" target="_blank">terms of service</a>.</p>
|
||||
|
||||
<p>To be a <b>CONTRIBUTOR</b>, simply <a href="https://docs.google.com/document/d/1z8FsSmYkHbLRLOsXc8i8M5ubKky8_WB2E9bLBoXJapU" target="_blank">enter our spaces</a> and join the conversation! We'll expect you to follow some guidelines.</p>
|
||||
|
||||
<p><b>MEMBERS</b> are contributors who act as stewards and guardians of the collective and are responsible for maintaining our culture and purpose. We're working on a set of agreements to formalize what it means to be a member.</p>
|
||||
|
||||
<p>We welcome people of all skillsets to create value within our network. There's open possibilities for designers, researchers, academics, strategists, and facilitators to contribute. If you're a developer, help us advance the code and take a look around our <a href="http://github.com/metamaps/metamaps_gen002" target="_blank">Github</a>.</p>
|
||||
<p>We welcome people of all skillsets to create value within our network. There's open possibilities for designers, researchers, academics, strategists, and facilitators to contribute. If you're a developer, help us advance the code and take a look around our <a href="https://github.com/metamaps/metamaps_gen002" target="_blank">Github</a>.</p>
|
||||
|
||||
<p>Thanks for your interest in helping out with Metamaps! Hopefully this gets you pointed in the right direction to get involved. The next step is to read the links on this page and then contribute! </p>
|
||||
|
||||
|
@ -231,9 +235,8 @@
|
|||
<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>
|
||||
<div id="joinCodesBox">
|
||||
<% mapper = current_user %>
|
||||
<p class="joinCodes">http://metamaps.cc/join?code=<%= mapper.code %></p>
|
||||
<button class="button" onclick="Metamaps.GlobalUI.shareInvite('http://metamaps.cc/join?code=<%= mapper.code %>');">COPY INVITE LINK!</button>
|
||||
<p class="joinCodes"><%= @invite_link %>
|
||||
<button class="button" onclick="Metamaps.GlobalUI.shareInvite('<%= @invite_link %>');">COPY INVITE LINK!</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<script type="text/template" id="mapSearchTemplate">
|
||||
<div class="result{{rtype}}">
|
||||
<div class="searchResIconWrapper">
|
||||
<img class="icon" src="/assets/metamap36c.png">
|
||||
<img class="icon" src="<%= asset_path('metamap36c.png') %>">
|
||||
</div>
|
||||
<div class="resultText">
|
||||
<p class="resultTitle">{{label}}</p>
|
||||
|
@ -196,6 +196,7 @@
|
|||
</script>
|
||||
|
||||
<script type="text/template" id="topicAutocompleteTemplate">
|
||||
<div>
|
||||
<img class="autocompleteSection topicType" width="24" height="24" src="{{typeImageURL}}" alt="{{type}}" title="{{type}}" />
|
||||
<p class="autocompleteSection topicTitle">{{label}}</p>
|
||||
<div class="expandTopicMetadata"></div>
|
||||
|
@ -209,6 +210,7 @@
|
|||
<div class="topicPermission {{permission}}"></div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -234,7 +236,7 @@
|
|||
<div class="metacodeSelect">{{{metacode_select}}}</div>
|
||||
</div>
|
||||
<div class="linkItem contributor">
|
||||
<a href="/explore/mapper/{{userid}}"><img src="/assets/user.png" class="contributorIcon" width="32" height="32" /></a>
|
||||
<a href="/explore/mapper/{{userid}}"><img src="<%= asset_path('user.png') %>" class="contributorIcon" width="32" height="32" /></a>
|
||||
<div class="contributorName">{{username}}</div>
|
||||
</div>
|
||||
<div class="linkItem mapCount">
|
||||
|
@ -267,4 +269,4 @@
|
|||
<div class="clearfloat"></div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
<%= javascript_include_tag "application" %>
|
||||
|
||||
<!-- typekit for vinyl font -->
|
||||
<script type="text/javascript" src="//use.typekit.net/tki2nyo.js"></script>
|
||||
<script type="text/javascript" src="https://use.typekit.net/tki2nyo.js"></script>
|
||||
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
|
||||
|
||||
<!-- app code -->
|
||||
<script type="text/javascript">
|
||||
require.config({baseUrl: '/famous/'});
|
||||
require.config({baseUrl: '<%= "#{ asset_path '/famous/main.js' }".chomp('main.js') %>'});
|
||||
require(['main']);
|
||||
</script>
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body data-env="<%= Rails.env %>" class="<%= authenticated? ? "authenticated" : "unauthenticated" %>">
|
||||
<body class="<%= authenticated? ? "authenticated" : "unauthenticated" %>">
|
||||
|
||||
<% if devise_error_messages? %>
|
||||
<p id="toast"><%= devise_error_messages! %></p>
|
||||
|
@ -141,16 +141,12 @@
|
|||
|
||||
// set up uservoice with signed in user
|
||||
<% if authenticated? && ENV['SSO_KEY'] %>
|
||||
USERVOICE.load(Metamaps.Active.Mapper.name, Metamaps.Active.Mapper.id, "<%= user.email %>", "<%= current_sso_token %>");
|
||||
USERVOICE.load(Metamaps.Active.Mapper.name, Metamaps.Active.Mapper.id, "<%= user.email %>", "<%= current_sso_token %>");
|
||||
<% else %>
|
||||
USERVOICE.load();
|
||||
USERVOICE.load();
|
||||
<% end %>
|
||||
</script>
|
||||
|
||||
<% if !authenticated? %>
|
||||
<iframe width="1" height="1" src="http://support.metamaps.cc/logout.json"; style="visibility:hidden;"></iframe>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
Metamaps.Maps.Active = <%= @maps.to_json.html_safe %>;
|
||||
Metamaps.currentSection = "";
|
||||
Metamaps.currentPage = "";
|
||||
Metamaps.GlobalUI.Search.isOpen = true;
|
||||
Metamaps.GlobalUI.Search.open();
|
||||
Metamaps.GlobalUI.Search.lock();
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
<%= @map && @map.permission != 'private' ? " shareable" : "" %>">
|
||||
|
||||
<% if @map %>
|
||||
<div class="mapInfoName" id="mapInfoName"><%= best_in_place @map, :name, :type => :textarea, :activator => "#mapInfoName", :classes => 'best_in_place_name' %></div>
|
||||
<div class="mapInfoName" id="mapInfoName"><%= best_in_place @map, :name, :as => :textarea, :activator => "#mapInfoName", :class => 'best_in_place_name' %></div>
|
||||
|
||||
<div class="mapInfoStat">
|
||||
<div class="infoStatIcon mapContributors hoverForTip">
|
||||
<% if @map.contributors.count == 0 %>
|
||||
<img id="mapContribs" width="25" height="25" src="/assets/user.png" />
|
||||
<img id="mapContribs" width="25" height="25" src="<%= asset_path('user.png'); %>" />
|
||||
<% elsif @map.contributors.count == 1 %>
|
||||
<img id="mapContribs" width="25" height="25" src="<%= @map.contributors[0].image.url(:thirtytwo) %>" />
|
||||
<% elsif @map.contributors.count == 2 %>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<% end %>
|
||||
<span><%= @map.contributors.count %></span>
|
||||
<div class="tip"> <ul><% @map.contributors.each_with_index do |c, index| %>
|
||||
<li ><a href="/explore/mapper/<%= c.id %>" > <img class="rtUserImage" width="25" height="25" src="<%= c.image.url(:thirtytwo) %>" />
|
||||
<li ><a href="/explore/mapper/<%= c.id %>" > <img class="rtUserImage" width="25" height="25" src="<%= asset_path c.image.url(:thirtytwo) %>" />
|
||||
<%= c.name %></a>
|
||||
</li>
|
||||
<% end %></ul></div>
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
<div class="mapInfoDesc" id="mapInfoDesc">
|
||||
<% if (authenticated? && @map.authorize_to_edit(user)) || (!authenticated? && @map.desc != "" && @map.desc != nil )%>
|
||||
<%= best_in_place @map, :desc, :activator => "#mapInfoDesc", :type => :textarea, :nil => "Click to add description...", :classes => 'best_in_place_desc' %>
|
||||
<%= best_in_place @map, :desc, :activator => "#mapInfoDesc", :as => :textarea, :placeholder => "Click to add description...", :class => 'best_in_place_desc' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
@ -61,4 +61,4 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
<%= form_for Topic.new, url: topics_url, remote: true do |form| %>
|
||||
<div class="openMetacodeSwitcher openLightbox" data-open="switchMetacodes"></div>
|
||||
<div id="metacodeImg">
|
||||
<% @m = user.settings.metacodes %>
|
||||
<% set = @m[0].include?("metacodeset") ? MetacodeSet.find(@m[0].sub("metacodeset-","").to_i) : false %>
|
||||
<% if set %>
|
||||
<% @metacodes = set.metacodes %>
|
||||
<% else %>
|
||||
<% @metacodes = [] %>
|
||||
<% @m.each do |m| %>
|
||||
<% @metacodes.push(Metacode.find(m.to_i)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %>
|
||||
<% @metacodes = user_metacodes() %>
|
||||
<% set = get_metacodeset() %>
|
||||
<% @metacodes.each do |metacode| %>
|
||||
<img class="cloudcarousel" width="40" height="40" src="<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>" data-id="<%= metacode.id %>" />
|
||||
<img class="cloudcarousel" width="40" height="40" src="<%= asset_path metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>" data-id="<%= metacode.id %>" />
|
||||
<% end %>
|
||||
</div>
|
||||
<%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<% while $i < (Metacode.all.length / 4) do %>
|
||||
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
|
||||
onclick="Metamaps.Admin.liClickHandler.call(this);">
|
||||
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<img src="<%= asset_path @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<p><%= @m[$i].name.downcase %></p>
|
||||
<div class="clearfloat"></div>
|
||||
</li>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<% while $i < (Metacode.all.length / 4 * 2) do %>
|
||||
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
|
||||
onclick="Metamaps.Admin.liClickHandler.call(this);">
|
||||
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<img src="<%= asset_path @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<p><%= @m[$i].name.downcase %></p>
|
||||
<div class="clearfloat"></div>
|
||||
</li>
|
||||
|
@ -59,7 +59,7 @@
|
|||
<% while $i < (Metacode.all.length / 4 * 3) do %>
|
||||
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
|
||||
onclick="Metamaps.Admin.liClickHandler.call(this);">
|
||||
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<img src="<%= asset_path @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<p><%= @m[$i].name.downcase %></p>
|
||||
<div class="clearfloat"></div>
|
||||
</li>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<% while $i < Metacode.all.length do %>
|
||||
<li id="<%= @m[$i].id %>" <% if not @m[$i].inMetacodeSet(@metacode_set) %>class="toggledOff"<% end %>
|
||||
onclick="Metamaps.Admin.liClickHandler.call(this);">
|
||||
<img src="<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<img src="<%= asset_path @m[$i].icon %>" alt="<%= @m[$i].name %>" />
|
||||
<p><%= @m[$i].name.downcase %></p>
|
||||
<div class="clearfloat"></div>
|
||||
</li>
|
||||
|
@ -86,4 +86,4 @@
|
|||
{ :class => 'button', 'data-bypass' => 'true' } %>
|
||||
<%= f.submit :class => 'add', :onclick => "return Metamaps.Admin.validate();" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<td class='metacodeSetDesc'><%= metacode_set.desc %></td>
|
||||
<td>
|
||||
<% metacode_set.metacodes.each_with_index do |metacode, index| %>
|
||||
<img class='metacodeSetImage' src='<%= metacode.icon %>' />
|
||||
<img class='metacodeSetImage' src='<%= asset_path metacode.icon %>' />
|
||||
<% if (index+1)%4 == 0 %>
|
||||
<div class='clearfloat'></div>
|
||||
<% end %>
|
||||
|
@ -34,4 +34,4 @@
|
|||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<% @metacodes.each do |metacode| %>
|
||||
<tr>
|
||||
<td><%= metacode.name %></td>
|
||||
<td class="iconURL"><%= metacode.icon %></td>
|
||||
<td class="iconURL"><%= asset_path metacode.icon %></td>
|
||||
<% if metacode.color %>
|
||||
<td class="iconColor" style="background-color: <%= metacode.color %>">
|
||||
<%= metacode.color %>
|
||||
|
@ -22,10 +22,10 @@
|
|||
<% else %>
|
||||
<td></td>
|
||||
<% end %>
|
||||
<td><img width='40' src='<%= metacode.icon %>' /></td>
|
||||
<td><img width='40' src='<%= asset_path metacode.icon %>' /></td>
|
||||
<td><%= link_to 'Edit', edit_metacode_path(metacode), :data => { :bypass => 'true'} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
<div class='blackBox'>
|
||||
<%= render 'form' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<div class="csItem indented"><span class="csTitle">Esc:</span> Hides auto-suggestion results</div>
|
||||
<div class="csItem indented"><span class="csTitle">Enter:</span> create a new topic</div>
|
||||
<div class="csItem indented"><span class="csTitle">Gear Icon:</span> open up metacode settings</div>
|
||||
<div class="csItem"><br><a href="http://support.metamaps.cc/knowledgebase/articles/425787-creating-and-editing-topics" target= "_blank">Learn More</a></div>
|
||||
<div class="csItem"><br><a href="http://metamapscc.uservoice.com/knowledgebase/articles/425787-creating-and-editing-topics" target= "_blank">Learn More</a></div>
|
||||
</div>
|
||||
|
||||
<div id="csEditingTopics">
|
||||
|
@ -61,7 +61,7 @@
|
|||
<span class="csTitle">Change Topic permission:</span> Click on 'Permission' icon (only for topic creator)
|
||||
</div>
|
||||
<div class="csItem indented">
|
||||
<span class="csTitle">Open Topic view:</span> Click on <img src="/assets/synapse16.png" width="16" align="middle" /> icon within topic card bar
|
||||
<span class="csTitle">Open Topic view:</span> Click on <img src="<%= asset_path 'synapse16.png' %>" width="16" align="middle" /> icon within topic card bar
|
||||
</div>
|
||||
<div class="csItem indented">
|
||||
<span class="csTitle">Close 'Topic' card:</span> Click on canvas
|
||||
|
@ -70,7 +70,7 @@
|
|||
<span class="csTitle">Open 'Context Menu':</span> Right-click/alt+click on topic icon or synapse
|
||||
</div>
|
||||
<div class="csItem indented">*Hide/Remove/Delete topic within context menu</div>
|
||||
<div class="csItem"><br><a href="http://support.metamaps.cc/knowledgebase/articles/425787-creating-and-editing-topics" target= "_blank">Learn More</a></div>
|
||||
<div class="csItem"><br><a href="http://metamapscc.uservoice.com/knowledgebase/articles/425787-creating-and-editing-topics" target= "_blank">Learn More</a></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
|||
<div class="csItem"><span class="csTitle">Create new Topic with Synapse:</span> Right-click + drag from topic to open canvas</div>
|
||||
<div class="csItem indented"><span class="csTitle">Enter:</span> Create topic</div>
|
||||
<div class="csItem indented"><span class="csTitle">Enter:</span> Create synapse</div>
|
||||
<div class="csItem"><br><a href="http://support.metamaps.cc/knowledgebase/articles/425790-creating-and-editing-synapses" target= "_blank">Learn More</a></div>
|
||||
<div class="csItem"><br><a href="http://metamapscc.uservoice.com/knowledgebase/articles/425790-creating-and-editing-synapses" target= "_blank">Learn More</a></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
|||
<div class="csItem indented"><span class="csTitle">Browse synapses / change visible synapse</span> click on arrow icon and select desired synapse</div>
|
||||
<div class="csItem"><span class="csTitle">Open 'Context Menu':</span> Right-click/alt-click on Synapse</div>
|
||||
<div class="csItem indented">*Hide/Remove/Delete synapse within context menu</div>
|
||||
<div class="csItem"><br><a href="http://support.metamaps.cc/knowledgebase/articles/425790-creating-and-editing-synapses" target= "_blank">Learn More</a></div>
|
||||
<div class="csItem"><br><a href="http://metamapscc.uservoice.com/knowledgebase/articles/425790-creating-and-editing-synapses" target= "_blank">Learn More</a></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -102,7 +102,7 @@
|
|||
<div class="csItem"><span class="csTitle">Move around Canvas:</span> Click and drag</div>
|
||||
<div class="csItem"><span class="csTitle">Zoom in/out:</span> Scroll OR click on <div id="zoomIn"> </div> & <div id="zoomOut"> </div></div>
|
||||
<div class="csItem"><span class="csTitle">Zoom to see all:</span> Click <div id="centerMap"></div> OR Ctrl + E</div>
|
||||
<div class="csItem"><br><a href="http://support.metamaps.cc/knowledgebase/articles/425784-viewing-existing-maps" target= "_blank">Learn More</a></div>
|
||||
<div class="csItem"><br><a href="http://metamapscc.uservoice.com/knowledgebase/articles/425784-viewing-existing-maps" target= "_blank">Learn More</a></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -151,42 +151,42 @@
|
|||
<div id="moreResources">
|
||||
<p>For more information about Metamaps.cc, visit our Knowledge Base or skip directly to a section by clicking on one of the categories below.</p>
|
||||
<div class="resourcesColumnOne resourcesColumn">
|
||||
<a href="http://support.metamaps.cc/forums/262715-general" target="_blank" data-bypass="true" class="button">Feedback Forums</a>
|
||||
<a href="http://metamapscc.uservoice.com/forums/262715-general" target="_blank" data-bypass="true" class="button">Feedback Forums</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/61031-getting-started" target="_blank" data-bypass="true">Getting Started</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/61031-getting-started" target="_blank" data-bypass="true">Getting Started</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63372-key-fundamentals" target="_blank" data-bypass="true">Key Fundamentals</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63372-key-fundamentals" target="_blank" data-bypass="true">Key Fundamentals</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/61033-best-practices" target="_blank" data-bypass="true">Best Practices</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/61033-best-practices" target="_blank" data-bypass="true">Best Practices</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63377-general-troubleshooting" target="_blank" data-bypass="true">General Troubleshooting</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63377-general-troubleshooting" target="_blank" data-bypass="true">General Troubleshooting</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63443-applications-use-cases" target="_blank" data-bypass="true">Applications & Use Cases</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63443-applications-use-cases" target="_blank" data-bypass="true">Applications & Use Cases</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="resourcesColumnTwo resourcesColumn">
|
||||
<a href="http://support.metamaps.cc/knowledgebase" target="_blank" data-bypass="true" class="button">KNOWLEDGE BASE</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase" target="_blank" data-bypass="true" class="button">KNOWLEDGE BASE</a>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63440-general-questions" target="_blank" data-bypass="true">General Questions</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63440-general-questions" target="_blank" data-bypass="true">General Questions</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63375-getting-involved" target="_blank" data-bypass="true">Getting Involved</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63375-getting-involved" target="_blank" data-bypass="true">Getting Involved</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63376-project-organization-governance" target="_blank" data-bypass="true">Organization & Governance</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63376-project-organization-governance" target="_blank" data-bypass="true">Organization & Governance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63378-technical-infrastructure" target="_blank" data-bypass="true">Technical Infrastructure</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63378-technical-infrastructure" target="_blank" data-bypass="true">Technical Infrastructure</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://support.metamaps.cc/knowledgebase/topics/63587-theory-references" target="_blank" data-bypass="true">References & Key Theory</a>
|
||||
<a href="http://metamapscc.uservoice.com/knowledgebase/topics/63587-theory-references" target="_blank" data-bypass="true">References & Key Theory</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -70,13 +70,13 @@
|
|||
|
||||
@metacodes.each_with_index do |metacode, index|
|
||||
@metacodelist += '<li data-id="' + metacode.id.to_s + '">'
|
||||
@metacodelist += '<img src="' + metacode.icon + '" data-id="' + metacode.id.to_s + '" alt="' + metacode.name + '" />'
|
||||
@metacodelist += '<img src="' + asset_path(metacode.icon) + '" data-id="' + metacode.id.to_s + '" alt="' + metacode.name + '" />'
|
||||
@metacodelist += '<p>' + metacode.name.downcase + '</p></li>'
|
||||
end
|
||||
@synapses.each_with_index do |synapse, index|
|
||||
d = synapse.desc || ""
|
||||
@synapselist += '<li data-id="' + d + '">'
|
||||
@synapselist += '<img src="/assets/synapse16.png" alt="synapse icon" /><p>' + d
|
||||
@synapselist += '<img src="' + asset_path('synapse16.png') + '" alt="synapse icon" /><p>' + d
|
||||
@synapselist += '</p></li>'
|
||||
end
|
||||
@mappers.each_with_index do |mapper, index|
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<ul>
|
||||
<% set.metacodes.sort { |a, b| a.name <=> b.name }.each do |m| %>
|
||||
<li data-id="<%= m.id.to_s %>">
|
||||
<img width="24" height="24" src="<%= m.icon %>" alt="<%= m.name %>" />
|
||||
<img width="24" height="24" src="<%= asset_path m.icon %>" alt="<%= m.name %>" />
|
||||
<div class="mSelectName"><%= m.name %></div>
|
||||
<div class="clearfloat"></div>
|
||||
</li>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<ul>
|
||||
<% Metacode.order("name").all.each do |m| %>
|
||||
<li data-id="<%= m.id.to_s %>">
|
||||
<img width="24" height="24" src="<%= m.icon %>" alt="<%= m.name %>" />
|
||||
<img width="24" height="24" src="<%= asset_path m.icon %>" alt="<%= m.name %>" />
|
||||
<div class="mSelectName"><%= m.name %></div>
|
||||
<div class="clearfloat"></div>
|
||||
</li>
|
||||
|
@ -34,4 +34,4 @@
|
|||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -19,16 +19,16 @@
|
|||
<div id="metacodeSwitchTabs">
|
||||
<ul>
|
||||
<% 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 %>
|
||||
<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>
|
||||
<% allMetacodeSets.each_with_index do |m, localindex| %>
|
||||
<div id="metacodeSwitchTabs<%= m.id %>"
|
||||
data-metacodes="<%= m.metacodes.map(&:id).join(',') %>">
|
||||
<% @list = '' %>
|
||||
<% m.metacodes.sort{|x,y| x.name <=> y.name }.each_with_index do |m, index| %>
|
||||
<% @list += '<li><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||
<% @list += '<li><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||
<% end %>
|
||||
<div class="metacodeSwitchTab">
|
||||
<p class="setDesc"><%= m.desc %></p>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<% else %>
|
||||
<% mClass = "toggledOff" %>
|
||||
<% end %>
|
||||
<% @list += '<li id="' + m.id.to_s + '" data-name="' + m.name + '" class="' + mClass + '"><img src="' + m.icon + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||
<% @list += '<li id="' + m.id.to_s + '" data-name="' + m.name + '" class="' + mClass + '"><img src="' + asset_path(m.icon) + '" alt="' + m.name + '" /><p>' + m.name.downcase + '</p><div class="clearfloat"></div></li>' %>
|
||||
<% end %>
|
||||
|
||||
<div class="customMetacodeList">
|
||||
|
@ -73,4 +73,4 @@
|
|||
<script>
|
||||
Metamaps.Create.selectedMetacodeSet = "metacodeset-<%= selectedSet %>";
|
||||
Metamaps.Create.selectedMetacodeSetIndex = <%= index %>;
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<% end %>
|
||||
<% @metacodes.sort! {|m1,m2| m2.name.downcase <=> m1.name.downcase }.rotate!(-1) %>
|
||||
<% @metacodes.each do |metacode| %>
|
||||
<img class="cloudcarousel" width="40" height="40" src="<%= metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
|
||||
<img class="cloudcarousel" width="40" height="40" src="<%= asset_path metacode.icon %>" alt="<%= metacode.name %>" title="<%= metacode.name %>"/>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %>
|
||||
|
|
21
bin/jenkins-test.sh
Executable file
21
bin/jenkins-test.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash -l
|
||||
|
||||
#prerequisites
|
||||
#sudo aptitude -q -y install libpq-dev
|
||||
|
||||
source "$HOME/.rvm/scripts/rvm"
|
||||
rvm install $(cat .ruby-version)
|
||||
rvm gemset use $(cat .ruby-gemset)
|
||||
gem install bundler
|
||||
|
||||
set -x
|
||||
|
||||
#configure environment
|
||||
export RAILS_ENV=test
|
||||
cp .example-env .env
|
||||
sed -i -e "s/DB_USERNAME='.*'/DB_USERNAME='jenkins'/" .env
|
||||
|
||||
#test
|
||||
bundle install
|
||||
rake db:create db:test:prepare
|
||||
bundle exec rspec
|
|
@ -1,13 +1,12 @@
|
|||
require File.expand_path('../boot', __FILE__)
|
||||
|
||||
require 'rails/all'
|
||||
require 'dotenv'
|
||||
|
||||
if defined?(Bundler)
|
||||
# If you precompile assets before deploying to production, use this line
|
||||
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
||||
# If you want your assets lazily compiled in production, use this line
|
||||
# Bundler.require(:default, :assets, Rails.env)
|
||||
end
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
||||
Dotenv.load ".env.#{ENV["RAILS_ENV"]}", '.env'
|
||||
|
||||
module Metamaps
|
||||
class Application < Rails::Application
|
||||
|
@ -16,7 +15,7 @@ module Metamaps
|
|||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
# config.autoload_paths += %W(#{config.root}/extras)
|
||||
config.autoload_paths << Rails.root.join('app', 'services')
|
||||
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||
|
@ -44,17 +43,15 @@ module Metamaps
|
|||
# like if you have constraints or database-specific column types
|
||||
# config.active_record.schema_format = :sql
|
||||
|
||||
# Enforce whitelist mode for mass assignment.
|
||||
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
||||
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
||||
# parameters by using an attr_accessible or attr_protected declaration.
|
||||
# config.active_record.whitelist_attributes = true
|
||||
|
||||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
config.assets.initialize_on_precompile = false
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '2.0'
|
||||
|
||||
config.generators do |g|
|
||||
g.test_framework :rspec
|
||||
end
|
||||
config.active_record.raise_in_transactional_callbacks = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
require 'rubygems'
|
||||
require 'rails/commands/server'
|
||||
module Rails
|
||||
class Server
|
||||
def default_options
|
||||
super.merge(Host: '0.0.0.0', Port: 3000)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
|
|
21
config/database.yml
Normal file
21
config/database.yml
Normal file
|
@ -0,0 +1,21 @@
|
|||
default: &default
|
||||
min_messages: WARNING
|
||||
encoding: unicode
|
||||
pool: 5
|
||||
adapter: postgresql
|
||||
host: <%= ENV['DB_HOST'] %>
|
||||
port: <%= ENV['DB_PORT'] %>
|
||||
username: <%= ENV['DB_USERNAME'] %>
|
||||
password: <%= ENV['DB_PASSWORD'] %>
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: <%= ENV['DB_NAME'] %>_development
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
database: <%= ENV['DB_NAME'] %>_test
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
database: <%= ENV['DB_NAME'] %>_production
|
|
@ -1,10 +0,0 @@
|
|||
development:
|
||||
min_messages: WARNING
|
||||
adapter: postgresql
|
||||
host: 127.0.0.1
|
||||
port: 5432
|
||||
encoding: unicode
|
||||
database: metamap002_development
|
||||
pool: 5
|
||||
username: postgres
|
||||
password: "3112"
|
|
@ -1,26 +1,27 @@
|
|||
Metamaps::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
config.log_level = :info
|
||||
config.eager_load = false
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
# S3 file storage
|
||||
config.paperclip_defaults = {
|
||||
:storage => :s3,
|
||||
:s3_credentials => {
|
||||
:bucket => ENV['S3_BUCKET_NAME'],
|
||||
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
||||
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
|
||||
}
|
||||
storage: :s3,
|
||||
s3_credentials: {
|
||||
bucket: ENV['S3_BUCKET_NAME'],
|
||||
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
||||
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
|
||||
},
|
||||
s3_protocol: 'https'
|
||||
}
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
|
@ -40,19 +41,6 @@ Metamaps::Application.configure do
|
|||
# Print deprecation notices to the Rails logger
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Only use best-standards-support built into browsers
|
||||
config.action_dispatch.best_standards_support = :builtin
|
||||
|
||||
# Raise exception on mass assignment protection for Active Record models
|
||||
config.active_record.mass_assignment_sanitizer = :strict
|
||||
|
||||
# Log the query plan for queries taking more than this (works
|
||||
# with SQLite, MySQL, and PostgreSQL)
|
||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||
|
||||
# Do not compress assets
|
||||
config.assets.compress = false
|
||||
|
||||
# Expands the lines which load the assets
|
||||
config.assets.debug = true
|
||||
end
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
Metamaps::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
config.log_level = :warn
|
||||
config.eager_load = true
|
||||
config.assets.js_compressor = :uglifier
|
||||
|
||||
# Code is not reloaded between requests
|
||||
config.cache_classes = true
|
||||
|
||||
|
@ -9,7 +13,9 @@ Metamaps::Application.configure do
|
|||
config.action_controller.perform_caching = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
config.serve_static_files = true
|
||||
|
||||
config.assets.compile = false
|
||||
|
||||
# Compress JavaScripts and CSS
|
||||
config.assets.compress = true
|
||||
|
@ -18,11 +24,12 @@ Metamaps::Application.configure do
|
|||
# S3 file storage
|
||||
config.paperclip_defaults = {
|
||||
:storage => :s3,
|
||||
:s3_credentials => {
|
||||
:bucket => ENV['S3_BUCKET_NAME'],
|
||||
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
||||
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
|
||||
}
|
||||
s3_credentials: {
|
||||
bucket: ENV['S3_BUCKET_NAME'],
|
||||
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
||||
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
|
||||
},
|
||||
s3_protocol: 'https'
|
||||
}
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
|
@ -35,7 +42,7 @@ Metamaps::Application.configure do
|
|||
authentication: 'plain',
|
||||
enable_starttls_auto: true,
|
||||
openssl_verify_mode: 'none' }
|
||||
config.action_mailer.default_url_options = { :host => 'metamaps.herokuapp.com' }
|
||||
config.action_mailer.default_url_options = { :host => ENV['MAILER_DEFAULT_URL'] }
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
Metamaps::Application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb
|
||||
|
||||
config.eager_load = false
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
|
@ -8,12 +10,9 @@ Metamaps::Application.configure do
|
|||
config.cache_classes = true
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance
|
||||
config.serve_static_assets = true
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Log error messages when you accidentally call methods on nil
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
@ -29,9 +28,12 @@ Metamaps::Application.configure do
|
|||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Raise exception on mass assignment protection for Active Record models
|
||||
config.active_record.mass_assignment_sanitizer = :strict
|
||||
|
||||
# Print deprecation notices to the stderr
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
#assets config
|
||||
config.assets.compile = true
|
||||
config.assets.compress = false
|
||||
config.assets.debug = false
|
||||
config.assets.digest = false
|
||||
end
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
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
|
||||
# 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.
|
||||
config.mailer_sender = "team@metamaps.cc"
|
||||
config.mailer_sender = ENV['DEVISE_MAILER_SENDER']
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
# config.mailer = "Devise::Mailer"
|
||||
|
||||
|
||||
if Rails.env.development? # this is for Connors localhost
|
||||
config.secret_key = 'f71c467e526f23d614b3b08866cad4788c502bed869c282f06e73ee6c94675b62fe1f6d52fa7ba8196b33031f0d2f3b67e27ea07693c52ecebccb01700cad614'
|
||||
end
|
||||
if Rails.env.production? # this is for the heroku staging environment
|
||||
config.secret_key = 'd91ba0da95749174ee2b8922034783cbde4945409ed28b13383e18e72844beb74467f8199e9e216f0687cd2290c6e46bf74da24486d14bba3671d76c5b10c753'
|
||||
end
|
||||
config.secret_key = ENV['DEVISE_SECRET_KEY']
|
||||
|
||||
# ==> ORM configuration
|
||||
# Load and configure the ORM. Supports :active_record (default) and
|
||||
|
@ -121,6 +123,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
|
||||
|
||||
|
@ -142,9 +147,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.
|
||||
|
@ -152,7 +154,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
|
||||
|
@ -168,16 +170,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,
|
||||
|
@ -186,10 +195,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
|
||||
|
@ -237,12 +242,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
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
Metamaps::Application.config.secret_token = '267c8a84f63963282f45bc3010eaddf027abfab58fc759d6e239c8005f85ee99d6d01b1ab6394cdee9ca7f8c9213a0cf91d3d8d3350f096123e2caccbcc0924f'
|
||||
Metamaps::Application.config.secret_key_base = '267c8a84f63963282f45bc3010eaddf027abfab58fc759d6e239c8005f85ee99d6d01b1ab6394cdee9ca7f8c9213a0cf91d3d8d3350f096123e2caccbcc0924f'
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -2,12 +2,12 @@ Metamaps::Application.routes.draw do
|
|||
|
||||
root to: 'main#home', via: :get
|
||||
|
||||
match 'request', to: 'main#requestinvite', via: :get, as: :request
|
||||
get 'request', to: 'main#requestinvite', as: :request
|
||||
|
||||
match 'search/topics', to: 'main#searchtopics', via: :get, as: :searchtopics
|
||||
match 'search/maps', to: 'main#searchmaps', via: :get, as: :searchmaps
|
||||
match 'search/mappers', to: 'main#searchmappers', via: :get, as: :searchmappers
|
||||
match 'search/synapses', to: 'main#searchsynapses', via: :get, as: :searchsynapses
|
||||
get 'search/topics', to: 'main#searchtopics', as: :searchtopics
|
||||
get 'search/maps', to: 'main#searchmaps', as: :searchmaps
|
||||
get 'search/mappers', to: 'main#searchmappers', as: :searchmappers
|
||||
get 'search/synapses', to: 'main#searchsynapses', as: :searchsynapses
|
||||
|
||||
resources :mappings, except: [:index, :new, :edit]
|
||||
resources :metacode_sets, :except => [:show]
|
||||
|
@ -16,28 +16,28 @@ Metamaps::Application.routes.draw do
|
|||
resources :topics, except: [:index, :new, :edit] do
|
||||
get :autocomplete_topic, :on => :collection
|
||||
end
|
||||
match 'topics/:id/network', to: 'topics#network', via: :get, as: :network
|
||||
match 'topics/:id/relative_numbers', to: 'topics#relative_numbers', via: :get, as: :relative_numbers
|
||||
match 'topics/:id/relatives', to: 'topics#relatives', via: :get, as: :relatives
|
||||
get 'topics/:id/network', to: 'topics#network', as: :network
|
||||
get 'topics/:id/relative_numbers', to: 'topics#relative_numbers', as: :relative_numbers
|
||||
get 'topics/:id/relatives', to: 'topics#relatives', as: :relatives
|
||||
|
||||
match 'explore/active', to: 'maps#index', via: :get, as: :activemaps
|
||||
match 'explore/featured', to: 'maps#index', via: :get, as: :featuredmaps
|
||||
match 'explore/mine', to: 'maps#index', via: :get, as: :mymaps
|
||||
match 'explore/mapper/:id', to: 'maps#index', via: :get, as: :usermaps
|
||||
get 'explore/active', to: 'maps#index', as: :activemaps
|
||||
get 'explore/featured', to: 'maps#index', as: :featuredmaps
|
||||
get 'explore/mine', to: 'maps#index', as: :mymaps
|
||||
get 'explore/mapper/:id', to: 'maps#index', as: :usermaps
|
||||
resources :maps, except: [:new, :edit]
|
||||
match 'maps/:id/contains', to: 'maps#contains', via: :get, as: :contains
|
||||
match 'maps/:id/upload_screenshot', to: 'maps#screenshot', via: :post, as: :screenshot
|
||||
get 'maps/:id/contains', to: 'maps#contains', as: :contains
|
||||
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
|
||||
|
||||
devise_scope :user do
|
||||
get 'login' => 'devise/sessions#new', :as => :new_user_session
|
||||
post 'login' => 'devise/sessions#create', :as => :user_session
|
||||
get 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session
|
||||
get 'join' => 'devise/registrations#new', :as => :new_user_registration
|
||||
get 'join' => 'devise/registrations#new', :as => :new_user_registration_path
|
||||
end
|
||||
|
||||
match 'users/:id/details', to: 'users#details', via: :get, as: :details
|
||||
match 'user/updatemetacodes', to: 'users#updatemetacodes', via: :post, as: :updatemetacodes
|
||||
get 'users/:id/details', to: 'users#details', as: :details
|
||||
post 'user/updatemetacodes', to: 'users#updatemetacodes', as: :updatemetacodes
|
||||
resources :users, except: [:index, :destroy]
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ vagrant ssh --command "cd /vagrant; gem install bundler";
|
|||
vagrant ssh --command "cd /vagrant; bundle install";
|
||||
|
||||
# copy the db config
|
||||
vagrant ssh --command "cd /vagrant; cp config/database.yml.default config/database.yml";
|
||||
vagrant ssh --command "cd /vagrant; cp .example-env .env";
|
||||
|
||||
# Rake all the things
|
||||
vagrant ssh --command "cd /vagrant; rake db:create; rake db:schema:load; rake db:fixtures:load"
|
||||
|
|
36
db/migrate/20151001024122_mapping_polymorphism.rb
Normal file
36
db/migrate/20151001024122_mapping_polymorphism.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
class MappingPolymorphism < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :mappings, :mappable_id, :integer
|
||||
add_column :mappings, :mappable_type, :string
|
||||
add_index :mappings, [:mappable_id, :mappable_type]
|
||||
|
||||
Mapping.find_each do |mapping|
|
||||
if mapping.synapse_id.nil? and mapping.topic_id.nil?
|
||||
puts "Mapping id=#{mapping.id} has no valid id, skipping!"
|
||||
next
|
||||
end
|
||||
if not mapping.synapse_id.nil? and not mapping.topic_id.nil?
|
||||
puts "Mapping id=#{mapping.id} has both topic and synapse ids, skipping!"
|
||||
next
|
||||
end
|
||||
|
||||
unless mapping.synapse_id.nil?
|
||||
mapping.mappable = Synapse.find_by(id: mapping.synapse_id)
|
||||
else
|
||||
mapping.mappable = Topic.find_by(id: mapping.topic_id)
|
||||
end
|
||||
|
||||
if mapping.mappable.nil?
|
||||
mapping.delete
|
||||
else
|
||||
mapping.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :mappings, [:mappable_id, :mappable_type]
|
||||
remove_column :mappings, :mappable_id, :integer
|
||||
remove_column :mappings, :mappable_type, :string
|
||||
end
|
||||
end
|
16
db/migrate/20151023143719_add_missing_indexes.rb
Normal file
16
db/migrate/20151023143719_add_missing_indexes.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
class AddMissingIndexes < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :topics, :user_id
|
||||
add_index :topics, :metacode_id
|
||||
add_index :synapses, [:node2_id, :node2_id]
|
||||
add_index :synapses, [:node1_id, :node1_id]
|
||||
add_index :synapses, :user_id
|
||||
add_index :synapses, :node1_id
|
||||
add_index :synapses, :node2_id
|
||||
add_index :mappings, [:map_id, :topic_id]
|
||||
add_index :mappings, [:map_id, :synapse_id]
|
||||
add_index :mappings, :map_id
|
||||
add_index :mappings, :user_id
|
||||
add_index :maps, :user_id
|
||||
end
|
||||
end
|
15
db/migrate/20160120061513_metacode_asset_path_update.rb
Normal file
15
db/migrate/20160120061513_metacode_asset_path_update.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
class Metacode < ActiveRecord::Base
|
||||
end
|
||||
|
||||
class MetacodeAssetPathUpdate < ActiveRecord::Migration
|
||||
def change
|
||||
Metacode.first(50).each do |metacode|
|
||||
if metacode.icon.start_with?("/assets/icons/")
|
||||
metacode.icon = metacode.icon.sub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes")
|
||||
metacode.icon = metacode.icon.sub('blueprint_96px', 'blueprint/96px')
|
||||
metacode.icon = metacode.icon.sub('generics_96px', 'generics/96px')
|
||||
metacode.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
90
db/schema.rb
90
db/schema.rb
|
@ -9,21 +9,24 @@
|
|||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20141121204712) do
|
||||
ActiveRecord::Schema.define(version: 20151028061513) do
|
||||
|
||||
create_table "in_metacode_sets", :force => true do |t|
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "in_metacode_sets", force: :cascade do |t|
|
||||
t.integer "metacode_id"
|
||||
t.integer "metacode_set_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id"
|
||||
add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id"
|
||||
add_index "in_metacode_sets", ["metacode_id"], name: "index_in_metacode_sets_on_metacode_id", using: :btree
|
||||
add_index "in_metacode_sets", ["metacode_set_id"], name: "index_in_metacode_sets_on_metacode_set_id", using: :btree
|
||||
|
||||
create_table "mappings", :force => true do |t|
|
||||
create_table "mappings", force: :cascade do |t|
|
||||
t.text "category"
|
||||
t.integer "xloc"
|
||||
t.integer "yloc"
|
||||
|
@ -31,18 +34,26 @@ ActiveRecord::Schema.define(:version => 20141121204712) do
|
|||
t.integer "synapse_id"
|
||||
t.integer "map_id"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "mappable_id"
|
||||
t.string "mappable_type"
|
||||
end
|
||||
|
||||
create_table "maps", :force => true do |t|
|
||||
add_index "mappings", ["map_id", "synapse_id"], name: "index_mappings_on_map_id_and_synapse_id", using: :btree
|
||||
add_index "mappings", ["map_id", "topic_id"], name: "index_mappings_on_map_id_and_topic_id", using: :btree
|
||||
add_index "mappings", ["map_id"], name: "index_mappings_on_map_id", using: :btree
|
||||
add_index "mappings", ["mappable_id", "mappable_type"], name: "index_mappings_on_mappable_id_and_mappable_type", using: :btree
|
||||
add_index "mappings", ["user_id"], name: "index_mappings_on_user_id", using: :btree
|
||||
|
||||
create_table "maps", force: :cascade do |t|
|
||||
t.text "name"
|
||||
t.boolean "arranged"
|
||||
t.text "desc"
|
||||
t.text "permission"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "featured"
|
||||
t.string "screenshot_file_name"
|
||||
t.string "screenshot_content_type"
|
||||
|
@ -50,26 +61,28 @@ ActiveRecord::Schema.define(:version => 20141121204712) do
|
|||
t.datetime "screenshot_updated_at"
|
||||
end
|
||||
|
||||
create_table "metacode_sets", :force => true do |t|
|
||||
add_index "maps", ["user_id"], name: "index_maps_on_user_id", using: :btree
|
||||
|
||||
create_table "metacode_sets", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.text "desc"
|
||||
t.integer "user_id"
|
||||
t.boolean "mapperContributed"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id"
|
||||
add_index "metacode_sets", ["user_id"], name: "index_metacode_sets_on_user_id", using: :btree
|
||||
|
||||
create_table "metacodes", :force => true do |t|
|
||||
create_table "metacodes", force: :cascade do |t|
|
||||
t.text "name"
|
||||
t.string "icon"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "color"
|
||||
end
|
||||
|
||||
create_table "synapses", :force => true do |t|
|
||||
create_table "synapses", force: :cascade do |t|
|
||||
t.text "desc"
|
||||
t.text "category"
|
||||
t.text "weight"
|
||||
|
@ -77,19 +90,25 @@ ActiveRecord::Schema.define(:version => 20141121204712) do
|
|||
t.integer "node1_id"
|
||||
t.integer "node2_id"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "topics", :force => true do |t|
|
||||
add_index "synapses", ["node1_id", "node1_id"], name: "index_synapses_on_node1_id_and_node1_id", using: :btree
|
||||
add_index "synapses", ["node1_id"], name: "index_synapses_on_node1_id", using: :btree
|
||||
add_index "synapses", ["node2_id", "node2_id"], name: "index_synapses_on_node2_id_and_node2_id", using: :btree
|
||||
add_index "synapses", ["node2_id"], name: "index_synapses_on_node2_id", using: :btree
|
||||
add_index "synapses", ["user_id"], name: "index_synapses_on_user_id", using: :btree
|
||||
|
||||
create_table "topics", force: :cascade do |t|
|
||||
t.text "name"
|
||||
t.text "desc"
|
||||
t.text "link"
|
||||
t.text "permission"
|
||||
t.integer "user_id"
|
||||
t.integer "metacode_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "image_file_name"
|
||||
t.string "image_content_type"
|
||||
t.integer "image_file_size"
|
||||
|
@ -100,25 +119,28 @@ ActiveRecord::Schema.define(:version => 20141121204712) do
|
|||
t.datetime "audio_updated_at"
|
||||
end
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
add_index "topics", ["metacode_id"], name: "index_topics_on_metacode_id", using: :btree
|
||||
add_index "topics", ["user_id"], name: "index_topics_on_user_id", using: :btree
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "email"
|
||||
t.text "settings"
|
||||
t.string "code", :limit => 8
|
||||
t.string "joinedwithcode", :limit => 8
|
||||
t.string "code", limit: 8
|
||||
t.string "joinedwithcode", limit: 8
|
||||
t.string "crypted_password"
|
||||
t.string "password_salt"
|
||||
t.string "persistence_token"
|
||||
t.string "perishable_token"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => ""
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "encrypted_password", limit: 128, default: ""
|
||||
t.string "remember_token"
|
||||
t.datetime "remember_created_at"
|
||||
t.string "reset_password_token"
|
||||
t.datetime "last_sign_in_at"
|
||||
t.string "last_sign_in_ip"
|
||||
t.integer "sign_in_count", :default => 0
|
||||
t.integer "sign_in_count", default: 0
|
||||
t.datetime "current_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.datetime "reset_password_sent_at"
|
||||
|
@ -130,6 +152,6 @@ ActiveRecord::Schema.define(:version => 20141121204712) do
|
|||
t.integer "generation"
|
||||
end
|
||||
|
||||
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
||||
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
|
||||
|
||||
end
|
||||
|
|
309
db/seeds.rb
309
db/seeds.rb
|
@ -1,7 +1,306 @@
|
|||
# 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)
|
||||
|
||||
## USERS
|
||||
User.new({
|
||||
name: 'user',
|
||||
email: 'user@user.com',
|
||||
password: 'toolsplusconsciousness',
|
||||
code: 'qwertyui',
|
||||
joinedwithcode: 'qwertyui',
|
||||
admin: 'false'
|
||||
}).save(validate: false)
|
||||
|
||||
User.new({
|
||||
name: 'admin',
|
||||
email: 'admin@admin.com',
|
||||
password: 'toolsplusconsciousness',
|
||||
code: 'iuytrewq',
|
||||
joinedwithcode: 'iuytrewq',
|
||||
admin: 'true'
|
||||
}).save(validate: false)
|
||||
## END USERS
|
||||
|
||||
## METACODES
|
||||
Metacode.create({
|
||||
name: 'Action',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png',
|
||||
color: '#BD6C85'
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Activity',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_activity.png',
|
||||
color: '#6EBF65'
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Catalyst',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_catalyst.png',
|
||||
color: '#EF8964',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Closed',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_closedissue.png',
|
||||
color: '#ABB49F',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Process',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_process.png',
|
||||
color: '#BDB25E',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Future',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_futuredev.png',
|
||||
color: '#25A17F',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Group',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_group.png',
|
||||
color: '#7076BC',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Implication',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_implication.png',
|
||||
color: '#83DECA',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Insight',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_insight.png',
|
||||
color: '#B074AD',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Intention',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_intention.png',
|
||||
color: '#BAEAFF',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Knowledge',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_knowledge.png',
|
||||
color: '#60ACF7',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Location',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_location.png',
|
||||
color: '#ABD9A7',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Need',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_need.png',
|
||||
color: '#D2A7D4',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Open',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_openissue.png',
|
||||
color: '#9BBF71',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Opportunity',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_opportunity.png',
|
||||
color: '#889F64',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Person',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_person.png',
|
||||
color: '#DE925F',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Platform',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_platform.png',
|
||||
color: '#21C8FE',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Problem',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_problem.png',
|
||||
color: '#99CFC4',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Resource',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_resource.png',
|
||||
color: '#C98C63',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Role',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_role.png',
|
||||
color: '#A8595D',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Task',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_task.png',
|
||||
color: '#3397C4',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Trajectory',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_trajectory.png',
|
||||
color: '#D3AA4C',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Argument',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_argument.png',
|
||||
color: '#7FAEFD',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Con',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_con.png',
|
||||
color: '#CF7C74',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Subject',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_subject.png',
|
||||
color: '#8293D8',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Decision',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_decision.png',
|
||||
color: '#CCA866',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Event',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_event.png',
|
||||
color: '#F5854B',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Example',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_example.png',
|
||||
color: '#618C61',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Experience',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_experience.png',
|
||||
color: '#BE995F',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Feedback',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_feedback.png',
|
||||
color: '#54A19D',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Aim',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_aim.png',
|
||||
color: '#B0B0B0',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Good',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_goodpractice.png',
|
||||
color: '#BD9E86',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Idea',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_idea.png',
|
||||
color: '#C4BC5E',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'List',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_list.png',
|
||||
color: '#B7A499',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Media',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_media.png',
|
||||
color: '#6D94CC',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Metamap',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_metamap.png',
|
||||
color: '#AEA9FD',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Model',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_model.png',
|
||||
color: '#B385BA',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Note',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_note.png',
|
||||
color: '#A389A1',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Perspective',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_perspective.png',
|
||||
color: '#2EB6CC',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Pro',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_pro.png',
|
||||
color: '#89B879',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Project',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_project.png',
|
||||
color: '#85A050',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Question',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_question.png',
|
||||
color: '#5CB3B3',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Reference',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_reference.png',
|
||||
color: '#A7A7A7',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Research',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_research.png',
|
||||
color: '#CD8E89',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Status',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_status.png',
|
||||
color: '#EFA7C0',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Tool',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_tool.png',
|
||||
color: '#828282',
|
||||
})
|
||||
|
||||
Metacode.create({
|
||||
name: 'Wildcard',
|
||||
icon: 'https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_wildcard.png',
|
||||
color: '#73C7DE',
|
||||
})
|
||||
## END METACODES
|
||||
|
|
43
doc/MacInstallation.md
Normal file
43
doc/MacInstallation.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# OSX Install
|
||||
|
||||
If you are doing an upgrade and or recent pull for changes you will need to change your default ruby package from 2.1.1 to ruby 2.1.2
|
||||
|
||||
Some of these steps are pulled from http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/
|
||||
|
||||
Install homebrew
|
||||
|
||||
\curl -sSL https://get.rvm.io | bash -s stable --rails
|
||||
rvm install 2.1.3 --with-gcc=clang
|
||||
rvm use 2.1.3
|
||||
gem install lunchy
|
||||
|
||||
Now install homebrew.
|
||||
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
|
||||
Then install nodejs
|
||||
|
||||
brew install nodejs
|
||||
|
||||
And postgresql:
|
||||
|
||||
brew install postgresql
|
||||
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
|
||||
createuser metamaps -P -s -d
|
||||
|
||||
Set a password, then start the service:
|
||||
|
||||
lunchy start postgres
|
||||
|
||||
Change directory to the metamaps git repository, and run:
|
||||
|
||||
bundle install
|
||||
|
||||
Copy the .example-env file and rename it to .env. Then modify the DB_USERNAME and DB_PASSWORD values to match the postgres username and password you set
|
||||
|
||||
rake db:create
|
||||
rake db:schema:load
|
||||
rake db:fixtures:load
|
||||
rails server
|
||||
|
||||
Now open a browser to http://localhost:3000!
|
|
@ -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.
|
53
doc/RspecTesting.md
Normal file
53
doc/RspecTesting.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
## Testing with RSpec
|
||||
|
||||
RSpec is a ruby gem that allows you to test your code base. This is great -
|
||||
every time you make a change, you can do some basic sanity checks to make sure
|
||||
you didn't break anything.
|
||||
|
||||
To test Metamaps, run
|
||||
|
||||
rspec
|
||||
|
||||
in the top level directory. It will automatically search the `spec` directory
|
||||
for files called `*_spec.rb`, and run them as tests. When it's done testing, it
|
||||
will print a report telling you how many tests failed. With luck, the number
|
||||
will be 0.
|
||||
|
||||
Note that if your test database doesn't exist yet, you'll need to create it
|
||||
first:
|
||||
|
||||
RAILS_ENV=test rake db:create
|
||||
|
||||
At the time of writing, there are four directories in the spec folder. One,
|
||||
`support`, is for helper functions. `rails_helper.rb` and `spec_helper.rb` are
|
||||
also for helper functions.
|
||||
|
||||
`factories` is for a gem called [factory-girl][factory-girl]. This gem lets you
|
||||
use the `create` and `build` functions to quickly create the simplest possible
|
||||
valid version of a given model. For instance:
|
||||
|
||||
let(:map1) { create :map }
|
||||
let(:ronald) { create :user, name: "Ronald" }
|
||||
let(:map2) { create :map, user: ronald }
|
||||
|
||||
As you can see, you can also customize the factories. You can read the full
|
||||
documentation at the link above or check the existing specs to see how it works.
|
||||
It is worth reading through the factories to see how they are defined. If you
|
||||
add a model to `app/models`, please also create a factory for it that defines
|
||||
the minimum valid state for that model.
|
||||
|
||||
Finally, `models` and `controllers` have the actual spec files. Writing specs is
|
||||
usually fairly simple but you do need to understand the syntax. You can read
|
||||
more at [rspec.info][rspec-docs].
|
||||
|
||||
If you modify the metamaps codebase, please consider adding tests verifying that
|
||||
the added code works. This will help in a few ways:
|
||||
|
||||
- Unrelated changes in the future that break your code will be spotted earlier
|
||||
- Your changes will be more easily understood, since the *purpose* will be
|
||||
described by the spec
|
||||
|
||||
Happy testing!
|
||||
|
||||
[factory-girl]: https://github.com/thoughtbot/factory_girl
|
||||
[rspec-docs]: http://rspec.info
|
98
doc/UbuntuInstallation.md
Normal file
98
doc/UbuntuInstallation.md
Normal file
|
@ -0,0 +1,98 @@
|
|||
Firstly this walkthrough is done with a 14.04 32bit install of Ubuntu.
|
||||
Let's check if all updates for the system are installed first. In a
|
||||
terminal type:
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
Now we need to install git:
|
||||
|
||||
sudo apt-get install git
|
||||
|
||||
Now let's get our RVM installed (Ruby Version Manager). Now this is fun
|
||||
because the package you will get from apt-get is outdated. So we are going
|
||||
to use CURL to get RVM
|
||||
|
||||
sudo apt-get install curl
|
||||
|
||||
Then lets install RVM with curl like this
|
||||
|
||||
gpg --keyserver hkp://keys.gnupg.net \
|
||||
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
|
||||
\curl -sSL https://get.rvm.io | bash -s stable
|
||||
PATH=$PATH:$HOME/.rvm/bin
|
||||
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile"
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
||||
source ~/.rvm/scripts/rvm
|
||||
|
||||
Now we can actually install RVM
|
||||
|
||||
rvm requirements
|
||||
|
||||
Running this will check your system for requirements as well so you will need to put your system password in.
|
||||
|
||||
All right now we can download metamaps from the master using git
|
||||
|
||||
git clone https://github.com/metamaps/metamaps_gen002.git
|
||||
|
||||
Now there is a couple other things we are going to need which is nodejs, postgresql, libpq-dev and redis-server
|
||||
|
||||
sudo apt-get install nodejs npm
|
||||
sudo ln -s /usr/bin/nodejs /usr/bin/node
|
||||
sudo apt-get install postgresql
|
||||
sudo apt-get install libpq-dev
|
||||
sudo apt-get install redis-server
|
||||
|
||||
Furthermore, if you want to be able to work on profile picture uploading,
|
||||
or use it you'll need ImageMagick. On Ubuntu, you can just go find
|
||||
ImageMagick in the Ubuntu Software Centre
|
||||
|
||||
Install the specific version of ruby needed this will take some time
|
||||
|
||||
rvm install $(cat metamaps_gen002/.ruby-version)
|
||||
|
||||
Now we also need to copy .example-env to a new file named .env. Review the
|
||||
configuration in here to see if you need any changes.
|
||||
|
||||
cp .example-env .env
|
||||
|
||||
Now run inside your metamaps_gen002 folder:
|
||||
|
||||
gem install bundle
|
||||
bundle install
|
||||
|
||||
in your top level directory for metamaps. This is a lengthy process so you might want to go and make a coffee or something :)
|
||||
|
||||
All right now we need to make sure your postgres password is the same as
|
||||
it is listed in the .env file so we are going to set it by
|
||||
|
||||
sudo -u postgres psql
|
||||
|
||||
Use these commands to set the password to 3112 and then quit:
|
||||
|
||||
\password postgres
|
||||
\q
|
||||
|
||||
now we can use rake to create, load the schema into, and load db/seeds.rb
|
||||
into the postgres database:
|
||||
|
||||
rake db:setup
|
||||
|
||||
Open a new terminal, navigate to the metamaps directory, and execute the
|
||||
server:
|
||||
|
||||
rails s
|
||||
|
||||
and dont forget to run the other server for realtime...
|
||||
|
||||
cd realtime
|
||||
npm install
|
||||
node realtime-server.js
|
||||
|
||||
Now you're all set enjoy your personal server of metamaps :) 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!
|
54
doc/WindowsInstallation.md
Normal file
54
doc/WindowsInstallation.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
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.
|
||||
|
||||
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 `.example-env`, and rename the copy to `.env`. Edit the file and
|
||||
set the DB_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 `.env` 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
39
doc/metamaps-qa-steps.md
Normal 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).
|
|
@ -1,6 +1,8 @@
|
|||
require 'dotenv/tasks'
|
||||
|
||||
namespace :heroku do
|
||||
desc "Generate the Heroku gems manifest from gem dependencies"
|
||||
task :gems do
|
||||
task :gems => :dotenv do
|
||||
RAILS_ENV='production'
|
||||
Rake::Task[:environment].invoke
|
||||
list = Rails.configuration.gems.collect do |g|
|
||||
|
@ -12,4 +14,4 @@ namespace :heroku do
|
|||
f.write(list)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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%;
|
||||
|
|
|
@ -1 +1,18 @@
|
|||
'Real-Time'
|
||||
## Node.js realtime server
|
||||
|
||||
To run the server, you need to install the dependencies and run the server.
|
||||
Please ensure you have followed the OS-specific instructions in doc/ to
|
||||
install NodeJS. Once you have node, then you can proceed to install the
|
||||
node packages for the realtime server:
|
||||
|
||||
cd realtime
|
||||
npm install #creates node_modules directory
|
||||
node realtime-server.js
|
||||
|
||||
That's it!
|
||||
|
||||
To run the server as a daemon that will be re-run if it crashes, you can
|
||||
use the forever node package.
|
||||
|
||||
sudo npm install -g forever
|
||||
forever start realtime-server.js
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"name": "RoR-real-time",
|
||||
"description": "providing real-time sychronization for ruby on rails",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"socket.io": "0.9.12"
|
||||
}
|
||||
|
|
160
spec/controllers/mappings_controller_spec.rb
Normal file
160
spec/controllers/mappings_controller_spec.rb
Normal file
|
@ -0,0 +1,160 @@
|
|||
require 'rails_helper'
|
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||
# It demonstrates how one might use RSpec to specify the controller code that
|
||||
# was generated by Rails when you ran the scaffold generator.
|
||||
#
|
||||
# It assumes that the implementation code is generated by the rails scaffold
|
||||
# generator. If you are using any extension libraries to generate different
|
||||
# controller code, this generated spec may or may not pass.
|
||||
#
|
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||
# of tools you can use to make these specs even more expressive, but we're
|
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||
#
|
||||
# Compared to earlier versions of this generator, there is very limited use of
|
||||
# stubs and message expectations in this spec. Stubs are only used when there
|
||||
# is no simpler way to get a handle on the object needed for the example.
|
||||
# Message expectations are only used when there is no simpler way to specify
|
||||
# that an instance is receiving a specific message.
|
||||
|
||||
RSpec.describe MappingsController, type: :controller do
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# Mapping. As you add validations to Mapping, be sure to
|
||||
# adjust the attributes here as well.
|
||||
let(:valid_attributes) do
|
||||
skip('Add a hash of attributes valid for your model')
|
||||
end
|
||||
|
||||
let(:invalid_attributes) do
|
||||
skip('Add a hash of attributes invalid for your model')
|
||||
end
|
||||
|
||||
# This should return the minimal set of values that should be in the session
|
||||
# in order to pass any filters (e.g. authentication) defined in
|
||||
# MappingsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe 'GET #index' do
|
||||
it 'assigns all mappings as @mappings' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
get :index, {}, valid_session
|
||||
expect(assigns(:mappings)).to eq([mapping])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'assigns the requested mapping as @mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
get :show, { id: mapping.to_param }, valid_session
|
||||
expect(assigns(:mapping)).to eq(mapping)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested mapping as @mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
get :edit, { id: mapping.to_param }, valid_session
|
||||
expect(assigns(:mapping)).to eq(mapping)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'with valid params' do
|
||||
it 'creates a new Mapping' do
|
||||
expect do
|
||||
post :create, { mapping: valid_attributes }, valid_session
|
||||
end.to change(Mapping, :count).by(1)
|
||||
end
|
||||
|
||||
it 'assigns a newly created mapping as @mapping' do
|
||||
post :create, { mapping: valid_attributes }, valid_session
|
||||
expect(assigns(:mapping)).to be_a(Mapping)
|
||||
expect(assigns(:mapping)).to be_persisted
|
||||
end
|
||||
|
||||
it 'redirects to the created mapping' do
|
||||
post :create, { mapping: valid_attributes }, valid_session
|
||||
expect(response).to redirect_to(Mapping.last)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid params' do
|
||||
it 'assigns a newly created but unsaved mapping as @mapping' do
|
||||
post :create, { mapping: invalid_attributes }, valid_session
|
||||
expect(assigns(:mapping)).to be_a_new(Mapping)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
post :create, { mapping: invalid_attributes }, valid_session
|
||||
expect(response).to render_template('new')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
context 'with valid params' do
|
||||
let(:new_attributes) do
|
||||
skip('Add a hash of attributes valid for your model')
|
||||
end
|
||||
|
||||
it 'updates the requested mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
put :update,
|
||||
{ id: mapping.to_param, mapping: new_attributes },
|
||||
valid_session
|
||||
mapping.reload
|
||||
skip('Add assertions for updated state')
|
||||
end
|
||||
|
||||
it 'assigns the requested mapping as @mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
put :update,
|
||||
{ id: mapping.to_param, mapping: valid_attributes },
|
||||
valid_session
|
||||
expect(assigns(:mapping)).to eq(mapping)
|
||||
end
|
||||
|
||||
it 'redirects to the mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
put :update,
|
||||
{ id: mapping.to_param, mapping: valid_attributes },
|
||||
valid_session
|
||||
expect(response).to redirect_to(mapping)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid params' do
|
||||
it 'assigns the mapping as @mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
put :update,
|
||||
{ id: mapping.to_param, mapping: invalid_attributes },
|
||||
valid_session
|
||||
expect(assigns(:mapping)).to eq(mapping)
|
||||
end
|
||||
|
||||
it "re-renders the 'edit' template" do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
put :update,
|
||||
{ id: mapping.to_param, mapping: invalid_attributes },
|
||||
valid_session
|
||||
expect(response).to render_template('edit')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
it 'destroys the requested mapping' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
expect do
|
||||
delete :destroy, { id: mapping.to_param }, valid_session
|
||||
end.to change(Mapping, :count).by(-1)
|
||||
end
|
||||
|
||||
it 'redirects to the mappings list' do
|
||||
mapping = Mapping.create! valid_attributes
|
||||
delete :destroy, { id: mapping.to_param }, valid_session
|
||||
expect(response).to redirect_to(mappings_url)
|
||||
end
|
||||
end
|
||||
end
|
160
spec/controllers/maps_controller_spec.rb
Normal file
160
spec/controllers/maps_controller_spec.rb
Normal file
|
@ -0,0 +1,160 @@
|
|||
require 'rails_helper'
|
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||
# It demonstrates how one might use RSpec to specify the controller code that
|
||||
# was generated by Rails when you ran the scaffold generator.
|
||||
#
|
||||
# It assumes that the implementation code is generated by the rails scaffold
|
||||
# generator. If you are using any extension libraries to generate different
|
||||
# controller code, this generated spec may or may not pass.
|
||||
#
|
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||
# of tools you can use to make these specs even more expressive, but we're
|
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||
#
|
||||
# Compared to earlier versions of this generator, there is very limited use of
|
||||
# stubs and message expectations in this spec. Stubs are only used when there
|
||||
# is no simpler way to get a handle on the object needed for the example.
|
||||
# Message expectations are only used when there is no simpler way to specify
|
||||
# that an instance is receiving a specific message.
|
||||
|
||||
RSpec.describe MapsController, type: :controller do
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# Map. As you add validations to Map, be sure to
|
||||
# adjust the attributes here as well.
|
||||
let(:valid_attributes) do
|
||||
skip('Add a hash of attributes valid for your model')
|
||||
end
|
||||
|
||||
let(:invalid_attributes) do
|
||||
skip('Add a hash of attributes invalid for your model')
|
||||
end
|
||||
|
||||
# This should return the minimal set of values that should be in the session
|
||||
# in order to pass any filters (e.g. authentication) defined in
|
||||
# MapsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe 'GET #index' do
|
||||
it 'assigns all maps as @maps' do
|
||||
map = Map.create! valid_attributes
|
||||
get :index, {}, valid_session
|
||||
expect(assigns(:maps)).to eq([map])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'assigns the requested map as @map' do
|
||||
map = Map.create! valid_attributes
|
||||
get :show, { id: map.to_param }, valid_session
|
||||
expect(assigns(:map)).to eq(map)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested map as @map' do
|
||||
map = Map.create! valid_attributes
|
||||
get :edit, { id: map.to_param }, valid_session
|
||||
expect(assigns(:map)).to eq(map)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
context 'with valid params' do
|
||||
it 'creates a new Map' do
|
||||
expect do
|
||||
post :create, { map: valid_attributes }, valid_session
|
||||
end.to change(Map, :count).by(1)
|
||||
end
|
||||
|
||||
it 'assigns a newly created map as @map' do
|
||||
post :create, { map: valid_attributes }, valid_session
|
||||
expect(assigns(:map)).to be_a(Map)
|
||||
expect(assigns(:map)).to be_persisted
|
||||
end
|
||||
|
||||
it 'redirects to the created map' do
|
||||
post :create, { map: valid_attributes }, valid_session
|
||||
expect(response).to redirect_to(Map.last)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid params' do
|
||||
it 'assigns a newly created but unsaved map as @map' do
|
||||
post :create, { map: invalid_attributes }, valid_session
|
||||
expect(assigns(:map)).to be_a_new(Map)
|
||||
end
|
||||
|
||||
it "re-renders the 'new' template" do
|
||||
post :create, { map: invalid_attributes }, valid_session
|
||||
expect(response).to render_template('new')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT #update' do
|
||||
context 'with valid params' do
|
||||
let(:new_attributes) do
|
||||
skip('Add a hash of attributes valid for your model')
|
||||
end
|
||||
|
||||
it 'updates the requested map' do
|
||||
map = Map.create! valid_attributes
|
||||
put :update,
|
||||
{ id: map.to_param, map: new_attributes },
|
||||
valid_session
|
||||
map.reload
|
||||
skip('Add assertions for updated state')
|
||||
end
|
||||
|
||||
it 'assigns the requested map as @map' do
|
||||
map = Map.create! valid_attributes
|
||||
put :update,
|
||||
{ id: map.to_param, map: valid_attributes },
|
||||
valid_session
|
||||
expect(assigns(:map)).to eq(map)
|
||||
end
|
||||
|
||||
it 'redirects to the map' do
|
||||
map = Map.create! valid_attributes
|
||||
put :update,
|
||||
{ id: map.to_param, map: valid_attributes },
|
||||
valid_session
|
||||
expect(response).to redirect_to(map)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with invalid params' do
|
||||
it 'assigns the map as @map' do
|
||||
map = Map.create! valid_attributes
|
||||
put :update,
|
||||
{ id: map.to_param, map: invalid_attributes },
|
||||
valid_session
|
||||
expect(assigns(:map)).to eq(map)
|
||||
end
|
||||
|
||||
it "re-renders the 'edit' template" do
|
||||
map = Map.create! valid_attributes
|
||||
put :update,
|
||||
{ id: map.to_param, map: invalid_attributes },
|
||||
valid_session
|
||||
expect(response).to render_template('edit')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
it 'destroys the requested map' do
|
||||
map = Map.create! valid_attributes
|
||||
expect do
|
||||
delete :destroy, { id: map.to_param }, valid_session
|
||||
end.to change(Map, :count).by(-1)
|
||||
end
|
||||
|
||||
it 'redirects to the maps list' do
|
||||
map = Map.create! valid_attributes
|
||||
delete :destroy, { id: map.to_param }, valid_session
|
||||
expect(response).to redirect_to(maps_url)
|
||||
end
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue