From 6e79b58e16e4b6a9c69051e31fb387b478f8af73 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Tue, 27 Oct 2015 21:44:38 -0700 Subject: [PATCH 01/37] updated files to use amazon assets --- .gitignore | 2 + app/models/map.rb | 2 +- app/models/user.rb | 2 +- public/404.html | 4 +- test/fixtures/metacodes.yml | 94 ++++++++++++++++++------------------- 5 files changed, 53 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index 9eded787..c6358ead 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,6 @@ log/*.log tmp .DS_Store +*/.DS_Store +.DS_Store? .vagrant diff --git a/app/models/map.rb b/app/models/map.rb index eab88814..75774df8 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -12,7 +12,7 @@ class Map < ActiveRecord::Base :thumb => ['188x126#', :png] #:full => ['940x630#', :png] }, - :default_url => ActionController::Base.helpers.asset_path('missing-map.png') + :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ diff --git a/app/models/user.rb b/app/models/user.rb index effa6ec5..f6b0d65a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,7 +35,7 @@ class User < ActiveRecord::Base :ninetysix => ['96x96#', :png], :onetwentyeight => ['128x128#', :png] }, - :default_url => ActionController::Base.helpers.asset_path('user.png') + :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/user.png' # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ diff --git a/public/404.html b/public/404.html index 643a5ded..da435ea6 100644 --- a/public/404.html +++ b/public/404.html @@ -26,7 +26,7 @@ } body { - background: #d8d9da url(/assets/shattered_@2X.png); + background: #d8d9da url(https://s3.amazonaws.com/metamaps-assets/site/shattered_%402X.png); font-family: 'din-regular', helvetica, sans-serif; color: #424242; text-align: justify; @@ -61,7 +61,7 @@ border-radius: 225px; -webkit-border-radius: 225px; -moz-border-radius: 225px; - background: url(/assets/monkeyselfie.jpg) no-repeat; + background: url(https://s3.amazonaws.com/metamaps-assets/site/monkeyselfie.jpg) no-repeat; float: left; background-position:50% 20%; background-size: 100%; diff --git a/test/fixtures/metacodes.yml b/test/fixtures/metacodes.yml index 02ec0663..80780734 100644 --- a/test/fixtures/metacodes.yml +++ b/test/fixtures/metacodes.yml @@ -6,235 +6,235 @@ # one: name: Action - icon: /assets/icons/blueprint_96px/bp_action.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_action.png color: #BD6C85 two: name: Activity - icon: /assets/icons/blueprint_96px/bp_activity.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_activity.png color: #6EBF65 three: name: Catalyst - icon: /assets/icons/blueprint_96px/bp_catalyst.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_catalyst.png color: #EF8964 four: name: Closed - icon: /assets/icons/blueprint_96px/bp_closedissue.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_closedissue.png color: #ABB49F five: name: Process - icon: /assets/icons/blueprint_96px/bp_process.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_process.png color: #BDB25E six: name: Future Dev - icon: /assets/icons/blueprint_96px/bp_futuredev.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_futuredev.png color: #25A17F seven: name: Group - icon: /assets/icons/blueprint_96px/bp_group.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_group.png color: #7076BC eight: name: Implication - icon: /assets/icons/blueprint_96px/bp_implication.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_implication.png color: #83DECA nine: name: Insight - icon: /assets/icons/blueprint_96px/bp_insight.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_insight.png color: #B074AD ten: name: Intention - icon: /assets/icons/blueprint_96px/bp_intention.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_intention.png color: #BAEAFF eleven: name: Knowledge - icon: /assets/icons/blueprint_96px/bp_knowledge.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_knowledge.png color: #60ACF7 twelve: name: Location - icon: /assets/icons/blueprint_96px/bp_location.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_location.png color: #ABD9A7 thirteen: name: Need - icon: /assets/icons/blueprint_96px/bp_need.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_need.png color: #D2A7D4 fourteen: name: Open Issue - icon: /assets/icons/blueprint_96px/bp_openissue.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_openissue.png color: #9BBF71 fifteen: name: Opportunity - icon: /assets/icons/blueprint_96px/bp_opportunity.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_opportunity.png color: #889F64 sixteen: name: Person - icon: /assets/icons/blueprint_96px/bp_person.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_person.png color: #DE925F seventeen: name: Platform - icon: /assets/icons/blueprint_96px/bp_platform.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_platform.png color: #21C8FE eighteen: name: Problem - icon: /assets/icons/blueprint_96px/bp_problem.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_problem.png color: #99CFC4 nineteen: name: Resource - icon: /assets/icons/blueprint_96px/bp_resource.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_resource.png color: #C98C63 twenty: name: Role - icon: /assets/icons/blueprint_96px/bp_role.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_role.png color: #A8595D twenty-one: name: Task - icon: /assets/icons/blueprint_96px/bp_task.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_task.png color: #3397C4 twenty-two: name: Trajectory - icon: /assets/icons/blueprint_96px/bp_trajectory.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/blueprint/96px/bp_trajectory.png color: #D3AA4C twenty-three: name: Argument - icon: /assets/icons/generics_96px/gen_argument.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_argument.png color: #7FAEFD twenty-four: name: Con - icon: /assets/icons/generics_96px/gen_con.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_con.png color: #CF7C74 twenty-five: name: Subject - icon: /assets/icons/generics_96px/gen_subject.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_subject.png color: #8293D8 twenty-six: name: Decision - icon: /assets/icons/generics_96px/gen_decision.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_decision.png color: #CCA866 twenty-seven: name: Event - icon: /assets/icons/generics_96px/gen_event.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_event.png color: #F5854B twenty-eight: name: Example - icon: /assets/icons/generics_96px/gen_example.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_example.png color: #618C61 twenty-nine: name: Experience - icon: /assets/icons/generics_96px/gen_experience.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_experience.png color: #BE995F thirty: name: Feedback - icon: /assets/icons/generics_96px/gen_feedback.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_feedback.png color: #54A19D thirty-one: name: Aim - icon: /assets/icons/generics_96px/gen_aim.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_aim.png color: #B0B0B0 thirty-two: name: Good Practice - icon: /assets/icons/generics_96px/gen_goodpractice.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_goodpractice.png color: #BD9E86 thirty-three: name: Idea - icon: /assets/icons/generics_96px/gen_idea.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_idea.png color: #C4BC5E thirty-four: name: List - icon: /assets/icons/generics_96px/gen_list.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_list.png color: #B7A499 thirty-five: name: Media - icon: /assets/icons/generics_96px/gen_media.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_media.png color: #6D94CC thirty-six: name: Metamap - icon: /assets/icons/generics_96px/gen_metamap.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_metamap.png color: #AEA9FD thirty-seven: name: Model - icon: /assets/icons/generics_96px/gen_model.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_model.png color: #B385BA thirty-eight: name: Note - icon: /assets/icons/generics_96px/gen_note.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_note.png color: #A389A1 thirty-nine: name: Perspective - icon: /assets/icons/generics_96px/gen_perspective.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_perspective.png color: #2EB6CC forty: name: Pro - icon: /assets/icons/generics_96px/gen_pro.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_pro.png color: #89B879 forty-one: name: Project - icon: /assets/icons/generics_96px/gen_project.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_project.png color: #85A050 forty-two: name: Question - icon: /assets/icons/generics_96px/gen_question.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_question.png color: #5CB3B3 forty-three: name: Reference - icon: /assets/icons/generics_96px/gen_reference.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_reference.png color: #A7A7A7 forty-four: name: Research - icon: /assets/icons/generics_96px/gen_research.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_research.png color: #CD8E89 forty-five: name: Status update - icon: /assets/icons/generics_96px/gen_status.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_status.png color: #EFA7C0 forty-six: name: Tool - icon: /assets/icons/generics_96px/gen_tool.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_tool.png color: #828282 forty-seven: name: Wildcard - icon: /assets/icons/generics_96px/gen_wildcard.png + icon: https://s3.amazonaws.com/metamaps-assets/metacodes/generics/96px/gen_wildcard.png color: #73C7DE From ddce6ad95c0fbc283b8887ed6698ef04b62070ee Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 28 Oct 2015 14:24:52 +0800 Subject: [PATCH 02/37] migrate metacodes that started with /assets/icons to use amazonaws urls. Remove last migration I made --- ...20151025083043_remove_asset_paths_from_metacodes.rb | 8 -------- .../20151028061513_metacode_asset_path_update.rb | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb create mode 100644 db/migrate/20151028061513_metacode_asset_path_update.rb diff --git a/db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb b/db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb deleted file mode 100644 index c5a5e842..00000000 --- a/db/migrate/20151025083043_remove_asset_paths_from_metacodes.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RemoveAssetPathsFromMetacodes < ActiveRecord::Migration - def change - Metacode.all.each do |metacode| - metacode.icon = metacode.icon.gsub(/^\/assets\//, '') - metacode.save - end - end -end diff --git a/db/migrate/20151028061513_metacode_asset_path_update.rb b/db/migrate/20151028061513_metacode_asset_path_update.rb new file mode 100644 index 00000000..062e9d7e --- /dev/null +++ b/db/migrate/20151028061513_metacode_asset_path_update.rb @@ -0,0 +1,10 @@ +class MetacodeAssetPathUpdate < ActiveRecord::Migration + def change + Metacode.all.each do |metacode| + if metacode.icon.start_with?("/assets/icons/") + metacode.icon = metacode.icon.gsub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes") + metacode.save + end + end + end +end From cda76a4baefd916b9cfdd94c8443fc5956123c19 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 29 Oct 2015 16:18:06 +0800 Subject: [PATCH 03/37] remove ruby from Gemfile in favour of .ruby-version --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index b1333275..7b7da888 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ source 'https://rubygems.org' -ruby '2.1.3' gem 'rails', '4.2.4' From 8e1ae0a1fc248da63c6d433ef45dc8e4549b72c9 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 29 Oct 2015 16:23:41 +0800 Subject: [PATCH 04/37] use secrets.yml to allow overriding config variables --- WindowsInstallation.md | 6 +++--- app/models/map.rb | 2 +- app/models/user.rb | 2 +- config/secrets.yml.default | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/WindowsInstallation.md b/WindowsInstallation.md index 42364b44..25268772 100644 --- a/WindowsInstallation.md +++ b/WindowsInstallation.md @@ -1,4 +1,4 @@ -First off, Metamaps runs on Ruby On Rails. Ruby 2.1.3 and Rails 3.2. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/ +First off, Metamaps runs on Ruby On Rails. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/ You'll also need GIT: http://git-scm.com/download/win @@ -7,7 +7,7 @@ It uses postgreSQL 9.2 as a database. You can install that for your computer fro Once you install those, open a 'command prompt with ruby'. to install rails - gem install rails -v 3.2 + gem install rails -v 4.2 also download node.js, which is also needed http://nodejs.org/download/ @@ -24,7 +24,7 @@ Install all the gems needed for Metamaps by running 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. +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. Then do the same for /config/secrets.yml (the defaults should be OK for this file). 2) In a terminal: diff --git a/app/models/map.rb b/app/models/map.rb index 75774df8..59f10f9f 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -12,7 +12,7 @@ class Map < ActiveRecord::Base :thumb => ['188x126#', :png] #:full => ['940x630#', :png] }, - :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' + :default_url => Rails.secrets.missing_map_png_url # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ diff --git a/app/models/user.rb b/app/models/user.rb index f6b0d65a..ecd09fcd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,7 +35,7 @@ class User < ActiveRecord::Base :ninetysix => ['96x96#', :png], :onetwentyeight => ['128x128#', :png] }, - :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/user.png' + :default_url => Rails.secrets.user_png_url # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ diff --git a/config/secrets.yml.default b/config/secrets.yml.default index 6859262d..eb35a382 100644 --- a/config/secrets.yml.default +++ b/config/secrets.yml.default @@ -1,6 +1,6 @@ defaults: &defaults - missing_map_png_url: '/assets/missing-map.png' - user_png_url: '/assets/user.png' + missing_map_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' + user_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png' development: <<: *defaults From e2a8e0331d66ff57cfed3a7f957a3c3ea62c306b Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 30 Oct 2015 14:18:50 +0800 Subject: [PATCH 05/37] fix references to Rails.application.secrets --- app/models/map.rb | 2 +- app/models/user.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/map.rb b/app/models/map.rb index 59f10f9f..091c684b 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -12,7 +12,7 @@ class Map < ActiveRecord::Base :thumb => ['188x126#', :png] #:full => ['940x630#', :png] }, - :default_url => Rails.secrets.missing_map_png_url + :default_url => Rails.application.secrets.missing_map_png_url # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ diff --git a/app/models/user.rb b/app/models/user.rb index ecd09fcd..8471f6b9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,7 +35,7 @@ class User < ActiveRecord::Base :ninetysix => ['96x96#', :png], :onetwentyeight => ['128x128#', :png] }, - :default_url => Rails.secrets.user_png_url + :default_url => Rails.application.secrets.user_png_url # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ From 8e19083035c0618d4fa2b5a52c7ff13aedd3207e Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 30 Oct 2015 14:21:47 +0800 Subject: [PATCH 06/37] ok put ruby back in Gemfile' --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 7b7da888..b1333275 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source 'https://rubygems.org' +ruby '2.1.3' gem 'rails', '4.2.4' From 6487202e6f21ced4cb3fc0d92ea4e9a5750fad14 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 30 Oct 2015 14:30:24 +0800 Subject: [PATCH 07/37] remove secrets.yml stuff because it doesn't work with heroku --- app/models/map.rb | 2 +- app/models/user.rb | 2 +- config/secrets.yml.default | 12 ------------ 3 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 config/secrets.yml.default diff --git a/app/models/map.rb b/app/models/map.rb index 091c684b..e6a10605 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -12,7 +12,7 @@ class Map < ActiveRecord::Base :thumb => ['188x126#', :png] #:full => ['940x630#', :png] }, - :default_url => Rails.application.secrets.missing_map_png_url + :default_url => 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ diff --git a/app/models/user.rb b/app/models/user.rb index 8471f6b9..f6b0d65a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,7 +35,7 @@ class User < ActiveRecord::Base :ninetysix => ['96x96#', :png], :onetwentyeight => ['128x128#', :png] }, - :default_url => Rails.application.secrets.user_png_url + :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/ diff --git a/config/secrets.yml.default b/config/secrets.yml.default deleted file mode 100644 index eb35a382..00000000 --- a/config/secrets.yml.default +++ /dev/null @@ -1,12 +0,0 @@ -defaults: &defaults - missing_map_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' - user_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png' - -development: - <<: *defaults - -test: - <<: *defaults - -production: - <<: *defaults From c86422dc685abf9e19e15ef472cd2d90df57b6a6 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 2 Nov 2015 00:05:57 +0800 Subject: [PATCH 08/37] update devise.rb with new changes --- config/initializers/devise.rb | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 2924b11e..d01678be 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,6 +1,13 @@ # 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. @@ -121,6 +128,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 +152,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 +159,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 +175,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 +200,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 +247,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 From 5b4bd9724b911c57d0e0340dc09273dfa0a0e04e Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 2 Nov 2015 00:06:12 +0800 Subject: [PATCH 09/37] Gemfile.lock --- Gemfile.lock | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ca22d0b8..f5fa5a3f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -234,6 +234,3 @@ DEPENDENCIES sass-rails uglifier uservoice-ruby - -BUNDLED WITH - 1.10.6 From 9613145e99d74344ba26fcb30b245212ea219c86 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 2 Nov 2015 00:07:52 +0800 Subject: [PATCH 10/37] devise locale text --- config/locales/devise.en.yml | 39 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index d01f375c..26a10f29 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -3,49 +3,50 @@ en: devise: confirmations: - confirmed: "Your account was successfully confirmed. You are now signed in." - send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." - send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." failure: already_authenticated: "You are already signed in." - inactive: "Your account was not activated yet." - invalid: "Invalid email or password." - invalid_token: "Invalid authentication token." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." locked: "Your account is locked." - not_found_in_database: "Invalid email or password." - timeout: "Your session expired, please sign in again to continue." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." unauthenticated: "You need to sign in or sign up before continuing." - unconfirmed: "You have to confirm your account before continuing." + unconfirmed: "You have to confirm your email address before continuing." mailer: confirmation_instructions: subject: "Confirmation instructions" reset_password_instructions: subject: "Reset password instructions" unlock_instructions: - subject: "Unlock Instructions" + subject: "Unlock instructions" omniauth_callbacks: failure: "Could not authenticate you from %{kind} because \"%{reason}\"." success: "Successfully authenticated from %{kind} account." passwords: no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." - send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." - updated: "Your password was changed successfully. You are now signed in." - updated_not_active: "Your password was changed successfully." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." registrations: - destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." signed_up: "Welcome! You have signed up successfully." signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." - signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." - update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." - updated: "You updated your account successfully." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." + updated: "Your account has been updated successfully." sessions: signed_in: "Signed in successfully." signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." unlocks: - send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." - send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." unlocked: "Your account has been unlocked successfully. Please sign in to continue." errors: messages: From d9133b1e29dd9891adb9f439240df9bd29904e01 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 3 Nov 2015 19:10:21 +0800 Subject: [PATCH 11/37] update WindowsInstallation.md --- WindowsInstallation.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/WindowsInstallation.md b/WindowsInstallation.md index 25268772..f4ed3768 100644 --- a/WindowsInstallation.md +++ b/WindowsInstallation.md @@ -1,38 +1,38 @@ -First off, Metamaps runs on Ruby On Rails. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/ +Before you begin, you'll need to install a number of software packages: -You'll also need GIT: http://git-scm.com/download/win +Ruby: http://rubyinstaller.org/downloads +Git: http://git-scm.com/download/win +PostgreSQL 9.2: http://www.enterprisedb.com/products-services-training/pgdownload +nodejs: http://nodejs.org/download -It uses postgreSQL 9.2 as a database. You can install that for your computer from here: http://www.enterprisedb.com/products-services-training/pgdownload . During installation you can choose whatever database password you like. Make sure to note it down! +During the installation of the PostgreSQL database, you'll need to choose a database password. Anything is fine, just note what you choose somewhere. -Once you install those, open a 'command prompt with ruby'. +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. -to install rails +Open a command prompt ("cmd.exe"), and navigate to the folder you chose. Then use the gem command (which is part of Ruby) to install Ruby on Rails. + + cd \git gem install rails -v 4.2 - -also download node.js, which is also needed http://nodejs.org/download/ -Navigate to the folder that you want to download the metamaps files to and run the following: (use your forked git repository address if it's different than this repo. You will also need to go to your Github account settings and add the SSH key that was placed in your clipboard earlier) +Now you are ready to clone the Metamaps git repository: 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: +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 -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. Then do the same for /config/secrets.yml (the defaults should be OK for this file). - -2) In a terminal: + start config + +This command will open a Windows Explorer window of the "config" directory of Metamaps. Copy database.yml.default, and rename the copy to database.yml. Edit the file and set the password to be whatever you set up with postgres earlier. Once you're done, then move back into the command prompt. The next few commands will fail unless database.yml is correctly configured and Postgres is running. rake db:create rake db:schema:load rake db:fixtures:load -Running the server: +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 From 62ae38e70d39f3ed742de8e03a0d84aec3868574 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 3 Nov 2015 20:56:50 +0800 Subject: [PATCH 12/37] fix devise integration for rails 4 --- app/controllers/registrations_controller.rb | 10 ---------- app/controllers/users/registrations_controller.rb | 13 +++++++++++++ app/controllers/users_controller.rb | 9 ++++----- config/application.rb | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 app/controllers/registrations_controller.rb diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb deleted file mode 100644 index 5fff2f1c..00000000 --- a/app/controllers/registrations_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -class Users::RegistrationsController < Devise::RegistrationsController - protected - def after_sign_up_path_for(resource) - signed_in_root_path(resource) - end - - def after_update_path_for(resource) - signed_in_root_path(resource) - end -end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 5fff2f1c..c77edb50 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,4 +1,7 @@ class Users::RegistrationsController < Devise::RegistrationsController + before_filter :configure_sign_up_params, only: [:create] + before_filter :configure_account_update_params, only: [:update] + protected def after_sign_up_path_for(resource) signed_in_root_path(resource) @@ -7,4 +10,14 @@ class Users::RegistrationsController < Devise::RegistrationsController def after_update_path_for(resource) signed_in_root_path(resource) end + + private + def configure_sign_up_params + devise_parameter_sanitizer.for(:sign_up) << [:name, :joinedwithcode] + end + + def configure_account_update_params + puts devise_parameter_sanitizer_for(:account_update) + devise_parameter_sanitizer.for(:account_update) << [:image] + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 52996f49..683e6200 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -22,9 +22,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 +43,7 @@ class UsersController < ApplicationController # trying to change the password correct_pass = @user.valid_password?(params[:current_password]) - if correct_pass && @user.update_attributes(params[:user]) + if correct_pass && @user.update_attributes(user_params) if params[:remove_image] == "1" @user.image = nil end @@ -101,8 +101,7 @@ class UsersController < ApplicationController private def user_params - params.require(:user).permit(:name, :email, :image, :password, - :password_confirmation, :code, :joinedwithcode, :remember_me) + params.require(:user).permit(:name, :email, :image, :password, :password_confirmation) end end diff --git a/config/application.rb b/config/application.rb index f9e0a87d..6bcfbe27 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,7 +2,7 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module Metamaps class Application < Rails::Application From 8b456f5a3107f525147ebd0e5c8c5e3f86057e97 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 3 Nov 2015 21:02:54 +0800 Subject: [PATCH 13/37] css fixes for heroku --- ...ery.mCustomScrollbar.css => jquery.mCustomScrollbar.css.erb} | 1 - app/assets/stylesheets/uservoice.css.erb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) rename app/assets/stylesheets/{jquery.mCustomScrollbar.css => jquery.mCustomScrollbar.css.erb} (96%) diff --git a/app/assets/stylesheets/jquery.mCustomScrollbar.css b/app/assets/stylesheets/jquery.mCustomScrollbar.css.erb similarity index 96% rename from app/assets/stylesheets/jquery.mCustomScrollbar.css rename to app/assets/stylesheets/jquery.mCustomScrollbar.css.erb index f799cdc4..e8588f35 100644 --- a/app/assets/stylesheets/jquery.mCustomScrollbar.css +++ b/app/assets/stylesheets/jquery.mCustomScrollbar.css.erb @@ -162,7 +162,6 @@ .mCSB_scrollTools .mCSB_buttonDown, .mCSB_scrollTools .mCSB_buttonLeft, .mCSB_scrollTools .mCSB_buttonRight{ - background-image:url(<%= asset_data_uri('mCSB_buttons.png') %>); background-repeat:no-repeat; opacity:0.4; filter:"alpha(opacity=40)"; -ms-filter:"alpha(opacity=40)"; /* old ie */ diff --git a/app/assets/stylesheets/uservoice.css.erb b/app/assets/stylesheets/uservoice.css.erb index df15d675..f633c367 100644 --- a/app/assets/stylesheets/uservoice.css.erb +++ b/app/assets/stylesheets/uservoice.css.erb @@ -6,7 +6,7 @@ } div.uv-icon.uv-bottom-left { - background-image:url(<%= asset_data_uri 'feedback_sprite.png' %>); + background-image: url(<%= asset_data_uri 'feedback_sprite.png' %>); background-repeat: no-repeat; color:#FFFFFF; cursor:pointer; From 660ee52292142e15e5f801722877119cdb2bf383 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 3 Nov 2015 22:22:53 +0800 Subject: [PATCH 14/37] make invite link use REQUEST_URI --- app/controllers/application_controller.rb | 11 +++++++++-- app/views/layouts/_lightboxes.html.erb | 5 ++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0a3d12ab..d275eaea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,5 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery + + before_filter :get_invite_link # this is for global login include ContentHelper @@ -47,7 +49,6 @@ private current_user end - def authenticated? current_user end @@ -55,5 +56,11 @@ private def admin? current_user && current_user.admin end - + + def get_invite_link + unsafe_uri = request.env["REQUEST_URI"] + valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ + safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/" + @invite_link = "#{safe_uri}join?code=#{current_user.code}" + end end diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb index e8b688d5..46ab2edf 100644 --- a/app/views/layouts/_lightboxes.html.erb +++ b/app/views/layouts/_lightboxes.html.erb @@ -231,9 +231,8 @@

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

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

- <% mapper = current_user %> -

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

- +

<%= @invite_link %> +

From 6f8c18cd462cd86d08a4483e1cd740ae28894689 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 4 Nov 2015 11:40:52 +0800 Subject: [PATCH 15/37] reorganize metamaps-qa-steps a bit --- doc/metamaps-qa-steps.md | 39 +++++++++++++++++++++++++++++++++++++++ metamaps-qa-steps.txt | 24 ------------------------ 2 files changed, 39 insertions(+), 24 deletions(-) create mode 100644 doc/metamaps-qa-steps.md delete mode 100644 metamaps-qa-steps.txt diff --git a/doc/metamaps-qa-steps.md b/doc/metamaps-qa-steps.md new file mode 100644 index 00000000..a3f136ca --- /dev/null +++ b/doc/metamaps-qa-steps.md @@ -0,0 +1,39 @@ +# Metamaps Tests + +Run these tests to be reasonably sure that your code changes haven't broken anything. + +### Users & Accounts + + - Create an account using your join code + - Log in to the interface + - Check your user's "generation" + - Edit your profile picture, email, name, and password + - Remove your profile picture + +### Maps, Topics, Synapses, and Permissions + + - Create three maps: private, public, and another public + - Change the last map's permissions to commons + - Change a map's name + - Create a topic on map #1 + - Verify (in a private window or another browser) that the second user can't acccess map #1 + - Create a topic on map #2 + - Verify that the second user **can't** edit map #2 + - Create a topic on map #3 + - Verify that the second user **can** edit map #3 + - Pull a topic from map #1 to map #3 + - Create a private topic on map #1 + - Verify that the private topic can be pulled from map #1 by the same user + - Verify that the private topic can't be pulled from map #1 by another user + +### Mappings + + - Add a number of topics to one of your maps. Reload to see if they are still there. + - Add a number of synapses to one of your maps. Reload to see if they are still there. + - Rearrange one of your maps and save the layout. Reload to see if the layout is preserved. + +### Misc + + - Login as admin. Change metacode sets. + - Set the screenshot for one of your maps, and verify the index of maps is updated. + - Open two browsers on map #3 and verify that realtime editing works (you'll need to be running the realtime server for this to work). diff --git a/metamaps-qa-steps.txt b/metamaps-qa-steps.txt deleted file mode 100644 index 36ea193a..00000000 --- a/metamaps-qa-steps.txt +++ /dev/null @@ -1,24 +0,0 @@ -Metamaps Test Suite - -1) Log in to the interface -2) Create an account using your join code -3) Check your user's "generation" -4) Create three maps: private, public, and another public -5) Change the last map's permissions to commons -6) Change a map's name -7) Create a topic on map #1 -8) Verify (in a private window or another browser) that the second user can't acccess map #1 -9) Create a topic on map #2 -10) Verify that the second user can't edit map #2 -11) Create a topic on map #3 -12) Verify that the second can edit map #3 -13) Pull a topic from map #1 to map #3 -14) Create a private topic on map #1 -15) Verify that the private topic can be pulled from map #1 by the same user -16) Verify that the private topic can't be pulled from map #1 by another user -17) Login as admin. Change metacode sets. -18) Add a number of topics to one of your maps. Reload to see if they are still there. -19) Add a number of synapses to one of your maps. Reload to see if they are still there. -20) Rearrange one of your maps. Reload to see if the layout is preserved. -21) Set the screenshot for one of your maps, and verify the index of maps is updated. -22) Open two browsers on map #3 and verify that realtime editing works. From 3eff85033641a0d8bacf2591ee30104790e88512 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 4 Nov 2015 11:41:04 +0800 Subject: [PATCH 16/37] reorganize documentation --- README.md | 6 +++--- CHANGELOG.md => doc/CHANGELOG.md | 0 CONTRIBUTING.md => doc/CONTRIBUTING.md | 0 MacInstallation.md => doc/MacInstallation.md | 0 doc/README_FOR_APP | 2 -- UbuntuInstallation.md => doc/UbuntuInstallation.md | 0 WindowsInstallation.md => doc/WindowsInstallation.md | 0 7 files changed, 3 insertions(+), 5 deletions(-) rename CHANGELOG.md => doc/CHANGELOG.md (100%) rename CONTRIBUTING.md => doc/CONTRIBUTING.md (100%) rename MacInstallation.md => doc/MacInstallation.md (100%) delete mode 100644 doc/README_FOR_APP rename UbuntuInstallation.md => doc/UbuntuInstallation.md (100%) rename WindowsInstallation.md => doc/WindowsInstallation.md (100%) diff --git a/README.md b/README.md index 1e23d33b..8b0a9beb 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,6 @@ Copyright (c) 2015 Connor Turland [site-beta]: http://metamaps.cc [community]: https://plus.google.com/u/0/communities/115060009262157699234 [license]: https://github.com/metamaps/metamaps_gen002/blob/master/LICENSE -[contributing]: https://github.com/metamaps/metamaps_gen002/blob/master/CONTRIBUTING.md -[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/master/CONTRIBUTING.md#reporting-bugs-and-other-issues -[windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/master/WindowsInstallation.md +[contributing]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/CONTRIBUTING.md +[contributing-issues]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/CONTRIBUTING.md#reporting-bugs-and-other-issues +[windows-installation]: https://github.com/metamaps/metamaps_gen002/blob/master/doc/WindowsInstallation.md diff --git a/CHANGELOG.md b/doc/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to doc/CHANGELOG.md diff --git a/CONTRIBUTING.md b/doc/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to doc/CONTRIBUTING.md diff --git a/MacInstallation.md b/doc/MacInstallation.md similarity index 100% rename from MacInstallation.md rename to doc/MacInstallation.md diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP deleted file mode 100644 index fe41f5cc..00000000 --- a/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/UbuntuInstallation.md b/doc/UbuntuInstallation.md similarity index 100% rename from UbuntuInstallation.md rename to doc/UbuntuInstallation.md diff --git a/WindowsInstallation.md b/doc/WindowsInstallation.md similarity index 100% rename from WindowsInstallation.md rename to doc/WindowsInstallation.md From 86c467b2f1804131e7b1285356e0066151bfe703 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 4 Nov 2015 00:14:14 -0500 Subject: [PATCH 17/37] current_user can be nil --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d275eaea..4278637f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -61,6 +61,6 @@ private unsafe_uri = request.env["REQUEST_URI"] valid_url = /^https?:\/\/([\w\.-]+)(:\d{1,5})?\/?$/ safe_uri = (unsafe_uri.match(valid_url)) ? unsafe_uri : "http://metamaps.cc/" - @invite_link = "#{safe_uri}join?code=#{current_user.code}" + @invite_link = "#{safe_uri}join" + (current_user ? "?code=#{current_user.code}" : "") end end From 7ec7f9f8929bd26e6bd77ad9ecd50951e55db6d0 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 4 Nov 2015 17:22:46 +0800 Subject: [PATCH 18/37] fix #465, metacode sort problem --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fa7876f5..3db990db 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -9,7 +9,7 @@ module ApplicationHelper @m = user.settings.metacodes set = get_metacodeset if set - @metacodes = set.metacodes + @metacodes = set.metacodes.to_a else @metacodes = Metacode.where(id: @m).to_a end From fa017a8559518e583d1b272e5f98f30fab21986d Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 6 Nov 2015 17:08:42 +0800 Subject: [PATCH 19/37] sandi metz function simplification --- app/controllers/synapses_controller.rb | 3 +- app/controllers/users_controller.rb | 2 - app/helpers/users_helper.rb | 21 ++-------- app/models/user.rb | 39 ++++++++++++------- ...151028061513_metacode_asset_path_update.rb | 3 +- 5 files changed, 30 insertions(+), 38 deletions(-) diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index dc36ff28..2c3c08d0 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -50,8 +50,7 @@ class SynapsesController < ApplicationController # DELETE synapses/:id def destroy - @current = current_user - @synapse = Synapse.find(params[:id]).authorize_to_delete(@current) + @synapse = Synapse.find(params[:id]).authorize_to_delete(current_user) @synapse.delete if @synapse respond_to do |format| diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 683e6200..bb645614 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,4 @@ class UsersController < ApplicationController - before_filter :require_user, only: [:edit, :update, :updatemetacodes] respond_to :html, :json @@ -14,7 +13,6 @@ class UsersController < ApplicationController # GET /users/:id/edit def edit @user = current_user - respond_with(@user) end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 977e5709..3c08494e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,22 +1,9 @@ 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 end - end diff --git a/app/models/user.rb b/app/models/user.rb index f6b0d65a..a0966405 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,6 +40,7 @@ class User < ActiveRecord::Base # Validate the attached image is image/jpg, image/png, etc validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ + # override default as_json def as_json(options={}) { :id => self.id, :name => self.name, @@ -47,27 +48,36 @@ class User < ActiveRecord::Base :admin => self.admin } end + + def as_json_for_autocomplete + 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" + end + #generate a random 8 letter/digit code that they can use to invite people def generate_code - #generate a random 8 letter/digit code that they can use to invite people self.code = rand(36**8).to_s(36) - $codes.push(self.code) - self.generation = self.get_generation end def get_generation - if self.joinedwithcode == self.code - # if your joinedwithcode equals your code you must be GEN 0 - gen = 0 - elsif self.generation - # if your generation has already been calculated then just return that value - gen = self.generation + calculate_generation() if generation.nil? + generation + end + + def calculate_generation + if code == joinedwithcode + update(generation: 0) else - # if your generation hasn't been calculated, base it off the - # generation of the person whose code you joined with + 1 - gen = User.find_by_code(self.joinedwithcode).get_generation + 1 + update(generation: User.find_by_code(joinedwithcode) + 1 end end @@ -75,13 +85,12 @@ class User < ActiveRecord::Base # make sure we always return a UserPreference instance if read_attribute(:settings).nil? write_attribute :settings, UserPreference.new - read_attribute :settings - else - read_attribute :settings end + read_attribute :settings end def settings=(val) write_attribute :settings, val end + end diff --git a/db/migrate/20151028061513_metacode_asset_path_update.rb b/db/migrate/20151028061513_metacode_asset_path_update.rb index 062e9d7e..be3607d1 100644 --- a/db/migrate/20151028061513_metacode_asset_path_update.rb +++ b/db/migrate/20151028061513_metacode_asset_path_update.rb @@ -2,8 +2,7 @@ class MetacodeAssetPathUpdate < ActiveRecord::Migration def change Metacode.all.each do |metacode| if metacode.icon.start_with?("/assets/icons/") - metacode.icon = metacode.icon.gsub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes") - metacode.save + metacode.update(icon: metacode.icon.gsub(/^\/assets\/icons/, "https://s3.amazonaws.com/metamaps-assets/metacodes")) end end end From 1bbaa47b8031cd0e8036a2b1d5999d8a71fcd1d6 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 4 Nov 2015 17:52:58 -0500 Subject: [PATCH 20/37] getting uploads working followed what it said to do here: http://stackoverflow.com/questions/28374401/nameerror-uninitialized-constant-paperclipstorages3aws --- Gemfile | 2 +- Gemfile.lock | 18 +++++++++--------- config/routes.rb | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index b1333275..ed6a6863 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'uservoice-ruby' gem 'dotenv' gem 'paperclip' -gem 'aws-sdk' +gem 'aws-sdk', '< 2.0' gem 'jquery-rails' gem 'jquery-ui-rails' diff --git a/Gemfile.lock b/Gemfile.lock index f5fa5a3f..b9ba0c6b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,12 +37,11 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) - aws-sdk (2.1.19) - aws-sdk-resources (= 2.1.19) - aws-sdk-core (2.1.19) - jmespath (~> 1.0) - aws-sdk-resources (2.1.19) - aws-sdk-core (= 2.1.19) + aws-sdk (1.66.0) + aws-sdk-v1 (= 1.66.0) + aws-sdk-v1 (1.66.0) + json (~> 1.4) + nokogiri (>= 1.4.4) bcrypt (3.1.10) best_in_place (3.0.3) actionpack (>= 3.2) @@ -92,8 +91,6 @@ GEM jbuilder (2.3.1) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - jmespath (1.0.2) - multi_json (~> 1.0) jquery-rails (4.0.5) rails-dom-testing (~> 1.0) railties (>= 4.2.0) @@ -207,7 +204,7 @@ PLATFORMS ruby DEPENDENCIES - aws-sdk + aws-sdk (< 2.0) best_in_place better_errors binding_of_caller @@ -234,3 +231,6 @@ DEPENDENCIES sass-rails uglifier uservoice-ruby + +BUNDLED WITH + 1.10.6 diff --git a/config/routes.rb b/config/routes.rb index e80b837a..a3ab6e3a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,7 +26,7 @@ Metamaps::Application.routes.draw do get 'explore/mapper/:id', to: 'maps#index', as: :usermaps resources :maps, except: [:new, :edit] get 'maps/:id/contains', to: 'maps#contains', as: :contains - get 'maps/:id/upload_screenshot', to: 'maps#screenshot', as: :screenshot + post 'maps/:id/upload_screenshot', to: 'maps#screenshot', as: :screenshot devise_for :users, controllers: { registrations: 'users/registrations', passwords: 'users/passwords', sessions: 'devise/sessions' }, :skip => :sessions From e29ab4bca3a9011cdebb0ff3ac6fb7a488c8be3b Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 4 Nov 2015 18:09:12 -0500 Subject: [PATCH 21/37] had to update because jquery ui version changed --- app/assets/javascripts/src/Metamaps.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/src/Metamaps.js.erb b/app/assets/javascripts/src/Metamaps.js.erb index 84fd38bc..d15172c9 100644 --- a/app/assets/javascripts/src/Metamaps.js.erb +++ b/app/assets/javascripts/src/Metamaps.js.erb @@ -656,7 +656,7 @@ Metamaps.Create = { self.newSelectedMetacodeNames = self.selectedMetacodeNames.slice(0); self.newSelectedMetacodes = self.selectedMetacodes.slice(0); } - $('#metacodeSwitchTabs').tabs("select", self.selectedMetacodeSetIndex); + $('#metacodeSwitchTabs').tabs("option", "active", self.selectedMetacodeSetIndex); $('#topic_name').focus(); }, newTopic: { From 3216106660dd7e5f02eda8869d6ee003c5f18b38 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 4 Nov 2015 18:09:44 -0500 Subject: [PATCH 22/37] styling of the vertical tab selectors needed improvement --- app/assets/stylesheets/application.css.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index b671dd80..6c036de1 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -2146,6 +2146,7 @@ and it won't be important on password protected instances */ display: block; width: 100%; padding: 4px 0 !important; + outline: none; } .ui-tabs-vertical .ui-tabs-panel { padding: 0 !important; @@ -2182,6 +2183,7 @@ and it won't be important on password protected instances */ } #metacodeSwitchTabs li.ui-state-active a { color: #00BCD4; + cursor: pointer; } .metacodeSwitchTab { max-height: 300px; From 03ab04050d074f018e5b0f0930de1fd6dae3ae75 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 4 Nov 2015 18:10:20 -0500 Subject: [PATCH 23/37] switching metacode sets was being caught by Metamaps.Router.intercept --- app/views/shared/_switchmetacodes.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/shared/_switchmetacodes.html.erb b/app/views/shared/_switchmetacodes.html.erb index 067d4d6b..e0fcd036 100644 --- a/app/views/shared/_switchmetacodes.html.erb +++ b/app/views/shared/_switchmetacodes.html.erb @@ -19,9 +19,9 @@
<% allMetacodeSets.each_with_index do |m, localindex| %>
Date: Wed, 4 Nov 2015 19:50:32 -0500 Subject: [PATCH 24/37] fix cannot set readonly property highlight --- app/assets/javascripts/src/Metamaps.GlobalUI.js.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb index 5c575e88..0290fee1 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb @@ -459,7 +459,7 @@ Metamaps.GlobalUI.Search = { $('.sidebarSearch .twitter-typeahead, .sidebarSearch .tt-hint, .sidebarSearchField').animate({ width: '0' }, 300, function () { - $('.sidebarSearchField').typeahead('setQuery', ''); + $('.sidebarSearchField').typeahead('val', ''); $('.sidebarSearchField').blur(); self.changing = false; self.isOpen = false; @@ -635,7 +635,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); From fe0d38ec675fac26e9bfc728823f05336891be80 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 7 Nov 2015 01:34:08 +0800 Subject: [PATCH 25/37] syntax error --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index a0966405..cb06f646 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -77,7 +77,7 @@ class User < ActiveRecord::Base if code == joinedwithcode update(generation: 0) else - update(generation: User.find_by_code(joinedwithcode) + 1 + update(generation: User.find_by_code(joinedwithcode) + 1) end end From 7136f46ec39d4cbff662957ee1f5e04fa587bf7b Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 8 Nov 2015 22:53:34 +0800 Subject: [PATCH 26/37] get autocomplete working again with new typeahead.js, but not the CSS --- .../javascripts/src/Metamaps.GlobalUI.js.erb | 160 ++++++++++-------- 1 file changed, 87 insertions(+), 73 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb index 0290fee1..1e48af33 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb @@ -477,95 +477,109 @@ Metamaps.GlobalUI.Search = { var topics = { name: 'topics', limit: 9999, - dupChecker: function (datum1, datum2) { - return false; - }, - template: $('#topicSearchTemplate').html(), - remote: { - url: '/search/topics?term=%QUERY', - replace: function () { - var q = '/search/topics?term=' + $('.sidebarSearchField').val(); - if (Metamaps.Active.Mapper && $("#limitTopicsToMe").is(':checked')) { - q += "&user=" + Metamaps.Active.Mapper.id.toString(); - } - return q; + + display: function(s) { return s.label; }, + templates: { + notFound: function(s) { + return Hogan.compile($('#topicSearchTemplate').html()).render({ + value: "No results", + label: "No results", + typeImageURL: "<%= asset_path('icons/wildcard.png') %>", + rtype: "noresult" + }); + }, + header: topicheader, + suggestion: function(s) { + return Hogan.compile($('#topicSearchTemplate').html()).render(s); }, - filter: function (dataset) { - if (dataset.length == 0) { - dataset.push({ - value: "No results", - label: "No results", - typeImageURL: "<%= asset_path('icons/wildcard.png') %>", - rtype: "noresult" - }); - } - return dataset; - } }, - engine: Hogan, - header: topicheader + source: new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: { + url: '/search/topics', + prepare: function(query, settings) { + settings.url += '?term=' + $('.sidebarSearchField').val(); + 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=' + $('.sidebarSearchField').val(); + if (Metamaps.Active.Mapper && $("#limitMapsToMe").is(':checked')) { + settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); + } + return settings; + }, + }, + }), }; var mappers = { name: 'mappers', limit: 9999, - dupChecker: function (datum1, datum2) { - return false; + display: function(s) { return s.label; }, + templates: { + notFound: function(s) { + return Hogan.compile($('#mapperSearchTemplate').html()).render({ + value: "No results", + label: "No results", + rtype: "noresult", + profile: "<%= asset_path('user.png') %>", + }); + }, + header: mapperheader, + suggestion: function(s) { + return Hogan.compile($('#mapperSearchTemplate').html()).render(s); + }, }, - template: $('#mapperSearchTemplate').html(), - remote: { - url: '/search/mappers?term=%QUERY', - filter: function (dataset) { - if (dataset.length == 0) { - dataset.push({ - profile: "<%= asset_path('user.png') %>", - - value: "No results", - label: "No results", - rtype: "noresult" - }); - } - return dataset; - } - }, - engine: Hogan, - header: mapperheader + source: new Bloodhound({ + datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), + queryTokenizer: Bloodhound.tokenizers.whitespace, + remote: { + url: '/search/maps?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(); } From 1f82238362dbb94a6ccda57cff9d5129a2462aa2 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 8 Nov 2015 23:14:53 +0800 Subject: [PATCH 27/37] more fixes --- .../javascripts/src/Metamaps.GlobalUI.js.erb | 6 +++--- app/controllers/main_controller.rb | 14 +++----------- app/helpers/maps_helper.rb | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb index 1e48af33..2e17ffae 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js.erb @@ -499,7 +499,7 @@ Metamaps.GlobalUI.Search = { remote: { url: '/search/topics', prepare: function(query, settings) { - settings.url += '?term=' + $('.sidebarSearchField').val(); + settings.url += '?term=' + query; if (Metamaps.Active.Mapper && $("#limitTopicsToMe").is(':checked')) { settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); } @@ -532,7 +532,7 @@ Metamaps.GlobalUI.Search = { remote: { url: '/search/maps', prepare: function(query, settings) { - settings.url += '?term=' + $('.sidebarSearchField').val(); + settings.url += '?term=' + query; if (Metamaps.Active.Mapper && $("#limitMapsToMe").is(':checked')) { settings.url += "&user=" + Metamaps.Active.Mapper.id.toString(); } @@ -564,7 +564,7 @@ Metamaps.GlobalUI.Search = { datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { - url: '/search/maps?term=%QUERY', + url: '/search/mappers?term=%QUERY', wildcard: '%QUERY', }, }), diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index c5535276..1cd0f577 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -26,8 +26,6 @@ class MainController < ApplicationController # get /search/topics?term=SOMETERM def searchtopics - @current = current_user - term = params[:term] user = params[:user] ? params[:user] : false @@ -122,15 +120,13 @@ class MainController < ApplicationController end #read this next line as 'delete a topic if its private and you're either 1. logged out or 2. logged in but not the topic creator - @topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && @current.id != t.user_id)) } + @topics.to_a.delete_if {|t| t.permission == "private" && (!authenticated? || (authenticated? && current_user.id != t.user_id)) } render json: autocomplete_array_json(@topics) end # get /search/maps?term=SOMETERM def searchmaps - @current = current_user - term = params[:term] user = params[:user] ? params[:user] : nil @@ -158,15 +154,13 @@ class MainController < ApplicationController end #read this next line as 'delete a map if its private and you're either 1. logged out or 2. logged in but not the map creator - @maps.to_a.delete_if {|m| m.permission == "private" && (!authenticated? || (authenticated? && @current.id != m.user_id)) } + @maps.to_a.delete_if {|m| m.permission == "private" && (!authenticated? || (authenticated? && current_user.id != m.user_id)) } render json: autocomplete_map_array_json(@maps) end # get /search/mappers?term=SOMETERM def searchmappers - @current = current_user - term = params[:term] if term && !term.empty? && term.downcase[0..3] != "map:" && term.downcase[0..5] != "topic:" && term.downcase != "mapper:" @@ -182,8 +176,6 @@ class MainController < ApplicationController # get /search/synapses?term=SOMETERM OR # get /search/synapses?topic1id=SOMEID&topic2id=SOMEID def searchsynapses - @current = current_user - term = params[:term] topic1id = params[:topic1id] topic2id = params[:topic2id] @@ -214,7 +206,7 @@ class MainController < ApplicationController #permissions @synapses.delete_if {|s| s.permission == "private" && !authenticated? } - @synapses.delete_if {|s| s.permission == "private" && authenticated? && @current.id != s.user_id } + @synapses.delete_if {|s| s.permission == "private" && authenticated? && current_user.id != s.user_id } else @synapses = [] end diff --git a/app/helpers/maps_helper.rb b/app/helpers/maps_helper.rb index 6b3dd7b0..169ee4b9 100644 --- a/app/helpers/maps_helper.rb +++ b/app/helpers/maps_helper.rb @@ -16,7 +16,7 @@ module MapsHelper map['rtype'] = "map" contributorTip = '' - firstContributorImage = asset_path('user.png') + firstContributorImage = 'https://s3.amazonaws.com/metamaps-assets/site/user.png' if m.contributors.count > 0 firstContributorImage = m.contributors[0].image.url(:thirtytwo) m.contributors.each_with_index do |c, index| From f58412b715e0a467979ab54798ca3ad9e26eefcc Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Fri, 20 Nov 2015 14:34:05 +0800 Subject: [PATCH 28/37] Update windows installer docs --- README.md | 3 ++- WindowsInstallation.md | 16 ++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1e23d33b..9d3bfc90 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,8 @@ OR create a new account at `/join`, and use access code `qwertyui` Start mapping and programming! -While we are still figuring out vagrant for Windows, there is an older set of instructions below +We haven't figured out Vagrant for Windows yet, but we have a set of manual instructions here: + - [For Windows][windows-installation] ## Contributing diff --git a/WindowsInstallation.md b/WindowsInstallation.md index 42364b44..fed11893 100644 --- a/WindowsInstallation.md +++ b/WindowsInstallation.md @@ -1,17 +1,13 @@ -First off, Metamaps runs on Ruby On Rails. Ruby 2.1.3 and Rails 3.2. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/ +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. -You'll also need GIT: http://git-scm.com/download/win +First, http://railsinstaller.org/en. This will install Ruby, Rails, and Git for you. -It uses postgreSQL 9.2 as a database. You can install that for your computer from here: http://www.enterprisedb.com/products-services-training/pgdownload . During installation you can choose whatever database password you like. Make sure to note it down! +Once you've done that, you will need to download PostgreSQL and node.js: -Once you install those, open a 'command prompt with ruby'. + - http://nodejs.org/en/download/ + - http://www.postgresql.org/download/windows/ -to install rails - gem install rails -v 3.2 - -also download node.js, which is also needed http://nodejs.org/download/ - -Navigate to the folder that you want to download the metamaps files to and run the following: (use your forked git repository address if it's different than this repo. You will also need to go to your Github account settings and add the SSH key that was placed in your clipboard earlier) +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 From d3d0c97e7e91076d5000b114365a95fd2eb86b18 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 23 Nov 2015 18:08:27 +0800 Subject: [PATCH 29/37] add .ruby-gemset file - you may need to reinstall gems if using rvm --- .ruby-gemset | 1 + .ruby-version | 2 +- Gemfile.lock | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) create mode 100644 .ruby-gemset diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..f4597680 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +metamaps_gen002 diff --git a/.ruby-version b/.ruby-version index ac2cdeba..378bc559 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.3 +ruby-2.1.3 diff --git a/Gemfile.lock b/Gemfile.lock index b9ba0c6b..385001fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -231,6 +231,3 @@ DEPENDENCIES sass-rails uglifier uservoice-ruby - -BUNDLED WITH - 1.10.6 From 45e09a27bd9078adecb0cf4b36fad062dd7008aa Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 25 Nov 2015 11:59:56 +0800 Subject: [PATCH 30/37] gc tuning --- .example-env | 13 +++++++++++++ Gemfile | 1 + Gemfile.lock | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/.example-env b/.example-env index 3e8752fb..c8fb94af 100644 --- a/.example-env +++ b/.example-env @@ -16,3 +16,16 @@ SSO_KEY # for a uniq ordered list of env vars: ## grep -rIsoh -P "(?<=ENV)(\.fetch\(|\[).[A-Z_]+.(\)|\])" | grep -oP "[A-Z_]+" | sort -u > temp +RUBY_GC_TUNE=0 #set to 1 to enable GC test +RUBY_GC_TOKEN=4f4380fc9a2857d1f008005a3eb86928 +RUBY_GC_HEAP_INIT_SLOTS=186426 +RUBY_GC_HEAP_FREE_SLOTS=559278 +RUBY_GC_HEAP_GROWTH_FACTOR=1.03 +RUBY_GC_HEAP_GROWTH_MAX_SLOTS=74570 +RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.4 +RUBY_GC_MALLOC_LIMIT=32883406 +RUBY_GC_MALLOC_LIMIT_MAX=69055153 +RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.68 +RUBY_GC_OLDMALLOC_LIMIT=32509481 +RUBY_GC_OLDMALLOC_LIMIT_MAX=68269910 +RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=1.4 diff --git a/Gemfile b/Gemfile index ed6a6863..d54d13d2 100644 --- a/Gemfile +++ b/Gemfile @@ -49,4 +49,5 @@ group :development, :test do gem 'better_errors' gem 'binding_of_caller' gem 'quiet_assets' + gem 'tunemygc' end diff --git a/Gemfile.lock b/Gemfile.lock index 385001fc..f1c8c7c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -188,6 +188,7 @@ GEM thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1) + tunemygc (1.0.61) tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (2.7.2) @@ -229,5 +230,9 @@ DEPENDENCIES rails_12factor redis sass-rails + tunemygc uglifier uservoice-ruby + +BUNDLED WITH + 1.10.6 From 98e11c0a7d61e03a82c6df7c8a5b1d3171529b0a Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 28 Nov 2015 20:17:14 +0800 Subject: [PATCH 31/37] split search css out into its own file --- app/assets/stylesheets/clean.css.erb | 464 ------------------------- app/assets/stylesheets/search.scss.erb | 459 ++++++++++++++++++++++++ 2 files changed, 459 insertions(+), 464 deletions(-) create mode 100644 app/assets/stylesheets/search.scss.erb diff --git a/app/assets/stylesheets/clean.css.erb b/app/assets/stylesheets/clean.css.erb index 94164b6b..8c3bd7dd 100644 --- a/app/assets/stylesheets/clean.css.erb +++ b/app/assets/stylesheets/clean.css.erb @@ -150,470 +150,6 @@ height: 32px; } -/* search */ - -.sidebarSearch { - float:left; - height: 32px; - position: relative; -} - -#searchLoading { - height: 24px; - width: 24px; - position: absolute; - top: 4px; - right: 76px; - display: none; -} - -.unauthenticated .homePage .sidebarSearchIcon { - border-radius: 2px; -} -.sidebarSearchIcon { - float: left; - width: 72px; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; - height: 32px; - background: #4fb5c0 url(<%= asset_data_uri('search.png') %>) no-repeat center center; - background-size: 32px 32px; - cursor: pointer; -} -.sidebarSearch .twitter-typeahead, .sidebarSearch .sidebarSearchField { - float: left; -} - -.unauthenticated .homePage .sidebarSearchField, -.unauthenticated .homePage .sidebarSearch .tt-hint { - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; -} -.explorePage .sidebarSearchField, -.explorePage .sidebarSearch .tt-hint { - width: 380px; - padding: 5px 10px 5px 10px; -} - -.sidebarSearchField { - color: #424242; -} -.sidebarSearch .tt-hint { - color: transparent; -} -.sidebarSearchField, -.sidebarSearch .tt-hint { - height: 20px; - border-top: 1px solid #BDBDBD; - border-bottom: 1px solid #BDBDBD; - border-left: none; - border-right: none; - padding: 5px 0 5px 0; - width: 0px; - margin: 0; - outline: none; - font-size: 14px; - line-height: 14px; - background: #F5F5F5; - font-family: 'din-medium', helvetica, sans-serif; -} -.sidebarSearch .tt-dropdown-menu { - top: 40px !important; - background: #F5F5F5; - width: 472px; - overflow-y: auto; - overflow-x: visible; - box-shadow: 0 10px 10px rgba(0,0,0,0.19), 0 6px 3px rgba(0,0,0,0.23); -} - -.autoOptions #mapContribs { - width: 15px; - height: 15px; - border: 1px solid #424242; - margin-top: 4px; - margin-left: 4px; -} - -.mapContributorsIcon span { - margin-left: 5px; -} - -.mapContributorsIcon li span { - margin-left: 10px; -} - - -.searchHeader { - height: 42px; - width: 100%; - position: relative; -} -.searchTopicsHeader { - background: #4fc4a8; -} -.searchMapsHeader { - background: #994fc0; -} -.searchMappersHeader { - background: #c04f4f; -} -.sidebarSearch .tt-dropdown-menu h3 { - text-transform: uppercase; - color: #F5F5F5; - font-size: 18px; - line-height: 18px; - margin: 12px 0 3px 16px; - float: left; -} -.sidebarSearch .tt-dropdown-menu .limitToMe { - float: left; - width: 12px; - height: 12px; - border: 1px; - color: #000000; - position: absolute; - top: 15px; - left: 136px; -} -.sidebarSearch .tt-dropdown-menu .limitToMeLabel { - float: left; - font-family: 'din-medium', helvetica, sans-serif; - font-size: 12px; - color: #f5f5f5; - margin: 0; - position: absolute; - top: 15px; - left: 156px; -} -.sidebarSearch .tt-dropdown-menu .minimizeResults, .sidebarSearch .tt-dropdown-menu .maximizeResults { - width: 32px; - height: 32px; - background-image: url(<%= asset_data_uri('arrowpermswhite_sprite.png') %>); - background-repeat: no-repeat; - cursor: pointer; - position: absolute; - top: 5px; - left: 410px; -} -.sidebarSearch .tt-dropdown-menu .minimizeResults { - background-position: 0 0; -} -.sidebarSearch .tt-dropdown-menu .maximizeResults { - background-position: -32px 0; -} -.sidebarSearch .tt-dataset { - overflow: visible; -} -.sidebarSearch .tt-suggestion { - position: relative; - background: #FFF; - padding: 8px 0; -} -.sidebarSearch .tt-is-under-cursor, -.sidebarSearch .tt-suggestion:hover { - background: #E0E0E0; -} - -.resultmap, .resulttopic, .resultmapper, .resultnoresult { - min-height: 48px; - display: table; -} -/*.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap, -.sidebarSearch .tt-dataset-maps .tt-is-under-mouse-cursor .resultmap, -.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic, -.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .resulttopic { - min-height: 48px; -}*/ -.sidebarSearch .tt-suggestion .searchResIconWrapper { - display: table-cell; - vertical-align: middle; - height: 32px; - padding: 0 18px 0 28px; -} -.sidebarSearch .tt-suggestion .icon { - width: 32px; - height: 32px; - border-radius:16px; -} -.sidebarSearch .topicMetacode { - display: table-cell; - vertical-align: middle; - padding: 0 0 0 8px; - width: 70px; -} -.sidebarSearch .tt-dataset-topics .topicIcon { - width: 32px; - height: 32px; - margin: 0 auto; -} -.sidebarSearch .tt-dataset-topics .metacodeTip { - display: none; - margin: 0 auto; -} -.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .metacodeTip, -.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .metacodeTip { - display: block; - font-family: 'vinyl'; - text-transform: uppercase; - font-style: italic; - font-size: 13px; - margin: 0 5px 0 2px; - text-align: center; -} -.sidebarSearch .tt-dataset-mappers .tt-suggestion .icon { - margin: 0px 0px 0px 0px; -} -.sidebarSearch .tt-dataset-mappers .resultText { - width: 150px; -} - -.sidebarSearch .resultText { - width: 260px; - display: table-cell; - padding-left: 8px; - vertical-align: middle; - word-wrap: break-word; -} -.sidebarSearch .resultTitle { - font-weight: normal; - font-size: 16px; - line-height: 20px; - width: 100%; - font-family: 'din-regular', helvetica, sans-serif; -} -.sidebarSearch .resultDesc { - font-size: 12px; - line-height: 16px; - width: 100%; - font-style: italic; - font-family: helvetica, sans-serif; -} -.sidebarSearch .tip { - display: none; -} -.sidebarSearch div.autoOptions { - width: 114px; - height: 48px; - position: absolute; - display: none; - top: 8px; - right: 0; -} -.tt-dataset-maps div.autoOptions { - width: 84px; -} -.sidebarSearch .tt-dataset-mappers .autoOptions { - width: 235px; -} -.sidebarSearch .tt-is-under-cursor .autoOptions, -.sidebarSearch .tt-is-under-mouse-cursor .autoOptions { - display: block; -} -.sidebarSearch .tt-suggestion .resultnoresult .autoOptions { - display: none; -} -.sidebarSearch .autoOptions button, -.sidebarSearch .autoOptions a, -.sidebarSearch .autoOptions div { - position: absolute; - padding: 0; - margin: 0; - border: none; - outline: none; -} -.sidebarSearch button.addToMap { - display:none; - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('addtopic_sprite.png') %>); - background-repeat: no-repeat; - background-size: 48px 24px; - top: 12px; - left: 80px; - cursor: pointer; -} -.canEditMap button.addToMap { - display: block; -} -.sidebarSearch button.addToMap:hover { - background-position: -24px; -} - -.sidebarSearch div.topicCount { - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('topic16.png') %>); - background-repeat: no-repeat; - background-position: 0 center; - top: 0; - left: 0; - padding-left: 18px; - font-size: 12px; - line-height: 24px; -} - -.sidebarSearch div.mapCount { - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('metamap16.png') %>); - background-repeat: no-repeat; - background-position: 0 center; - left: 0; - padding-left: 20px; - font-size: 12px; - line-height: 24px; -} -.sidebarSearch div.synapseCount { - width: 24px; - height: 24px; - background: url(<%= asset_data_uri('synapse16.png') %>); - background-repeat: no-repeat; - background-position: 0 center; - top: 24px; - left: 0; - padding-left: 20px; - font-size: 12px; - line-height: 24px; -} -.sidebarSearch div.topicOriginatorIcon { - width: 18px; - height: 18px; - padding: 3px; - top: 0; - left: 44px; -} -.sidebarSearch .topicOriginatorIcon img { - border-radius: 9px; -} - -.sidebarSearch .topicOriginatorIcon .tip { - right: 30px; - top: 1px; -} -.sidebarSearch .tip { - position: absolute; - background: #424242; - width: auto; - top: 2px; - right: 25px; - color: white; - white-space: nowrap; - border-radius: 2px; - font-size: 12px !important; - font-family: 'din-regular'; - line-height: 12px; - padding: 4px 4px 4px; - z-index: 100; -} -.sidebarSearch .hoverForTip:hover .tip { - display: block; -} - -.sidebarSearch .mapContributorsIcon .tip { - right: 40px; - top: -5px; - padding-top: 5px; - padding-bottom: 5px; -} - -.sidebarSearch .hoverForTip .tip li { - padding-left: 28px; - padding-top: 4px; -} - -.tipUserImage { - position: absolute; - top: 0px; - left: 7px; - border-radius: 14px; -} - -.sidebarSearch .hoverForTip .tip:before { - content: ''; - position: absolute; - width: 0; - height: 0; - border-left: 4px solid #424242; - border-top: 5px solid transparent; - border-bottom: 5px solid transparent; -} - -.sidebarSearch .hoverForTip.addToMap .tip { - right: 30px; -} -.sidebarSearch .hoverForTip.addToMap .tip:before { - right: -4px; -} - -.sidebarSearch .mapContributorsIcon .tip:before { - top: 12px; - right: -4px; -} - -.sidebarSearch .topicOriginatorIcon .tip:before { - top: 5px; - right: -4px; -} - -.sidebarSearch .mapContributorsIcon .mapContributors { - top: auto; - right: 0; - bottom: 21px; - white-space: normal; - width: 200px; -} -.sidebarSearch div.mapContributorsIcon { - height: 24px; - top: 0; - left: 44px; - font-size: 12px; - line-height: 24px; -} -.sidebarSearch div.topicPermission, -.sidebarSearch div.mapPermission { - width: 24px; - height: 24px; - background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>); - background-repeat: no-repeat; - background-size: 72px 48px !important; - top: 24px; - left: 44px; -} -.sidebarSearch div.topicPermission.commons, -.sidebarSearch div.mapPermission.commons { - background-position: 0 0; -} -.sidebarSearch div.topicPermission.public, -.sidebarSearch div.mapPermission.public { - background-position: -48px 0; -} -.sidebarSearch div.topicPermission.private, -.sidebarSearch div.mapPermission.private { - background-position: -24px 0; -} - -.sidebarSearch .tt-dataset-mappers div.mapCount { - top: 8px; - left: 170px; -} -.sidebarSearch .tt-dataset-mappers div.mapperCreated { - left: 0px; - padding-left: 0px; - font-size: 12px; - font-family: 'din-medium', helvetica, sans-serif; - line-height: 24px; -} -.sidebarSearch .tt-dataset-mappers div.mapperGeneration { - top: 20px; - left: 0px; - padding-left: 0px; - font-size: 12px; - font-family: 'din-medium', helvetica, sans-serif; - line-height: 24px; -} - -/* end search */ - /* end upperLeftUI */ /* upperRightUI */ diff --git a/app/assets/stylesheets/search.scss.erb b/app/assets/stylesheets/search.scss.erb new file mode 100644 index 00000000..5d56d120 --- /dev/null +++ b/app/assets/stylesheets/search.scss.erb @@ -0,0 +1,459 @@ +.sidebarSearch { + float:left; + height: 32px; + position: relative; +} + +#searchLoading { + height: 24px; + width: 24px; + position: absolute; + top: 4px; + right: 76px; + display: none; +} + +.unauthenticated .homePage .sidebarSearchIcon { + border-radius: 2px; +} +.sidebarSearchIcon { + float: left; + width: 72px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; + height: 32px; + background: #4fb5c0 url(<%= asset_data_uri('search.png') %>) no-repeat center center; + background-size: 32px 32px; + cursor: pointer; +} +.sidebarSearch .twitter-typeahead, .sidebarSearch .sidebarSearchField { + float: left; +} + +.unauthenticated .homePage .sidebarSearchField, +.unauthenticated .homePage .sidebarSearch .tt-hint { + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; +} +.explorePage .sidebarSearchField, +.explorePage .sidebarSearch .tt-hint { + width: 380px; + padding: 5px 10px 5px 10px; +} + +.sidebarSearchField { + color: #424242; +} +.sidebarSearch .tt-hint { + color: transparent; +} +.sidebarSearchField, +.sidebarSearch .tt-hint { + height: 20px; + border-top: 1px solid #BDBDBD; + border-bottom: 1px solid #BDBDBD; + border-left: none; + border-right: none; + padding: 5px 0 5px 0; + width: 0px; + margin: 0; + outline: none; + font-size: 14px; + line-height: 14px; + background: #F5F5F5; + font-family: 'din-medium', helvetica, sans-serif; +} +.sidebarSearch .tt-dropdown-menu { + top: 40px !important; + background: #F5F5F5; + width: 472px; + overflow-y: auto; + overflow-x: visible; + box-shadow: 0 10px 10px rgba(0,0,0,0.19), 0 6px 3px rgba(0,0,0,0.23); +} + +.autoOptions #mapContribs { + width: 15px; + height: 15px; + border: 1px solid #424242; + margin-top: 4px; + margin-left: 4px; +} + +.mapContributorsIcon span { + margin-left: 5px; +} + +.mapContributorsIcon li span { + margin-left: 10px; +} + + +.searchHeader { + height: 42px; + width: 100%; + position: relative; +} +.searchTopicsHeader { + background: #4fc4a8; +} +.searchMapsHeader { + background: #994fc0; +} +.searchMappersHeader { + background: #c04f4f; +} +.sidebarSearch .tt-dropdown-menu h3 { + text-transform: uppercase; + color: #F5F5F5; + font-size: 18px; + line-height: 18px; + margin: 12px 0 3px 16px; + float: left; +} +.sidebarSearch .tt-dropdown-menu .limitToMe { + float: left; + width: 12px; + height: 12px; + border: 1px; + color: #000000; + position: absolute; + top: 15px; + left: 136px; +} +.sidebarSearch .tt-dropdown-menu .limitToMeLabel { + float: left; + font-family: 'din-medium', helvetica, sans-serif; + font-size: 12px; + color: #f5f5f5; + margin: 0; + position: absolute; + top: 15px; + left: 156px; +} +.sidebarSearch .tt-dropdown-menu .minimizeResults, .sidebarSearch .tt-dropdown-menu .maximizeResults { + width: 32px; + height: 32px; + background-image: url(<%= asset_data_uri('arrowpermswhite_sprite.png') %>); + background-repeat: no-repeat; + cursor: pointer; + position: absolute; + top: 5px; + left: 410px; +} +.sidebarSearch .tt-dropdown-menu .minimizeResults { + background-position: 0 0; +} +.sidebarSearch .tt-dropdown-menu .maximizeResults { + background-position: -32px 0; +} +.sidebarSearch .tt-dataset { + overflow: visible; +} +.sidebarSearch .tt-suggestion { + position: relative; + background: #FFF; + padding: 8px 0; +} +.sidebarSearch .tt-is-under-cursor, +.sidebarSearch .tt-suggestion:hover { + background: #E0E0E0; +} + +.resultmap, .resulttopic, .resultmapper, .resultnoresult { + min-height: 48px; + display: table; +} +/*.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap, +.sidebarSearch .tt-dataset-maps .tt-is-under-mouse-cursor .resultmap, +.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic, +.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .resulttopic { + min-height: 48px; +}*/ +.sidebarSearch .tt-suggestion .searchResIconWrapper { + display: table-cell; + vertical-align: middle; + height: 32px; + padding: 0 18px 0 28px; +} +.sidebarSearch .tt-suggestion .icon { + width: 32px; + height: 32px; + border-radius:16px; +} +.sidebarSearch .topicMetacode { + display: table-cell; + vertical-align: middle; + padding: 0 0 0 8px; + width: 70px; +} +.sidebarSearch .tt-dataset-topics .topicIcon { + width: 32px; + height: 32px; + margin: 0 auto; +} +.sidebarSearch .tt-dataset-topics .metacodeTip { + display: none; + margin: 0 auto; +} +.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .metacodeTip, +.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .metacodeTip { + display: block; + font-family: 'vinyl'; + text-transform: uppercase; + font-style: italic; + font-size: 13px; + margin: 0 5px 0 2px; + text-align: center; +} +.sidebarSearch .tt-dataset-mappers .tt-suggestion .icon { + margin: 0px 0px 0px 0px; +} +.sidebarSearch .tt-dataset-mappers .resultText { + width: 150px; +} + +.sidebarSearch .resultText { + width: 260px; + display: table-cell; + padding-left: 8px; + vertical-align: middle; + word-wrap: break-word; +} +.sidebarSearch .resultTitle { + font-weight: normal; + font-size: 16px; + line-height: 20px; + width: 100%; + font-family: 'din-regular', helvetica, sans-serif; +} +.sidebarSearch .resultDesc { + font-size: 12px; + line-height: 16px; + width: 100%; + font-style: italic; + font-family: helvetica, sans-serif; +} +.sidebarSearch .tip { + display: none; +} +.sidebarSearch div.autoOptions { + width: 114px; + height: 48px; + position: absolute; + display: none; + top: 8px; + right: 0; +} +.tt-dataset-maps div.autoOptions { + width: 84px; +} +.sidebarSearch .tt-dataset-mappers .autoOptions { + width: 235px; +} +.sidebarSearch .tt-is-under-cursor .autoOptions, +.sidebarSearch .tt-is-under-mouse-cursor .autoOptions { + display: block; +} +.sidebarSearch .tt-suggestion .resultnoresult .autoOptions { + display: none; +} +.sidebarSearch .autoOptions button, +.sidebarSearch .autoOptions a, +.sidebarSearch .autoOptions div { + position: absolute; + padding: 0; + margin: 0; + border: none; + outline: none; +} +.sidebarSearch button.addToMap { + display:none; + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('addtopic_sprite.png') %>); + background-repeat: no-repeat; + background-size: 48px 24px; + top: 12px; + left: 80px; + cursor: pointer; +} +.canEditMap button.addToMap { + display: block; +} +.sidebarSearch button.addToMap:hover { + background-position: -24px; +} + +.sidebarSearch div.topicCount { + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('topic16.png') %>); + background-repeat: no-repeat; + background-position: 0 center; + top: 0; + left: 0; + padding-left: 18px; + font-size: 12px; + line-height: 24px; +} + +.sidebarSearch div.mapCount { + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('metamap16.png') %>); + background-repeat: no-repeat; + background-position: 0 center; + left: 0; + padding-left: 20px; + font-size: 12px; + line-height: 24px; +} +.sidebarSearch div.synapseCount { + width: 24px; + height: 24px; + background: url(<%= asset_data_uri('synapse16.png') %>); + background-repeat: no-repeat; + background-position: 0 center; + top: 24px; + left: 0; + padding-left: 20px; + font-size: 12px; + line-height: 24px; +} +.sidebarSearch div.topicOriginatorIcon { + width: 18px; + height: 18px; + padding: 3px; + top: 0; + left: 44px; +} +.sidebarSearch .topicOriginatorIcon img { + border-radius: 9px; +} + +.sidebarSearch .topicOriginatorIcon .tip { + right: 30px; + top: 1px; +} +.sidebarSearch .tip { + position: absolute; + background: #424242; + width: auto; + top: 2px; + right: 25px; + color: white; + white-space: nowrap; + border-radius: 2px; + font-size: 12px !important; + font-family: 'din-regular'; + line-height: 12px; + padding: 4px 4px 4px; + z-index: 100; +} +.sidebarSearch .hoverForTip:hover .tip { + display: block; +} + +.sidebarSearch .mapContributorsIcon .tip { + right: 40px; + top: -5px; + padding-top: 5px; + padding-bottom: 5px; +} + +.sidebarSearch .hoverForTip .tip li { + padding-left: 28px; + padding-top: 4px; +} + +.tipUserImage { + position: absolute; + top: 0px; + left: 7px; + border-radius: 14px; +} + +.sidebarSearch .hoverForTip .tip:before { + content: ''; + position: absolute; + width: 0; + height: 0; + border-left: 4px solid #424242; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; +} + +.sidebarSearch .hoverForTip.addToMap .tip { + right: 30px; +} +.sidebarSearch .hoverForTip.addToMap .tip:before { + right: -4px; +} + +.sidebarSearch .mapContributorsIcon .tip:before { + top: 12px; + right: -4px; +} + +.sidebarSearch .topicOriginatorIcon .tip:before { + top: 5px; + right: -4px; +} + +.sidebarSearch .mapContributorsIcon .mapContributors { + top: auto; + right: 0; + bottom: 21px; + white-space: normal; + width: 200px; +} +.sidebarSearch div.mapContributorsIcon { + height: 24px; + top: 0; + left: 44px; + font-size: 12px; + line-height: 24px; +} +.sidebarSearch div.topicPermission, +.sidebarSearch div.mapPermission { + width: 24px; + height: 24px; + background-image: url(<%= asset_data_uri('permissions32_sprite.png') %>); + background-repeat: no-repeat; + background-size: 72px 48px !important; + top: 24px; + left: 44px; +} +.sidebarSearch div.topicPermission.commons, +.sidebarSearch div.mapPermission.commons { + background-position: 0 0; +} +.sidebarSearch div.topicPermission.public, +.sidebarSearch div.mapPermission.public { + background-position: -48px 0; +} +.sidebarSearch div.topicPermission.private, +.sidebarSearch div.mapPermission.private { + background-position: -24px 0; +} + +.sidebarSearch .tt-dataset-mappers div.mapCount { + top: 8px; + left: 170px; +} +.sidebarSearch .tt-dataset-mappers div.mapperCreated { + left: 0px; + padding-left: 0px; + font-size: 12px; + font-family: 'din-medium', helvetica, sans-serif; + line-height: 24px; +} +.sidebarSearch .tt-dataset-mappers div.mapperGeneration { + top: 20px; + left: 0px; + padding-left: 0px; + font-size: 12px; + font-family: 'din-medium', helvetica, sans-serif; + line-height: 24px; +} From 9afc8bc7c46e5aee41d881402332702fb73f1616 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 28 Nov 2015 20:39:11 +0800 Subject: [PATCH 32/37] refactor search css into scss for clearer organization, plus do some fixes to the typeahead css --- app/assets/stylesheets/search.scss.erb | 676 +++++++++++++------------ 1 file changed, 361 insertions(+), 315 deletions(-) diff --git a/app/assets/stylesheets/search.scss.erb b/app/assets/stylesheets/search.scss.erb index 5d56d120..affde153 100644 --- a/app/assets/stylesheets/search.scss.erb +++ b/app/assets/stylesheets/search.scss.erb @@ -1,40 +1,24 @@ -.sidebarSearch { - float:left; - height: 32px; - position: relative; -} - #searchLoading { - height: 24px; - width: 24px; - position: absolute; - top: 4px; - right: 76px; - display: none; + height: 24px; + width: 24px; + position: absolute; + top: 4px; + right: 76px; + display: none; } -.unauthenticated .homePage .sidebarSearchIcon { +.unauthenticated { + .homePage .sidebarSearchIcon { border-radius: 2px; -} -.sidebarSearchIcon { - float: left; - width: 72px; - border-top-right-radius: 2px; - border-bottom-right-radius: 2px; - height: 32px; - background: #4fb5c0 url(<%= asset_data_uri('search.png') %>) no-repeat center center; - background-size: 32px 32px; - cursor: pointer; -} -.sidebarSearch .twitter-typeahead, .sidebarSearch .sidebarSearchField { - float: left; -} + } -.unauthenticated .homePage .sidebarSearchField, -.unauthenticated .homePage .sidebarSearch .tt-hint { + .homePage .sidebarSearchField, + .homePage .sidebarSearch .tt-hint { border-top-left-radius: 2px; border-bottom-left-radius: 2px; + } } + .explorePage .sidebarSearchField, .explorePage .sidebarSearch .tt-hint { width: 380px; @@ -42,13 +26,97 @@ } .sidebarSearchField { - color: #424242; + color: #424242; } -.sidebarSearch .tt-hint { + +.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; +} + +.canEditMap button.addToMap { + display: block; +} + +.tipUserImage { + position: absolute; + top: 0px; + left: 7px; + border-radius: 14px; +} + +.sidebarSearchField { + 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; +} + +/* main search selector */ + +.sidebarSearch { + float:left; + height: 32px; + position: relative; + + .twitter-typeahead, + .sidebarSearchField { + float: left; + } + + .tt-hint { color: transparent; -} -.sidebarSearchField, -.sidebarSearch .tt-hint { height: 20px; border-top: 1px solid #BDBDBD; border-bottom: 1px solid #BDBDBD; @@ -62,212 +130,200 @@ line-height: 14px; background: #F5F5F5; font-family: 'din-medium', helvetica, sans-serif; -} -.sidebarSearch .tt-dropdown-menu { + } + + .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; -} + h3 { + text-transform: uppercase; + color: #F5F5F5; + font-size: 18px; + line-height: 18px; + margin: 12px 0 3px 16px; + float: left; + } -.mapContributorsIcon span { - margin-left: 5px; -} + .limitToMe { + float: left; + width: 12px; + height: 12px; + border: 1px; + color: #000000; + position: absolute; + top: 15px; + left: 136px; + } -.mapContributorsIcon li span { - margin-left: 10px; -} + .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-dropdown-menu */ -.searchHeader { - height: 42px; - width: 100%; - position: relative; -} -.searchTopicsHeader { - background: #4fc4a8; -} -.searchMapsHeader { - background: #994fc0; -} -.searchMappersHeader { - background: #c04f4f; -} -.sidebarSearch .tt-dropdown-menu h3 { - text-transform: uppercase; - color: #F5F5F5; - font-size: 18px; - line-height: 18px; - margin: 12px 0 3px 16px; - float: left; -} -.sidebarSearch .tt-dropdown-menu .limitToMe { - float: left; - width: 12px; - height: 12px; - border: 1px; - color: #000000; - position: absolute; - top: 15px; - left: 136px; -} -.sidebarSearch .tt-dropdown-menu .limitToMeLabel { - float: left; - font-family: 'din-medium', helvetica, sans-serif; - font-size: 12px; - color: #f5f5f5; - margin: 0; - position: absolute; - top: 15px; - left: 156px; -} -.sidebarSearch .tt-dropdown-menu .minimizeResults, .sidebarSearch .tt-dropdown-menu .maximizeResults { - width: 32px; - height: 32px; - background-image: url(<%= asset_data_uri('arrowpermswhite_sprite.png') %>); - background-repeat: no-repeat; - cursor: pointer; - position: absolute; - top: 5px; - left: 410px; -} -.sidebarSearch .tt-dropdown-menu .minimizeResults { - background-position: 0 0; -} -.sidebarSearch .tt-dropdown-menu .maximizeResults { - background-position: -32px 0; -} -.sidebarSearch .tt-dataset { - overflow: visible; -} -.sidebarSearch .tt-suggestion { + .tt-suggestion { position: relative; background: #FFF; padding: 8px 0; -} -.sidebarSearch .tt-is-under-cursor, -.sidebarSearch .tt-suggestion:hover { - background: #E0E0E0; -} -.resultmap, .resulttopic, .resultmapper, .resultnoresult { - min-height: 48px; - display: table; -} -/*.sidebarSearch .tt-dataset-maps .tt-is-under-cursor .resultmap, -.sidebarSearch .tt-dataset-maps .tt-is-under-mouse-cursor .resultmap, -.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .resulttopic, -.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .resulttopic { - min-height: 48px; -}*/ -.sidebarSearch .tt-suggestion .searchResIconWrapper { - display: table-cell; - vertical-align: middle; - height: 32px; - padding: 0 18px 0 28px; -} -.sidebarSearch .tt-suggestion .icon { - width: 32px; - height: 32px; - border-radius:16px; -} -.sidebarSearch .topicMetacode { - display: table-cell; - vertical-align: middle; - padding: 0 0 0 8px; - width: 70px; -} -.sidebarSearch .tt-dataset-topics .topicIcon { - width: 32px; - height: 32px; - margin: 0 auto; -} -.sidebarSearch .tt-dataset-topics .metacodeTip { - display: none; - margin: 0 auto; -} -.sidebarSearch .tt-dataset-topics .tt-is-under-cursor .metacodeTip, -.sidebarSearch .tt-dataset-topics .tt-is-under-mouse-cursor .metacodeTip { - display: block; - font-family: 'vinyl'; - text-transform: uppercase; - font-style: italic; - font-size: 13px; - margin: 0 5px 0 2px; - text-align: center; -} -.sidebarSearch .tt-dataset-mappers .tt-suggestion .icon { - margin: 0px 0px 0px 0px; -} -.sidebarSearch .tt-dataset-mappers .resultText { - width: 150px; -} + &:hover { + background: #E0E0E0; + } + .searchResIconWrapper { + display: table-cell; + vertical-align: middle; + height: 32px; + padding: 0 18px 0 28px; + } + .icon { + width: 32px; + height: 32px; + border-radius:16px; + } + }/* tt-suggestion */ -.sidebarSearch .resultText { + .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 */ + + .resultText { width: 260px; display: table-cell; padding-left: 8px; vertical-align: middle; word-wrap: break-word; -} -.sidebarSearch .resultTitle { + } + .resultTitle { font-weight: normal; font-size: 16px; line-height: 20px; width: 100%; font-family: 'din-regular', helvetica, sans-serif; -} -.sidebarSearch .resultDesc { + } + .resultDesc { font-size: 12px; line-height: 16px; width: 100%; font-style: italic; font-family: helvetica, sans-serif; -} -.sidebarSearch .tip { - display: none; -} -.sidebarSearch div.autoOptions { + } + + .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 { + + a, + div, + button { + position: absolute; + padding: 0; + margin: 0; + border: none; + outline: none; + } + }/* .autoOptions */ + + .tt-cursor .autoOptions, + .tt-suggestion:hover .autoOptions { display: block; -} -.sidebarSearch .tt-suggestion .resultnoresult .autoOptions { + } + .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 { + } + + .addToMap { display:none; width: 24px; height: 24px; @@ -277,15 +333,13 @@ top: 12px; left: 80px; cursor: pointer; -} -.canEditMap button.addToMap { - display: block; -} -.sidebarSearch button.addToMap:hover { - background-position: -24px; -} -.sidebarSearch div.topicCount { + &:hover { + background-position: -24px; + } + }/* .addToMap */ + + .topicCount { width: 24px; height: 24px; background: url(<%= asset_data_uri('topic16.png') %>); @@ -296,9 +350,9 @@ padding-left: 18px; font-size: 12px; line-height: 24px; -} + } -.sidebarSearch div.mapCount { + .mapCount { width: 24px; height: 24px; background: url(<%= asset_data_uri('metamap16.png') %>); @@ -308,8 +362,9 @@ padding-left: 20px; font-size: 12px; line-height: 24px; -} -.sidebarSearch div.synapseCount { + } + + .synapseCount { width: 24px; height: 24px; background: url(<%= asset_data_uri('synapse16.png') %>); @@ -320,23 +375,17 @@ 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 { + .topicMetacode { + display: table-cell; + vertical-align: middle; + padding: 0 0 0 8px; + width: 70px; + } + + .tip { + display: none; position: absolute; background: #424242; width: auto; @@ -350,73 +399,88 @@ line-height: 12px; padding: 4px 4px 4px; z-index: 100; -} -.sidebarSearch .hoverForTip:hover .tip { - display: block; -} + } -.sidebarSearch .mapContributorsIcon .tip { + .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; -} + } -.sidebarSearch .hoverForTip .tip li { - padding-left: 28px; - padding-top: 4px; -} + .hoverForTip{ + &:hover .tip { + display: block; + } -.tipUserImage { - position: absolute; - top: 0px; - left: 7px; - border-radius: 14px; -} + .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 */ -.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 { + .mapContributorsIcon { height: 24px; top: 0; left: 44px; font-size: 12px; line-height: 24px; -} -.sidebarSearch div.topicPermission, -.sidebarSearch div.mapPermission { + + .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') %>); @@ -424,36 +488,18 @@ 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; -} + .commons, + .commons { + background-position: 0 0; + } + .public, + .public { + background-position: -48px 0; + } + .private, + .private { + background-position: -24px 0; + } + }/* .topicPermission, .mapPermission */ +}/* .sidebarSearch */ From 3aaf501b0323cc60cb6ee86bc8bc41af06d754bd Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 28 Nov 2015 21:51:28 +0800 Subject: [PATCH 33/37] fix up user model json output function --- app/models/user.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index cb06f646..16b31872 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -50,15 +50,16 @@ class User < ActiveRecord::Base end def as_json_for_autocomplete - 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" + 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 From 6b6ad1b6602534e9a847733fed03c9e7a0be2234 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 28 Nov 2015 22:07:57 +0800 Subject: [PATCH 34/37] fix error with mapper search rendering --- app/helpers/users_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 3c08494e..69335da1 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -5,5 +5,6 @@ module UsersHelper users.each do |user| json_users.push user.as_json_for_autocomplete end + json_users end end From 8505d26182155493fac76564e5c0eb3cbc2b49f6 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 28 Nov 2015 22:50:32 +0800 Subject: [PATCH 35/37] search box css fixes --- app/assets/stylesheets/search.scss.erb | 111 ++++++++++++------------- 1 file changed, 52 insertions(+), 59 deletions(-) diff --git a/app/assets/stylesheets/search.scss.erb b/app/assets/stylesheets/search.scss.erb index affde153..607a561f 100644 --- a/app/assets/stylesheets/search.scss.erb +++ b/app/assets/stylesheets/search.scss.erb @@ -25,10 +25,6 @@ padding: 5px 10px 5px 10px; } -.sidebarSearchField { - color: #424242; -} - .sidebarSearchIcon { float: left; width: 72px; @@ -74,6 +70,7 @@ .resultmap, .resulttopic, .resultmapper, .resultnoresult { min-height: 48px; display: table; + width: 100%; } .canEditMap button.addToMap { @@ -87,22 +84,6 @@ border-radius: 14px; } -.sidebarSearchField { - 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; -} - /* main search selector */ .sidebarSearch { @@ -110,9 +91,26 @@ height: 32px; position: relative; - .twitter-typeahead, + .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 { @@ -132,7 +130,7 @@ font-family: 'din-medium', helvetica, sans-serif; } - .tt-dropdown-menu { + .tt-menu { top: 40px !important; background: #F5F5F5; width: 472px; @@ -188,27 +186,52 @@ .maximizeResults { background-position: -32px 0; } - }/* tt-dropdown-menu */ + }/* tt-menu */ .tt-suggestion { position: relative; background: #FFF; padding: 8px 0; + > div { + display: table-cell; + } + &:hover { background: #E0E0E0; } - .searchResIconWrapper { - display: table-cell; - vertical-align: middle; - height: 32px; - padding: 0 18px 0 28px; - } .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 { @@ -274,28 +297,6 @@ } }/* tt-dataset-mappers */ - .resultText { - width: 260px; - display: table-cell; - 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; - } - .autoOptions { width: 114px; height: 48px; @@ -308,7 +309,6 @@ div, button { position: absolute; - padding: 0; margin: 0; border: none; outline: none; @@ -377,13 +377,6 @@ line-height: 24px; } - .topicMetacode { - display: table-cell; - vertical-align: middle; - padding: 0 0 0 8px; - width: 70px; - } - .tip { display: none; position: absolute; From 8425e72101b0210313cbf7fe6a03ed34efca67da Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 30 Nov 2015 10:01:33 +0800 Subject: [PATCH 36/37] fix filter bug --- app/assets/javascripts/src/Metamaps.js.erb | 48 +++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.js.erb b/app/assets/javascripts/src/Metamaps.js.erb index d15172c9..33cb15ef 100644 --- a/app/assets/javascripts/src/Metamaps.js.erb +++ b/app/assets/javascripts/src/Metamaps.js.erb @@ -3300,26 +3300,34 @@ Metamaps.Filter = { // the first option enables us to accept // ['Topics', 'Synapses'] as 'collection' if (typeof collection === "object") { - Metamaps[collection[0]].each(function(model) { - var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; - if (prop && newList.indexOf(prop) === -1) { - newList.push(prop); - } - }); - Metamaps[collection[1]].each(function(model) { - var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; - if (prop && newList.indexOf(prop) === -1) { - newList.push(prop); - } - }); - } - else if (typeof collection === "string") { - Metamaps[collection].each(function(model) { - var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; - if (prop && newList.indexOf(prop) === -1) { - newList.push(prop); - } - }); + Metamaps[collection[0]].each(function(model) { + var prop = model.get(propertyToCheck); + if (prop !== null) { + prop = prop.toString(); + if (newList.indexOf(prop) === -1) { + newList.push(prop); + } + } + }); + Metamaps[collection[1]].each(function(model) { + var prop = model.get(propertyToCheck); + if (prop !== null) { + prop = prop.toString(); + if (newList.indexOf(prop) === -1) { + newList.push(prop); + } + } + }); + } else if (typeof collection === "string") { + Metamaps[collection].each(function(model) { + var prop = model.get(propertyToCheck); + if (prop !== null) { + prop = prop.toString(); + if (newList.indexOf(prop) === -1) { + newList.push(prop); + } + } + }); } removed = _.difference(self.filters[filtersToUse], newList); From b037c84f15799f34595ba1ac12087640901c179d Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 7 Dec 2015 11:44:08 +0800 Subject: [PATCH 37/37] fix small error in user model need to use the parent's generation to calculate generation! --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 16b31872..ce68d61b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -78,7 +78,7 @@ class User < ActiveRecord::Base if code == joinedwithcode update(generation: 0) else - update(generation: User.find_by_code(joinedwithcode) + 1) + update(generation: User.find_by_code(joinedwithcode).generation + 1) end end