From b15da256fa70fcd98a49d04d0d1a8313ec1a8afb Mon Sep 17 00:00:00 2001 From: Robert Best Date: Sat, 16 Aug 2014 12:46:06 -0400 Subject: [PATCH 01/12] Included title box size in zoom to extents and put a limits on the zooming --- Gemfile.lock | 49 ---- .../javascripts/metamaps/Metamaps.JIT.js | 183 ++++++------ db/schema.rb | 266 +++++++++--------- 3 files changed, 216 insertions(+), 282 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a8354dc6..b4efab8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,8 +39,6 @@ GEM rails (~> 3.1) builder (3.0.4) cancan (1.6.10) - childprocess (0.5.3) - ffi (~> 1.0, >= 1.0.11) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.4) @@ -52,7 +50,6 @@ GEM coffee-script-source execjs coffee-script-source (1.7.0) - commonwatir (4.0.0) devise (3.2.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -61,8 +58,6 @@ GEM warden (~> 1.2.3) erubis (2.7.0) execjs (2.0.2) - ffi (1.9.0) - ffi (1.9.0-x86-mingw32) formtastic (2.2.1) actionpack (>= 3.0) formula (1.0.1) @@ -80,8 +75,6 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_magick (3.5.0) - subexec (~> 0.2.1) mini_portile (0.6.0) multi_json (1.10.0) nokogiri (1.6.2.1) @@ -96,7 +89,6 @@ GEM mime-types pg (0.17.1) pg (0.17.1-x86-mingw32) - phantomjs (1.9.7.1) polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) @@ -123,28 +115,19 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.3.2) - rautomation (0.15.0) - ffi (= 1.9.0) rdoc (3.12.2) json (~> 1.4) redis (2.2.2) - rubyzip (1.1.6) sass (3.3.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.42.0) - childprocess (>= 0.5.0) - multi_json (~> 1.0) - rubyzip (~> 1.0) - websocket (~> 1.0.4) sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - subexec (0.2.3) thor (0.19.1) thread_safe (0.3.3) tilt (1.4.1) @@ -157,36 +140,6 @@ GEM json (>= 1.8.0) warden (1.2.3) rack (>= 1.0) - watir (5.0.0) - commonwatir (~> 4) - watir-webdriver - watir (5.0.0-x86-mingw32) - commonwatir (~> 4) - watir-classic (~> 4.0) - watir-webdriver - watir-classic (4.0.1) - ffi (~> 1.0) - multi_json - nokogiri (>= 1.5.7.rc3) - rautomation (~> 0.7) - win32-process (>= 0.5.5) - win32screenshot (~> 1.0.9) - windows-pr (>= 0.6.6) - watir-webdriver (0.6.10) - selenium-webdriver (>= 2.18.0) - websocket (1.0.7) - win32-api (1.5.1-x86-mingw32) - win32-process (0.7.4) - ffi (>= 1.0.0) - win32screenshot (1.0.10) - ffi (~> 1.0) - mini_magick (~> 3.5.0) - rautomation (~> 0.7) - windows-api (0.4.2) - win32-api (>= 1.4.5) - windows-pr (1.2.3) - win32-api (>= 1.4.5) - windows-api (>= 0.4.0) PLATFORMS ruby @@ -205,10 +158,8 @@ DEPENDENCIES json paperclip pg - phantomjs rails (= 3.2.17) rails3-jquery-autocomplete redis (= 2.2.2) sass-rails uglifier (>= 1.0.3) - watir diff --git a/app/assets/javascripts/metamaps/Metamaps.JIT.js b/app/assets/javascripts/metamaps/Metamaps.JIT.js index 7a8c8362..c0250038 100644 --- a/app/assets/javascripts/metamaps/Metamaps.JIT.js +++ b/app/assets/javascripts/metamaps/Metamaps.JIT.js @@ -1461,119 +1461,102 @@ Metamaps.JIT = { if (Metamaps.Selected.Nodes.length > 0) { var nodes = Metamaps.Selected.Nodes; + } + else { + var nodes = _.values(Metamaps.Visualize.mGraph.graph.nodes); + } - if(nodes.length > 1){ - nodes.forEach(function (n) { - var x = n.pos.x, - y = n.pos.y; + if(nodes.length > 1){ + nodes.forEach(function (n) { + var x = n.pos.x, + y = n.pos.y; - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } + if (counter == 0){ + maxX = x; + minX = x; + maxY = y; + minY = y; + } - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); + var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), + dim = n.getData('dim'), + ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); - counter++; - }); + console.log(dim); - var spanX = maxX - minX; - var spanY = maxY - minY; - var ratioX = spanX / width; - var ratioY = spanY / height; + var height = 25 * arrayOfLabelLines.length; - var newRatio = Math.max(ratioX,ratioY); + var index, lineWidths = []; + for (index = 0; index < arrayOfLabelLines.length; ++index) { + lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width) + } + var width = Math.max.apply(null, lineWidths) + 8; - var canvas = Metamaps.Visualize.mGraph.canvas; + maxX = Math.max(x + width /2,maxX); + maxY = Math.max(y + n.getData("height") + 5 + height,maxY); + minX = Math.min(x - width /2,minX); + minY = Math.min(y - dim,minY); - canvas.scale(1/newRatio*0.8,1/newRatio*0.8); + counter++; + }); - counter = 0; + var spanX = maxX - minX; + var spanY = maxY - minY; + var ratioX = spanX / width; + var ratioY = spanY / height; - nodes.forEach(function (n) { - var x = n.pos.x, - y = n.pos.y; + var newRatio = Math.max(ratioX,ratioY); + var scaleMultiplier = 1/newRatio*0.9; - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } - - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); - - counter++; - }); + var canvas = Metamaps.Visualize.mGraph.canvas; + if(canvas.scaleOffsetX *scaleMultiplier<= 3 && canvas.scaleOffsetX*scaleMultiplier >= 0.2){ + canvas.scale(scaleMultiplier,scaleMultiplier); } + else if(canvas.scaleOffsetX * scaleMultiplier > 3){ + scaleMultiplier = 3/ canvas.scaleOffsetX; + canvas.scale(scaleMultiplier,scaleMultiplier); + } + else{ + scaleMultiplier = 0.2/ canvas.scaleOffsetX; + canvas.scale(scaleMultiplier,scaleMultiplier); + } + + + counter = 0; + + nodes.forEach(function (n) { + var x = n.pos.x, + y = n.pos.y; + + if (counter == 0){ + maxX = x; + minX = x; + maxY = y; + minY = y; + } + + var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), + dim = n.getData('dim'), + ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); + + console.log(dim); + + var height = 25 * arrayOfLabelLines.length; + + var index, lineWidths = []; + for (index = 0; index < arrayOfLabelLines.length; ++index) { + lineWidths.push(ctx.measureText(arrayOfLabelLines[index]).width) + } + var width = Math.max.apply(null, lineWidths) + 8; + + maxX = Math.max(x + width /2,maxX); + maxY = Math.max(y + n.getData("height") + 5 + height,maxY); + minX = Math.min(x - width /2,minX); + minY = Math.min(y - dim,minY); + + counter++; + }); } - else{ - var nodes = Metamaps.Visualize.mGraph.graph; - - if(Object.keys(nodes).length >1){ - nodes.eachNode(function (n) { - var x = n.pos.x, - y = n.pos.y; - - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } - - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); - - counter++; - }); - - var spanX = maxX - minX; - var spanY = maxY - minY; - var ratioX = spanX / width; - var ratioY = spanY / height; - - var newRatio = Math.max(ratioX,ratioY); - - var canvas = Metamaps.Visualize.mGraph.canvas; - - canvas.scale(1/newRatio*0.8,1/newRatio*0.8); - - counter = 0; - - nodes.eachNode(function (n) { - var x = n.pos.x, - y = n.pos.y; - - if (counter == 0){ - maxX = x; - minX = x; - maxY = y; - minY = y; - } - - maxX = Math.max(x,maxX); - maxY = Math.max(y,maxY); - minX = Math.min(x,minX); - minY = Math.min(y,minY); - - counter++; - }); - } - } - - - var cogX = (maxX + minX)/2; var cogY = (maxY + minY)/2; diff --git a/db/schema.rb b/db/schema.rb index 4c22e7e5..50334775 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,133 +1,133 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended to check this file into your version control system. - -ActiveRecord::Schema.define(:version => 20140815162253) do - - create_table "in_metacode_sets", :force => true do |t| - t.integer "metacode_id" - t.integer "metacode_set_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" - add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" - - create_table "mappings", :force => true do |t| - t.text "category" - t.integer "xloc" - t.integer "yloc" - t.integer "topic_id" - t.integer "synapse_id" - t.integer "map_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "maps", :force => true do |t| - t.text "name" - t.boolean "arranged" - t.text "desc" - t.text "permission" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "featured" - t.string "screenshot_file_name" - t.string "screenshot_content_type" - t.integer "screenshot_file_size" - t.datetime "screenshot_updated_at" - end - - create_table "metacode_sets", :force => true do |t| - t.string "name" - t.text "desc" - t.integer "user_id" - t.boolean "mapperContributed" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" - - create_table "metacodes", :force => true do |t| - t.text "name" - t.string "icon" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "synapses", :force => true do |t| - t.text "desc" - t.text "category" - t.text "weight" - t.text "permission" - t.integer "node1_id" - t.integer "node2_id" - t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "topics", :force => true do |t| - t.text "name" - t.text "desc" - t.text "link" - t.text "permission" - t.integer "user_id" - t.integer "metacode_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - t.string "audio_file_name" - t.string "audio_content_type" - t.integer "audio_file_size" - t.datetime "audio_updated_at" - end - - create_table "users", :force => true do |t| - t.string "name" - t.string "email" - t.text "settings" - t.string "code", :limit => 8 - t.string "joinedwithcode", :limit => 8 - t.string "crypted_password" - t.string "password_salt" - t.string "persistence_token" - t.string "perishable_token" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "encrypted_password", :limit => 128, :default => "" - t.string "remember_token" - t.datetime "remember_created_at" - t.string "reset_password_token" - t.datetime "last_sign_in_at" - t.string "last_sign_in_ip" - t.integer "sign_in_count", :default => 0 - t.datetime "current_sign_in_at" - t.string "current_sign_in_ip" - t.datetime "reset_password_sent_at" - t.boolean "admin" - t.string "image_file_name" - t.string "image_content_type" - t.integer "image_file_size" - t.datetime "image_updated_at" - end - - add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - -end +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20140815162253) do + + create_table "in_metacode_sets", :force => true do |t| + t.integer "metacode_id" + t.integer "metacode_set_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "in_metacode_sets", ["metacode_id"], :name => "index_in_metacode_sets_on_metacode_id" + add_index "in_metacode_sets", ["metacode_set_id"], :name => "index_in_metacode_sets_on_metacode_set_id" + + create_table "mappings", :force => true do |t| + t.text "category" + t.integer "xloc" + t.integer "yloc" + t.integer "topic_id" + t.integer "synapse_id" + t.integer "map_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "maps", :force => true do |t| + t.text "name" + t.boolean "arranged" + t.text "desc" + t.text "permission" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "featured" + t.string "screenshot_file_name" + t.string "screenshot_content_type" + t.integer "screenshot_file_size" + t.datetime "screenshot_updated_at" + end + + create_table "metacode_sets", :force => true do |t| + t.string "name" + t.text "desc" + t.integer "user_id" + t.boolean "mapperContributed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "metacode_sets", ["user_id"], :name => "index_metacode_sets_on_user_id" + + create_table "metacodes", :force => true do |t| + t.text "name" + t.string "icon" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "synapses", :force => true do |t| + t.text "desc" + t.text "category" + t.text "weight" + t.text "permission" + t.integer "node1_id" + t.integer "node2_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "topics", :force => true do |t| + t.text "name" + t.text "desc" + t.text "link" + t.text "permission" + t.integer "user_id" + t.integer "metacode_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + t.string "audio_file_name" + t.string "audio_content_type" + t.integer "audio_file_size" + t.datetime "audio_updated_at" + end + + create_table "users", :force => true do |t| + t.string "name" + t.string "email" + t.text "settings" + t.string "code", :limit => 8 + t.string "joinedwithcode", :limit => 8 + t.string "crypted_password" + t.string "password_salt" + t.string "persistence_token" + t.string "perishable_token" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "encrypted_password", :limit => 128, :default => "" + t.string "remember_token" + t.datetime "remember_created_at" + t.string "reset_password_token" + t.datetime "last_sign_in_at" + t.string "last_sign_in_ip" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.string "current_sign_in_ip" + t.datetime "reset_password_sent_at" + t.boolean "admin" + t.string "image_file_name" + t.string "image_content_type" + t.integer "image_file_size" + t.datetime "image_updated_at" + end + + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + +end From c817622984994a6a68a73104be8c21937b58e5fc Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Wed, 24 Sep 2014 17:15:39 -0400 Subject: [PATCH 02/12] for heroku --- app/assets/javascripts/src/Metamaps.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index ef09e128..c112917d 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -1498,7 +1498,7 @@ Metamaps.Realtime = { }); $('body').click(self.close); - self.socket = io.connect('http://localhost:5001'); + self.socket = io.connect('http://gentle-savannah-1303.herokuapp.com'); self.startActiveMap(); }, toggleBox: function (event) { From 6f62d59b66d457af0beaec549694e5911118c4bd Mon Sep 17 00:00:00 2001 From: BasharJabbour Date: Thu, 25 Sep 2014 12:25:46 -0400 Subject: [PATCH 03/12] Sign In, Sign Up, Edit User pages have been changed. Edit User page needs lots of work still. --- app/assets/stylesheets/application.css | 179 +++++++++++++++++++-- app/views/users/edit.html.erb | 19 ++- app/views/users/passwords/new.html.erb | 4 +- app/views/users/registrations/new.html.erb | 14 +- app/views/users/sessions/new.html.erb | 21 ++- diff.txt | 130 +++++++++++++++ 6 files changed, 326 insertions(+), 41 deletions(-) create mode 100644 diff.txt diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index bb0edb60..accf32c0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -74,9 +74,40 @@ body, /* forgot password fix */ .forgotPassword input[type="submit"] { - padding: 0 5px; - width: auto; + width: 300px; + color: #f5f5f5; + font-family: din-regular; } + +.new_user input[type="submit"] { + width: 96px; + padding: 0px; + font-family: din-regular; + text-transform: uppercase; + color: #f5f5f5; + margin-top:16px; + float: right; +} + +.login input[type="submit"]{ + width:84px; + margin-top: 16px; + margin-left: 61px; + margin-right: 35px; + font-family: din-regular; + text-transform: uppercase; +} + +.edit_user input[type="submit"]{ + width: 96px; + padding: 0px; + font-family: din-regular; + text-transform: uppercase; + color: #f5f5f5; + margin-top:16px; + float: right; +} + html { } @@ -181,6 +212,7 @@ input[type="submit"]:active { .new_session, .new_user, .edit_user, +.login, .forgotPassword { display: block; width: 300px; @@ -189,36 +221,132 @@ input[type="submit"]:active { border-radius: 5px; color: black; box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.4); + position:absolute; top: 50%; left:50%; - position:absolute; - margin-left: -166px; } + +.login{ + width: 322px; + height: 308px; + box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); + margin-left:-166px; + margin-top:-158px; + padding-left: 35px; + font-family: din-medium; + font-size: 18px; + color: #424242; +} + +.login input[type="checkbox"] { + border: 1px #424242; + top: 250px; + float: left; +} + +.new_user{ + height: 412px; + margin-left:-166px; + box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); + font-family: din-medium; + font-size: 18px; + line-height: 18px; + text-transform: uppercase; + color:#424242; + margin-top: -222px; +} + +.edit_user { + width: 300px; + height:531px; + top: 136px; + margin-left: -166px; + box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); + text-transform: uppercase; + font-size: 18px; + line-height: 18px; + font-family: din-medium; + color:#424242; +} + .forgotPassword { height: 134px; + font-family: din-medium; + color:#424242; + text-transform: uppercase; + box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); + font-size: 18px; + margin-left: -166px; margin-top: -83px; } + +.firstFieldText{ + font-family: din-regular; + font-size: 14px; + color:#424242; + padding-top:24px; + padding-bottom: 6px; + text-transform: none; + margin: 0px; + line-height: 14px +} +.fieldText { + font-family: din-regular; + font-size: 14px; + color:#424242; + padding-top:16px; + padding-bottom: 6px; + text-transform: none; + margin: 0px; + line-height: 14px; +} + +.smallText{ + font: din-regular; + font-size: 12px; + line-height: 12px; + color: #c04f4f; + margin-top: 16px; +} + +.forgotPasswordText { + font-family: din-medium; + font-size: 12px; + color:#757575; + margin-left: 35px; +} + +.name { + font-size: 24px; + text-align: center; + font-family: din-meduim; + color:#424242; + margin-top: 24px; + text-transform: none; +} + .centerGreyForm input[type="text"], .centerGreyForm input[type="email"], .centerGreyForm input[type="password"] { - width: 250px; + width: 300px; height: 32px; - font-size: 15px; + font-size: 14px; direction: ltr; -webkit-appearance: none; appearance: none; display: inline-block; - margin: 0; - padding: 0 8px; + margin: 0px 0px; + padding: 10px 0px 0px 9px; background: #fff; + color: #bdbdbd; border: 1px solid #d9d9d9; border-top: 1px solid #c0c0c0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; - -webkit-border-radius: 1px; - -moz-border-radius: 1px; - border-radius: 1px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; font: -webkit-small-control; color: initial; letter-spacing: normal; @@ -227,8 +355,28 @@ input[type="submit"]:active { text-indent: 0px; text-shadow: none; display: inline-block; - text-align: start; + font: din-medium; + text-align: left; } + +.login input[type="email"], +.login input[type="password"] { + width: 200px; + height:32px; + border-radius: 2px; + background-color:#ffffff; + color:#bdbdbd; + font-family: din-medium; + font-size: 14px; + text-align: left; + padding: 11px 0px 0px 10px; + margin-left: 61px; +} + +.login input[type="email"] { + margin-bottom:10px; +} + .centerGreyForm input[type="text"]:hover, .centerGreyForm input[type="email"]:hover, .centerGreyForm input[type="password"]:hover { @@ -237,7 +385,9 @@ input[type="submit"]:active { -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + color: #424242; } + .new_topic { /* start it off screen while it initializes the spinner, then it will be hidden with jquery */ top: -1000px; @@ -548,6 +698,7 @@ li.accountInvite span { width:84px; margin: 24px auto; } + .accountInput { margin: 0 35px 10px; } @@ -600,12 +751,14 @@ li.accountInvite span { } #user_remember_me { margin-top: 11px; + display:inline; } #user_remember_me, label[for="user_remember_me"] { - float: left; + float: right; font-size: 12px; color: #424242; + margin-left: 24px; } .accountForgotPass { margin: 8px 0 0 35px; diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 738d5c62..c85dc299 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -6,15 +6,18 @@ <% content_for :title, @user.name + "'s Settings | Metamaps" %>
-<%= formula_form_for @user, url: user_url do |form| %> +<%= formula_form_for @user, url: user_url, :html =>{ :class => "edit_user centerGreyForm"} do |form| %>

Edit Account

- - <% if @user.image %><%= image_tag @user.image.url(:round), :size => "48x48" %><% end %> - <%= form.file_field :image %> - <%= form.input :name, label: "Name", class: "name" %> - <%= form.input :email, label: "Email", class: "email" %> - <%= form.input :password, label: "Password", class: "password", :autocomplete => :off %> + <% if @user.image %><%= image_tag @user.image.url(:round), :size => "120x120" %><% end %> +
<%= @user.name %>
+
<%= form.label :email, "Email:", :class => "firstFieldText" %> + <%= form.input :email %>
+
<%= form.label :password, "Current Password:", :class => "firstFieldText" %> + <%= form.input :password, :autocomplete => :off%>
+
<%= form.label :password, "New Password:", :class => "firstFieldText" %> + <%= form.input :password, :autocomplete => :off%>
+
<%= form.label :password, "Confirm New Password:", :class => "firstFieldText" %> + <%= form.input :password, :autocomplete => :off%>
<%= form.submit "Update", class: "update" %> <% end %>
- diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb index 88dddb4a..120bf376 100644 --- a/app/views/users/passwords/new.html.erb +++ b/app/views/users/passwords/new.html.erb @@ -6,10 +6,10 @@

FORGOT PASSWORD?

-
<%= f.label :email, "Enter Your Email:" %> +
<%= f.label :email, "Enter your email:", :class => "firstFieldText" %> <%= f.email_field :email, :autofocus => true %>
-
<%= f.submit "Send Reset Password Instructions" %>
+
<%= f.submit "Send Password Reset Instructions" %>
<% end %>
diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index e7c08256..1f835e30 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -6,24 +6,24 @@

Sign Up

-
<%= f.label :name %> +
<%= f.label :name, "Name:", :class => "firstFieldText" %> <%= f.text_field :name, :autofocus => true %>
-
<%= f.label :email %> +
<%= f.label :email, "Email:", :class => "fieldText" %> <%= f.email_field :email %>
-
<%= f.label :password %> +
<%= f.label :password, "Password:", :class => "fieldText" %> <%= f.password_field :password %>
-
<%= f.label :password_confirmation %> +
<%= f.label :password_confirmation, "Password Confirmation:", :class => "fieldText" %> <%= f.password_field :password_confirmation %>
-
<%= f.label "Access Code" %> +
<%= f.label "Access Code:", :class => "fieldText" %> <%= f.text_field :joinedwithcode %>
-
<%= f.submit "Sign up" %>
+
<%= f.submit "Sign up!" %>
-

Don't have an access code?
Request an Invite
+

Don't have an access code?
Request an Invite
<% end %>
diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb index 6f55203b..0a13b435 100644 --- a/app/views/users/sessions/new.html.erb +++ b/app/views/users/sessions/new.html.erb @@ -1,28 +1,27 @@ <% content_for :title, "Sign In | Metamaps" %>
-<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :method => :post, :class => "new_user centerGreyForm" }) do |f| %> -

Sign in

- -
<%= f.label :email %> +<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :method => :post, :class => "centerGreyForm login" }) do |f| %> +

SIGN IN

+ +
+
<%= f.email_field :email, :autofocus => true %>
-
<%= f.label :password %> +
<%= f.password_field :password %>
+
<%= f.submit "Sign in" %>
<% if devise_mapping.rememberable? -%> -
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
+
<%= f.check_box :remember_me %>
<% end -%> -
<%= f.submit "Sign in" %>
-
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot your password?", new_password_path(resource_name), - :data => { :bypass => 'true'} %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name), :class => "forgotPasswordText" , + :data => { :bypass => 'true'}%>
<% end -%>
-
Don't have an account?
Request an Invite
<% end %>
diff --git a/diff.txt b/diff.txt new file mode 100644 index 00000000..badb2420 --- /dev/null +++ b/diff.txt @@ -0,0 +1,130 @@ + + +diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css +index bb0edb6..bb56ab0 100644 +--- a/app/assets/stylesheets/application.css ++++ b/app/assets/stylesheets/application.css +@@ -74,8 +74,9 @@ body, + /* forgot password fix */ + + .forgotPassword input[type="submit"] { +- padding: 0 5px; +- width: auto; ++ width: 300px; ++ color: #f5f5f5; ++ font-family: din-regular; + } + html { + +@@ -189,36 +190,55 @@ input[type="submit"]:active { + border-radius: 5px; + color: black; + box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.4); ++ position:absolute; + top: 50%; + left:50%; +- position:absolute; +- margin-left: -166px; ++ + } ++ + .forgotPassword { + height: 134px; + margin-top: -83px; ++ font-family: din-medium; ++ color:#424242; ++ text-transform: uppercase; ++ box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); ++ font-size: 17px; ++ margin-left: -166px; ++ ++} ++ ++.emailText { ++ font-family: din-regular; ++ font-size: 14px; ++ color:#424242; ++ padding-top:24px; ++ padding-bottom: 6px; ++ text-transform: none; ++ margin: 0px; + } + .centerGreyForm input[type="text"], + .centerGreyForm input[type="email"], + .centerGreyForm input[type="password"] { +- width: 250px; ++ width: 300px; + height: 32px; + font-size: 15px; + direction: ltr; + -webkit-appearance: none; + appearance: none; + display: inline-block; +- margin: 0; +- padding: 0 8px; ++ margin: 0px 0px 6px 0px; ++ padding: 10px 0px 0px 9px; + background: #fff; ++ color: #bdbdbd; + border: 1px solid #d9d9d9; + border-top: 1px solid #c0c0c0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +- -webkit-border-radius: 1px; +- -moz-border-radius: 1px; +- border-radius: 1px; ++ -webkit-border-radius: 2px; ++ -moz-border-radius: 2px; ++ border-radius: 2px; + font: -webkit-small-control; + color: initial; + letter-spacing: normal; +@@ -227,8 +247,10 @@ input[type="submit"]:active { + text-indent: 0px; + text-shadow: none; + display: inline-block; +- text-align: start; ++ font: din-medium; ++ text-align: left; + } ++ + .centerGreyForm input[type="text"]:hover, + .centerGreyForm input[type="email"]:hover, + .centerGreyForm input[type="password"]:hover { +@@ -237,7 +259,9 @@ input[type="submit"]:active { + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); ++ color: #424242; + } ++ + .new_topic { + /* start it off screen while it initializes the spinner, then it will be hidden with jquery */ + top: -1000px; +diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb +index 738d5c6..70d6de7 100644 +--- a/app/views/users/edit.html.erb ++++ b/app/views/users/edit.html.erb +@@ -17,4 +17,3 @@ + <%= form.submit "Update", class: "update" %> + <% end %> +
+- +diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb +index 88dddb4..3238a81 100644 +--- a/app/views/users/passwords/new.html.erb ++++ b/app/views/users/passwords/new.html.erb +@@ -6,10 +6,10 @@ + +

FORGOT PASSWORD?

+ +-
<%= f.label :email, "Enter Your Email:" %> ++
<%= f.label :email, "Enter your email:", :class => "emailText" %> + <%= f.email_field :email, :autofocus => true %>
+ +-
<%= f.submit "Send Reset Password Instructions" %>
++
<%= f.submit "Send Password Reset Instructions" %>
+ + <% end %> +
From 71247a8f04bc04d8c81fc92978edb1d12b43a4f4 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Thu, 25 Sep 2014 13:26:09 -0400 Subject: [PATCH 04/12] fixes for account pages --- app/assets/stylesheets/application.css | 43 +++++++++++--------------- app/views/layouts/_account.html.erb | 18 ++++++----- app/views/users/edit.html.erb | 12 +++---- app/views/users/sessions/new.html.erb | 25 +++++++++------ 4 files changed, 50 insertions(+), 48 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index cabd6303..e67b6e69 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -92,8 +92,6 @@ body, .login input[type="submit"]{ width:84px; margin-top: 16px; - margin-left: 61px; - margin-right: 35px; font-family: din-regular; text-transform: uppercase; } @@ -227,23 +225,16 @@ input[type="submit"]:active { } .login{ - width: 322px; + width: 200px; height: 308px; box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); - margin-left:-166px; + margin-left:-100px; margin-top:-158px; - padding-left: 35px; font-family: din-medium; font-size: 18px; color: #424242; } -.login input[type="checkbox"] { - border: 1px #424242; - top: 250px; - float: left; -} - .new_user{ height: 412px; margin-left:-166px; @@ -258,8 +249,7 @@ input[type="submit"]:active { .edit_user { width: 300px; - height:531px; - top: 136px; + margin-top: -282px; margin-left: -166px; box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); text-transform: uppercase; @@ -309,13 +299,6 @@ input[type="submit"]:active { margin-top: 16px; } -.forgotPasswordText { - font-family: din-medium; - font-size: 12px; - color:#757575; - margin-left: 35px; -} - .name { font-size: 24px; text-align: center; @@ -370,7 +353,6 @@ input[type="submit"]:active { font-size: 14px; text-align: left; padding: 11px 0px 0px 10px; - margin-left: 61px; } .login input[type="email"] { @@ -745,11 +727,18 @@ li.accountInvite span { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); } .accountSubmit { - margin-left: 35px; float:left; } +.loginAnywhere .accountSubmit { + margin-left: 35px; +} .accountRememberMe { float:right; +} +.login .accountRememberMe { + margin-top: 10px; +} +.loginAnywhere .accountRememberMe { margin-right: 35px; } #user_remember_me { @@ -761,12 +750,16 @@ label[for="user_remember_me"] { float: right; font-size: 12px; color: #424242; - margin-left: 24px; } .accountForgotPass { - margin: 8px 0 0 35px; font-size: 12px; } +.loginAnywhere .accountForgotPass { + margin: 8px 0 0 35px; +} +.login .accountForgotPass { + margin: 8px 0 0 0; +} .accountForgotPass a { color: #757575; } @@ -2257,4 +2250,4 @@ float: left; background-position: 16px 8px; -webkit-transform-origin: left center; transform-origin: left center; -} +} diff --git a/app/views/layouts/_account.html.erb b/app/views/layouts/_account.html.erb index 5fe43665..0cee5c7f 100644 --- a/app/views/layouts/_account.html.erb +++ b/app/views/layouts/_account.html.erb @@ -38,14 +38,18 @@
<%= f.submit "SIGN IN" %>
<% if devise_mapping.rememberable? -%> -
<%= f.check_box :remember_me %> <%= f.label :remember_me, "Stay signed in" %>
+
+ <%= f.label :remember_me, "Stay signed in" %> + <%= f.check_box :remember_me %> +
+
<% end -%>
+
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot password?", new_password_path(resource_name), + :data => { :bypass => 'true'} %> + <% end -%> +
<% end %> -
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot password?", new_password_path(resource_name), - :data => { :bypass => 'true'} %> - <% end -%> -
<% end %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index c85dc299..5eee44f1 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -6,18 +6,18 @@ <% content_for :title, @user.name + "'s Settings | Metamaps" %>
-<%= formula_form_for @user, url: user_url, :html =>{ :class => "edit_user centerGreyForm"} do |form| %> +<%= form_for @user, url: user_url, :html =>{ :class => "edit_user centerGreyForm"} do |form| %>

Edit Account

<% if @user.image %><%= image_tag @user.image.url(:round), :size => "120x120" %><% end %>
<%= @user.name %>
<%= form.label :email, "Email:", :class => "firstFieldText" %> - <%= form.input :email %>
+ <%= form.email_field :email %>
<%= form.label :password, "Current Password:", :class => "firstFieldText" %> - <%= form.input :password, :autocomplete => :off%>
+ <%= form.password_field :password, :autocomplete => :off%>
<%= form.label :password, "New Password:", :class => "firstFieldText" %> - <%= form.input :password, :autocomplete => :off%>
-
<%= form.label :password, "Confirm New Password:", :class => "firstFieldText" %> - <%= form.input :password, :autocomplete => :off%>
+ <%= form.password_field :password, :autocomplete => :off%>
+
<%= form.label :password_confirmation, "Confirm New Password:", :class => "firstFieldText" %> + <%= form.password_field :password_confirmation, :autocomplete => :off%>
<%= form.submit "Update", class: "update" %> <% end %>
diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb index 0a13b435..0c28a9cb 100644 --- a/app/views/users/sessions/new.html.erb +++ b/app/views/users/sessions/new.html.erb @@ -6,22 +6,27 @@
- <%= f.email_field :email, :autofocus => true %>
+ <%= f.email_field :email, :autofocus => true, :placeholder => "Email" %>
- <%= f.password_field :password %>
+ <%= f.password_field :password, :placeholder => "Password" %> -
<%= f.submit "Sign in" %>
+
<%= f.submit "Sign in" %>
<% if devise_mapping.rememberable? -%> -
<%= f.check_box :remember_me %>
+
+ <%= f.label :remember_me, "Stay signed in" %> + <%= f.check_box :remember_me %> +
+
<% end -%> +
-
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot your password?", new_password_path(resource_name), :class => "forgotPasswordText" , - :data => { :bypass => 'true'}%>
- <% end -%> -
+
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot password?", new_password_path(resource_name), + :data => { :bypass => 'true'}%>
+ <% end -%> +
<% end %> From c46ab1a98b9a8d573194bcd1e45fd612fb02af22 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Thu, 25 Sep 2014 13:41:37 -0400 Subject: [PATCH 05/12] added hover to edit photo --- app/assets/stylesheets/application.css | 19 +++++++++++++++++++ app/views/users/edit.html.erb | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index e67b6e69..eb8176b8 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -106,6 +106,25 @@ body, float: right; } +.edit_user .userImage { + width: 120px; + margin: 0 auto; + position: relative; +} +.edit_user .editPhoto { + display: none; + width: 40px; + height: 40px; + background-image: url(photo.png); + position: absolute; + top: 40px; + left: 40px; + cursor: pointer; +} +.edit_user .userImage:hover .editPhoto { + display: block; +} + html { } diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 5eee44f1..ea03ef49 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -8,7 +8,10 @@
<%= form_for @user, url: user_url, :html =>{ :class => "edit_user centerGreyForm"} do |form| %>

Edit Account

- <% if @user.image %><%= image_tag @user.image.url(:round), :size => "120x120" %><% end %> +
+ <%= image_tag @user.image.url(:round), :size => "120x120" %> +
+
<%= @user.name %>
<%= form.label :email, "Email:", :class => "firstFieldText" %> <%= form.email_field :email %>
From 14eb7562b19981bf761b955eb1356149b0102480 Mon Sep 17 00:00:00 2001 From: BasharJabbour Date: Fri, 26 Sep 2014 08:42:11 -0400 Subject: [PATCH 06/12] fixed edit user account page --- app/assets/javascripts/src/Metamaps.js | 36 ++++++++++++++++++ app/assets/stylesheets/application.css | 51 +++++++++++++++++++++++--- app/views/users/edit.html.erb | 4 ++ app/views/users/sessions/new.html.erb | 25 +++++-------- 4 files changed, 95 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index c112917d..7ded91f1 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -3401,6 +3401,7 @@ Metamaps.Map.InfoBox = { }); $('.yourMap .mapPermission').unbind().click(self.onPermissionClick); + }, createContributorList: function () { var self = Metamaps.Map.InfoBox; @@ -3457,6 +3458,41 @@ Metamaps.Map.InfoBox = { } }; // end Metamaps.Map.InfoBox +/* +* +* Account Settings +* +*/ +Metamaps.Account = { + init: function () { + var self = Metamaps.Account; + $(".changePass").click(function(){ + $(".toHide").show(); + $(".changePass").hide(); + }); + }, + + load: function(){ + var self = Metamaps.Account; + $(".changePass").click(function(){ + $(".toHide").show(); + $(".changePass").hide(); + }); + self.attachEventListeners(); + }, + attachEventListeners: function () { + $(".changePass").click(); + $(".noChangePass").click(); + }, + showPass: function(){ + $(".toHide").show(); + $(".changePass").hide(); + }, + hidePass: function(){ + $(".toHide").hide(); + $(".changePass").show(); + } +}; /* * diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index eb8176b8..38b61813 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -77,6 +77,8 @@ body, width: 300px; color: #f5f5f5; font-family: din-regular; + top: 118px; + position: absolute; } .new_user input[type="submit"] { @@ -110,6 +112,7 @@ body, width: 120px; margin: 0 auto; position: relative; + margin-top: 40px; } .edit_user .editPhoto { display: none; @@ -259,7 +262,6 @@ input[type="submit"]:active { margin-left:-166px; box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); font-family: din-medium; - font-size: 18px; line-height: 18px; text-transform: uppercase; color:#424242; @@ -272,21 +274,24 @@ input[type="submit"]:active { margin-left: -166px; box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); text-transform: uppercase; - font-size: 18px; line-height: 18px; font-family: din-medium; color:#424242; } +.toHide { + display:none; +} + .forgotPassword { height: 134px; font-family: din-medium; color:#424242; text-transform: uppercase; box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.23), 0px 3px 3px rgba(0, 0, 0, 0.16); - font-size: 18px; margin-left: -166px; margin-top: -83px; + line-height: 18px; } .firstFieldText{ @@ -311,11 +316,12 @@ input[type="submit"]:active { } .smallText{ - font: din-regular; + font-family: din-regular; font-size: 12px; line-height: 12px; color: #c04f4f; - margin-top: 16px; + margin-top: 8px; + text-transform: none; } .name { @@ -325,6 +331,39 @@ input[type="submit"]:active { color:#424242; margin-top: 24px; text-transform: none; + +} + +.name:after { + background:url(edit.png)no-repeat; + content:" "; + position:absolute; + width:25px; + height:25px; + margin:5px 0px 0px 5px; +} + +.changePass { + font-family: din-regular; + font-size: 14px; + line-height: 14px; + color: #4fb5c0; + padding-top: 16px; + float: left; + text-transform: none; + cursor: pointer; +} + +.noChangePass { + font-family: din-regular; + font-size: 12px; + line-height: 12px; + color: #c04f4f; + padding-top: 16px; + float: left; + text-transform: none; + cursor: pointer; + } .centerGreyForm input[type="text"], @@ -357,7 +396,7 @@ input[type="submit"]:active { text-indent: 0px; text-shadow: none; display: inline-block; - font: din-medium; + font-family: din-medium; text-align: left; } diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index ea03ef49..56afbb88 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -15,12 +15,16 @@
<%= @user.name %>
<%= form.label :email, "Email:", :class => "firstFieldText" %> <%= form.email_field :email %>
+
Change Password
+
<%= form.label :password, "Current Password:", :class => "firstFieldText" %> <%= form.password_field :password, :autocomplete => :off%>
<%= form.label :password, "New Password:", :class => "firstFieldText" %> <%= form.password_field :password, :autocomplete => :off%>
<%= form.label :password_confirmation, "Confirm New Password:", :class => "firstFieldText" %> <%= form.password_field :password_confirmation, :autocomplete => :off%>
+
oops, don't change password
+
<%= form.submit "Update", class: "update" %> <% end %>
diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb index 0c28a9cb..0ce0e56c 100644 --- a/app/views/users/sessions/new.html.erb +++ b/app/views/users/sessions/new.html.erb @@ -6,27 +6,22 @@
- <%= f.email_field :email, :autofocus => true, :placeholder => "Email" %>
+ <%= f.email_field :email, :autofocus => true %>
- <%= f.password_field :password, :placeholder => "Password" %>
+ <%= f.password_field :password %> -
<%= f.submit "Sign in" %>
+
<%= f.submit "Sign in" %>
<% if devise_mapping.rememberable? -%> -
- <%= f.label :remember_me, "Stay signed in" %> - <%= f.check_box :remember_me %> -
-
+
<%= f.check_box :remember_me %>
<% end -%> -
-
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot password?", new_password_path(resource_name), - :data => { :bypass => 'true'}%>
- <% end -%> -
+
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot your password?", new_password_path(resource_name), :class => "forgotPasswordText" , + :data => { :bypass => 'true'}%>
+ <% end -%> +
<% end %> From 32908c7717e80c03b2e0e3886abbdf34e1d3c61e Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Fri, 26 Sep 2014 22:31:06 -0400 Subject: [PATCH 07/12] style changes for account pages --- app/assets/javascripts/src/Metamaps.js | 23 +++---- app/assets/stylesheets/application.css | 86 ++++++++++++++------------ app/assets/stylesheets/clean.css | 12 +--- app/views/users/edit.html.erb | 16 +++-- app/views/users/sessions/new.html.erb | 27 ++++---- 5 files changed, 84 insertions(+), 80 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index 7ded91f1..d0f6057d 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -3466,23 +3466,12 @@ Metamaps.Map.InfoBox = { Metamaps.Account = { init: function () { var self = Metamaps.Account; - $(".changePass").click(function(){ - $(".toHide").show(); - $(".changePass").hide(); - }); - }, - load: function(){ - var self = Metamaps.Account; - $(".changePass").click(function(){ - $(".toHide").show(); - $(".changePass").hide(); - }); - self.attachEventListeners(); + }, - attachEventListeners: function () { - $(".changePass").click(); - $(".noChangePass").click(); + changeName: function(){ + $('.accountName').hide(); + $('.changeName').show(); }, showPass: function(){ $(".toHide").show(); @@ -3491,6 +3480,10 @@ Metamaps.Account = { hidePass: function(){ $(".toHide").hide(); $(".changePass").show(); + + $('#current_password').val(''); + $('#user_password').val(''); + $('#user_password_confirmation').val(''); } }; diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 38b61813..8ae9967a 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -51,6 +51,22 @@ img { display: block; text-indent: -9999px; } + +::-webkit-input-placeholder { /* WebKit browsers */ + color: #BDBDBD; +} +:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ + color: #BDBDBD; + opacity: 1; +} +::-moz-placeholder { /* Mozilla Firefox 19+ */ + color: #BDBDBD; + opacity: 1; +} +:-ms-input-placeholder { /* Internet Explorer 10+ */ + color: #BDBDBD; +} + html, body, .main, @@ -109,10 +125,10 @@ body, } .edit_user .userImage { - width: 120px; + width: 84px; margin: 0 auto; position: relative; - margin-top: 40px; + margin-top: 32px; } .edit_user .editPhoto { display: none; @@ -120,8 +136,8 @@ body, height: 40px; background-image: url(photo.png); position: absolute; - top: 40px; - left: 40px; + top: 22px; + left: 22px; cursor: pointer; } .edit_user .userImage:hover .editPhoto { @@ -294,8 +310,11 @@ input[type="submit"]:active { line-height: 18px; } +.edit_user label.firstFieldText { + padding-top: 8px; +} .firstFieldText{ - font-family: din-regular; + font-family: 'din-regular', helvetica, sans-serif; font-size: 14px; color:#424242; padding-top:24px; @@ -324,17 +343,16 @@ input[type="submit"]:active { text-transform: none; } -.name { +.accountName { font-size: 24px; text-align: center; - font-family: din-meduim; + font-family: 'din-medium', helvetica, sans-serif; color:#424242; margin-top: 24px; text-transform: none; } - -.name:after { +.accountName:hover .nameEdit:after { background:url(edit.png)no-repeat; content:" "; position:absolute; @@ -342,6 +360,10 @@ input[type="submit"]:active { height:25px; margin:5px 0px 0px 5px; } +.changeName { + display: none; + margin-top: 24px; +} .changePass { font-family: din-regular; @@ -377,11 +399,11 @@ input[type="submit"]:active { appearance: none; display: inline-block; margin: 0px 0px; - padding: 10px 0px 0px 9px; + padding: 5px 0px 0px 9px; background: #fff; - color: #bdbdbd; - border: 1px solid #d9d9d9; - border-top: 1px solid #c0c0c0; + color: #424242 !important; + border: none; + outline:none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; @@ -396,7 +418,7 @@ input[type="submit"]:active { text-indent: 0px; text-shadow: none; display: inline-block; - font-family: din-medium; + font-family: 'din-regular', helvetica, sans-serif; text-align: left; } @@ -406,28 +428,17 @@ input[type="submit"]:active { height:32px; border-radius: 2px; background-color:#ffffff; - color:#bdbdbd; + color: #424242 !important; font-family: din-medium; font-size: 14px; text-align: left; - padding: 11px 0px 0px 10px; + padding: 5px 0px 0px 10px; } .login input[type="email"] { margin-bottom:10px; } -.centerGreyForm input[type="text"]:hover, -.centerGreyForm input[type="email"]:hover, -.centerGreyForm input[type="password"]:hover { - border: 1px solid #b9b9b9; - border-top: 1px solid #a0a0a0; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - color: #424242; -} - .new_topic { /* start it off screen while it initializes the spinner, then it will be hidden with jquery */ top: -1000px; @@ -758,8 +769,7 @@ li.accountInvite span { margin: 0; padding: 0 10px; background: #fff; - border: 1px solid #d9d9d9; - border-top: 1px solid #c0c0c0; + border: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; @@ -767,7 +777,7 @@ li.accountInvite span { -moz-border-radius: 2px; border-radius: 2px; font: -webkit-small-control; - color: #BDBDBD; + color: #424242 !important; letter-spacing: normal; word-spacing: normal; text-transform: none; @@ -776,14 +786,6 @@ li.accountInvite span { text-align: start; font-family: 'din-medium', helvetica, sans-serif; } -.sidebarAccountBox input[type="email"]:hover, -.sidebarAccountBox input[type="password"]:hover { - border: 1px solid #b9b9b9; - border-top: 1px solid #a0a0a0; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); -} .accountSubmit { float:left; } @@ -2267,7 +2269,15 @@ float: left; display: none; } + /* collabCompass section */ +.collabCompass { + position:fixed; + top:50%; + left:50%; + z-index: 4; +} + .collabCompass:hover p { display: block; } diff --git a/app/assets/stylesheets/clean.css b/app/assets/stylesheets/clean.css index 4548ad71..918af0c3 100644 --- a/app/assets/stylesheets/clean.css +++ b/app/assets/stylesheets/clean.css @@ -805,14 +805,4 @@ box-shadow: 0px 1px 1.5px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.24); body a#barometer_tab:hover { background-position: 0 -110px; -} - - -/* REALTIME */ - -.collabCompass { - position:fixed; - top:50%; - left:50%; - z-index: 4; -} +} \ No newline at end of file diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 56afbb88..82166dbf 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -9,21 +9,27 @@ <%= form_for @user, url: user_url, :html =>{ :class => "edit_user centerGreyForm"} do |form| %>

Edit Account

- <%= image_tag @user.image.url(:round), :size => "120x120" %> + <%= image_tag @user.image.url(:round), :size => "84x84" %>
-
<%= @user.name %>
+
+
<%= @user.name %>
+
+
<%= form.label :name, "Name:", :class => "firstFieldText" %> + <%= form.email_field :name %>
<%= form.label :email, "Email:", :class => "firstFieldText" %> <%= form.email_field :email %>
Change Password
-
<%= form.label :password, "Current Password:", :class => "firstFieldText" %> - <%= form.password_field :password, :autocomplete => :off%>
+
+ <%= form.label :current_password, "Current Password:", :class => "firstFieldText" %> + <%= password_field_tag :current_password, params[:current_password] %> +
<%= form.label :password, "New Password:", :class => "firstFieldText" %> <%= form.password_field :password, :autocomplete => :off%>
<%= form.label :password_confirmation, "Confirm New Password:", :class => "firstFieldText" %> <%= form.password_field :password_confirmation, :autocomplete => :off%>
-
oops, don't change password
+
Oops, don't change password
<%= form.submit "Update", class: "update" %> <% end %> diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb index 0ce0e56c..16836175 100644 --- a/app/views/users/sessions/new.html.erb +++ b/app/views/users/sessions/new.html.erb @@ -6,22 +6,27 @@
- <%= f.email_field :email, :autofocus => true %>
+ <%= f.email_field :email, :autofocus => true, :placeholder => "Email" %>
- <%= f.password_field :password %>
+ <%= f.password_field :password, :placeholder => "Password" %> -
<%= f.submit "Sign in" %>
+
<%= f.submit "Sign in" %>
+ <% if devise_mapping.rememberable? -%> -
<%= f.check_box :remember_me %>
+
+ <%= f.label :remember_me, "Stay signed in" %> + <%= f.check_box :remember_me %> +
+
<% end -%> - -
- <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> - <%= link_to "Forgot your password?", new_password_path(resource_name), :class => "forgotPasswordText" , - :data => { :bypass => 'true'}%>
- <% end -%> -
+
+
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot password?", new_password_path(resource_name), + :data => { :bypass => 'true'} %> + <% end -%> +
<% end %> From 0160f56238b4ffaf8f69f2ef69e36e22f729a675 Mon Sep 17 00:00:00 2001 From: Robert Best Date: Fri, 26 Sep 2014 22:40:31 -0400 Subject: [PATCH 08/12] partially finished fixes to zoomextents --- app/assets/javascripts/metamaps/JIT.js | 6 ++ .../javascripts/metamaps/Metamaps.GlobalUI.js | 17 ++++ .../javascripts/metamaps/Metamaps.JIT.js | 90 +++++++++++++++---- app/assets/javascripts/metamaps/Metamaps.js | 3 + 4 files changed, 99 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/metamaps/JIT.js b/app/assets/javascripts/metamaps/JIT.js index de6aacb7..c43788bc 100644 --- a/app/assets/javascripts/metamaps/JIT.js +++ b/app/assets/javascripts/metamaps/JIT.js @@ -2489,7 +2489,11 @@ Extras.Classes.Navigation = new Class({ if (!Metamaps.Mouse.boxStartCoordinates && (e.shiftKey || rightClick)) { Metamaps.Mouse.boxStartCoordinates = eventInfo.getPos(); } + Metamaps.Mouse.didPan = false; + + + // END METAMAPS CODE this.pos = eventInfo.getPos(); @@ -2557,6 +2561,8 @@ Extras.Classes.Navigation = new Class({ // START METAMAPS CODE if (Metamaps.Mouse.didPan) Metamaps.JIT.SmoothPanning(); + + // END METAMAPS CODE } diff --git a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js index 13278b28..f1c40b25 100644 --- a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js +++ b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js @@ -372,6 +372,23 @@ Metamaps.GlobalUI.Search = { self.close(0, true); } break; + case 65: + case 97: + e.preventDefault(); + if (e.ctrlKey){ + Metamaps.Visualize.mGraph.graph.eachNode(function (n) { + Metamaps.Control.selectNode(n,e); + }); + + Metamaps.Visualize.mGraph.plot(); + } + + break; + case 69: + case 101: + e.preventDefault(); + Metamaps.JIT.zoomExtents(); + break; default: break; //console.log(e.which); } diff --git a/app/assets/javascripts/metamaps/Metamaps.JIT.js b/app/assets/javascripts/metamaps/Metamaps.JIT.js index c0250038..810f2b2e 100644 --- a/app/assets/javascripts/metamaps/Metamaps.JIT.js +++ b/app/assets/javascripts/metamaps/Metamaps.JIT.js @@ -313,7 +313,7 @@ Metamaps.JIT = { if (Metamaps.Mouse.boxStartCoordinates) { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); - Metamaps.JIT.selectWithBox(e); + Metamaps.JIT.zoomToBox(); return; } @@ -663,8 +663,6 @@ Metamaps.JIT = { var scale = dist / lastDist; - console.log(scale); - if (8 >= Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale && Metamaps.Visualize.mGraph.canvas.scaleOffsetX * scale >= 1) { Metamaps.Visualize.mGraph.canvas.scale(scale, scale); } @@ -945,7 +943,9 @@ Metamaps.JIT = { var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y; var toNodeX = synapse.get('edge').nodeTo.pos.x; var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y; - + var from = synapse.get('edge').nodeFrom; + var to = synapse.get('edge').nodeTo; + var maxX = fromNodeX; var maxY = fromNodeY; var minX = fromNodeX; @@ -964,7 +964,7 @@ Metamaps.JIT = { (eX > maxBoxX) ? (maxBoxX = eX):(minBoxX = eX); (eY > maxBoxY) ? (maxBoxY = eY):(minBoxY = eY); - //Fins the slopes from the synapse fromNode to the 4 corners of the selection box + //Find the slopes from the synapse fromNode to the 4 corners of the selection box var slopes = []; slopes.push( (sY - fromNodeY) / (sX - fromNodeX) ); slopes.push( (sY - fromNodeY) / (eX - fromNodeX) ); @@ -983,6 +983,10 @@ Metamaps.JIT = { var b = fromNodeY - synSlope * fromNodeX; var selectTest = false; + if (from.name == 'node 3' && to.name == 'node1'){ + console.log(from.pos.x,-1*from.pos.y,to.pos.x,-1*to.pos.y,sX,sY,eX,eY); + } + //if the synapse slope is within a range that would intersect with the selection box if (synSlope <= maxSlope && synSlope >= minSlope){ @@ -1003,17 +1007,18 @@ Metamaps.JIT = { testY = sY; testX = (testY - b)/synSlope; - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testY <= maxBoxX){ + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ selectTest = true; } testY = eY; testX = (testY - b)/synSlope; - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testY <= maxBoxX){ + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ selectTest = true; } } + //console.log('From '+from.name + ' to ' + to.name + ' is a ' +selectTest); //The test synapse was selected! if(selectTest){ if(e.ctrlKey){ @@ -1078,15 +1083,23 @@ Metamaps.JIT = { // wait a certain length of time, then check again, then run this code setTimeout(function () { if (!Metamaps.JIT.nodeWasDoubleClicked()) { - if (!e.shiftKey) { + if (!e.shiftKey && !e.ctrlKey) { Metamaps.Control.deselectAllNodes(); Metamaps.Control.deselectAllEdges(); } - if (node.selected) { - Metamaps.Control.deselectNode(node); - } else { + if(e.ctrlKey || e.shiftKey){ + if (node.selected) { + Metamaps.Control.deselectNode(node); + } else { + Metamaps.Control.selectNode(node,e); + } + } + else{ + Metamaps.Control.deselectAllNodes(); + Metamaps.Control.deselectAllEdges(); Metamaps.Control.selectNode(node,e); } + //trigger animation to final styles Metamaps.Visualize.mGraph.fx.animate({ modes: ['edge-property:lineWidth:color:alpha'], @@ -1111,7 +1124,6 @@ Metamaps.JIT = { // create new menu for clicked on node var rightclickmenu = document.createElement("div"); rightclickmenu.className = "rightclickmenu"; - // add the proper options to the menu var menustring = '
    '; @@ -1139,7 +1151,7 @@ Metamaps.JIT = { top: e.clientY }); //add the menu to the page - $('#center-container').append(rightclickmenu); + $('#infovis-canvaswidget').append(rightclickmenu); // attach events to clicks on the list items @@ -1452,6 +1464,54 @@ Metamaps.JIT = { canvas.translate(-1*offsetX,-1*offsetY); }, + zoomToBox: function () { + var sX = Metamaps.Mouse.boxStartCoordinates.x, + sY = Metamaps.Mouse.boxStartCoordinates.y, + eX = Metamaps.Mouse.boxEndCoordinates.x, + eY = Metamaps.Mouse.boxEndCoordinates.y; + + Metamaps.JIT.centerMap(); + + var height = $(document).height(), + width = $(document).width(); + + var spanX = Math.abs(sX - eX); + var spanY = Math.abs(sY - eY); + var ratioX = width / spanX; + var ratioY = height / spanY; + console.log(ratioX,ratioY); + + var newRatio = Math.min(ratioX,ratioY); + + var canvas = Metamaps.Visualize.mGraph.canvas; + + if(canvas.scaleOffsetX *newRatio<= 5 && canvas.scaleOffsetX*newRatio >= 0.2){ + canvas.scale(newRatio,newRatio); + } + else if(canvas.scaleOffsetX * newRatio > 5){ + newRatio = 5/ canvas.scaleOffsetX; + canvas.scale(newRatio,newRatio); + } + else{ + newRatio = 0.2/ canvas.scaleOffsetX; + canvas.scale(newRatio,newRatio); + } + + + + + + var cogX = (sX + eX)/2; + var cogY = (sY + eY)/2; + + canvas.translate(-1* cogX, -1* cogY); + + + Metamaps.Mouse.boxStartCoordinates = false; + Metamaps.Mouse.boxEndCoordinates = false; + Metamaps.Visualize.mGraph.plot(); + + }, zoomExtents: function () { Metamaps.JIT.centerMap(); var height = $(document).height(), @@ -1482,8 +1542,6 @@ Metamaps.JIT = { dim = n.getData('dim'), ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); - console.log(dim); - var height = 25 * arrayOfLabelLines.length; var index, lineWidths = []; @@ -1539,8 +1597,6 @@ Metamaps.JIT = { dim = n.getData('dim'), ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); - console.log(dim); - var height = 25 * arrayOfLabelLines.length; var index, lineWidths = []; diff --git a/app/assets/javascripts/metamaps/Metamaps.js b/app/assets/javascripts/metamaps/Metamaps.js index c7b6e3e6..6f4473f9 100644 --- a/app/assets/javascripts/metamaps/Metamaps.js +++ b/app/assets/javascripts/metamaps/Metamaps.js @@ -47,6 +47,7 @@ Metamaps.Touch = { Metamaps.Mouse = { didPan: false, + didBoxZoom: false, changeInX: 0, changeInY: 0, edgeHoveringOver: false, @@ -1718,11 +1719,13 @@ Metamaps.Control = { if (Metamaps.Selected.Nodes.indexOf(node) != -1) return; node.selected = true; node.setData('dim', 30, 'current'); + /* if(!(e.ctrlKey) && !(e.altKey)){ node.eachAdjacency(function (adj) { Metamaps.Control.selectEdge(adj); }); } + */ Metamaps.Selected.Nodes.push(node); }, From 2de7167c2c71ff3219ea28c2a8d3834ccff35536 Mon Sep 17 00:00:00 2001 From: Robert Best Date: Sun, 28 Sep 2014 15:29:22 -0400 Subject: [PATCH 09/12] A bunch of fixes for selection with box, and zoom to extents --- .../javascripts/src/Metamaps.GlobalUI.js | 12 +- app/assets/javascripts/src/Metamaps.JIT.js | 114 +++++++++--------- 2 files changed, 66 insertions(+), 60 deletions(-) diff --git a/app/assets/javascripts/src/Metamaps.GlobalUI.js b/app/assets/javascripts/src/Metamaps.GlobalUI.js index 4c2d9a05..a425d78f 100644 --- a/app/assets/javascripts/src/Metamaps.GlobalUI.js +++ b/app/assets/javascripts/src/Metamaps.GlobalUI.js @@ -368,8 +368,12 @@ Metamaps.GlobalUI.Search = { break; case 65: case 97: - e.preventDefault(); + if (e.ctrlKey){ + Metamaps.Control.deselectAllNodes(); + Metamaps.Control.deselectAllEdges(); + + e.preventDefault(); Metamaps.Visualize.mGraph.graph.eachNode(function (n) { Metamaps.Control.selectNode(n,e); }); @@ -380,8 +384,10 @@ Metamaps.GlobalUI.Search = { break; case 69: case 101: - e.preventDefault(); - Metamaps.JIT.zoomExtents(); + if (e.ctrlKey){ + e.preventDefault(); + Metamaps.JIT.zoomExtents(); + } break; default: break; //console.log(e.which); diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 9562e2fd..41481c56 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -938,7 +938,7 @@ Metamaps.JIT = { Metamaps.Control.deselectAllEdges(); } - //select all nodes, and their edges, that are within the box + //select all nodes that are within the box Metamaps.Visualize.mGraph.graph.eachNode(function (n) { var x = n.pos.x, y = n.pos.y; @@ -967,10 +967,8 @@ Metamaps.JIT = { var fromNodeY = -1 * synapse.get('edge').nodeFrom.pos.y; var toNodeX = synapse.get('edge').nodeTo.pos.x; var toNodeY = -1 * synapse.get('edge').nodeTo.pos.y; - var from = synapse.get('edge').nodeFrom; - var to = synapse.get('edge').nodeTo; - - var maxX = fromNodeX; + + var maxX = fromNodeX; var maxY = fromNodeY; var minX = fromNodeX; var minY = fromNodeY; @@ -1005,45 +1003,44 @@ Metamaps.JIT = { //Find synapse-in-question's slope var synSlope = (toNodeY - fromNodeY) / (toNodeX - fromNodeX); var b = fromNodeY - synSlope * fromNodeX; + + //Use the selection box edges as test cases for synapse intersection + var testX = sX; + var testY = synSlope * testX + b; + + var selectTest; - var selectTest = false; - if (from.name == 'node 3' && to.name == 'node1'){ - console.log(from.pos.x,-1*from.pos.y,to.pos.x,-1*to.pos.y,sX,sY,eX,eY); - } - - - //if the synapse slope is within a range that would intersect with the selection box - if (synSlope <= maxSlope && synSlope >= minSlope){ - var testX = sX; - var testY = synSlope * testX + b; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ - selectTest = true; - } - - testX = eX; - testY = synSlope * testX + b; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ - selectTest = true; - } - - testY = sY; - testX = (testY - b)/synSlope; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ - selectTest = true; - } - - testY = eY; - testX = (testY - b)/synSlope; - - if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ - selectTest = true; - } + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ + selectTest = true; } - //console.log('From '+from.name + ' to ' + to.name + ' is a ' +selectTest); - //The test synapse was selected! + + testX = eX; + testY = synSlope * testX + b; + + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testY >= minBoxY && testY <= maxBoxY){ + selectTest = true; + } + + testY = sY; + testX = (testY - b)/synSlope; + + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ + selectTest = true; + } + + testY = eY; + testX = (testY - b)/synSlope; + + if(testX >= minX && testX <= maxX && testY >= minY && testY <= maxY && testX >= minBoxX && testX <= maxBoxX){ + selectTest = true; + } + + //Case where the synapse is wholly enclosed in the seldction box + if(fromNodeX >= minBoxX && fromNodeX <= maxBoxX && fromNodeY >= minBoxY && fromNodeY <= maxBoxY && toNodeX >= minBoxX && toNodeX <= maxBoxX && toNodeY >= minBoxY && toNodeY <= maxBoxY){ + selectTest = true; + } + + //The test synapse was selected! if(selectTest){ if(e.ctrlKey){ if(Metamaps.Selected.Edges.indexOf(synapse.get('edge')) != -1 ){ @@ -1520,7 +1517,6 @@ Metamaps.JIT = { var spanY = Math.abs(sY - eY); var ratioX = width / spanX; var ratioY = height / spanY; - console.log(ratioX,ratioY); var newRatio = Math.min(ratioX,ratioY); @@ -1536,11 +1532,7 @@ Metamaps.JIT = { else{ newRatio = 0.2/ canvas.scaleOffsetX; canvas.scale(newRatio,newRatio); - } - - - - + } var cogX = (sX + eX)/2; var cogY = (sY + eY)/2; @@ -1558,6 +1550,7 @@ Metamaps.JIT = { var height = $(document).height(), width = $(document).width(), maxX, minX, maxY, minY, counter = 0; + var canvas = Metamaps.Visualize.mGraph.canvas; if (Metamaps.Selected.Nodes.length > 0) { @@ -1581,7 +1574,7 @@ Metamaps.JIT = { var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), dim = n.getData('dim'), - ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); + ctx = canvas.getCtx(); var height = 25 * arrayOfLabelLines.length; @@ -1607,7 +1600,6 @@ Metamaps.JIT = { var newRatio = Math.max(ratioX,ratioY); var scaleMultiplier = 1/newRatio*0.9; - var canvas = Metamaps.Visualize.mGraph.canvas; if(canvas.scaleOffsetX *scaleMultiplier<= 3 && canvas.scaleOffsetX*scaleMultiplier >= 0.2){ canvas.scale(scaleMultiplier,scaleMultiplier); } @@ -1620,7 +1612,6 @@ Metamaps.JIT = { canvas.scale(scaleMultiplier,scaleMultiplier); } - counter = 0; nodes.forEach(function (n) { @@ -1636,7 +1627,7 @@ Metamaps.JIT = { var arrayOfLabelLines = Metamaps.Util.splitLine(n.name, 30).split('\n'), dim = n.getData('dim'), - ctx = Metamaps.Visualize.mGraph.canvas.getCtx(); + ctx = canvas.getCtx(); var height = 25 * arrayOfLabelLines.length; @@ -1653,12 +1644,21 @@ Metamaps.JIT = { counter++; }); + + var cogX = (maxX + minX)/2; + var cogY = (maxY + minY)/2; + + canvas.translate(-1* cogX, -1* cogY); + $(document).trigger(Metamaps.JIT.events.zoom, [event]); } + else if(nodes.length == 1){ + nodes.forEach(function (n) { + var x = n.pos.x, + y = n.pos.y; - var cogX = (maxX + minX)/2; - var cogY = (maxY + minY)/2; - - canvas.translate(-1* cogX, -1* cogY); - $(document).trigger(Metamaps.JIT.events.zoom, [event]); + canvas.translate(-1* x, -1* y); + $(document).trigger(Metamaps.JIT.events.zoom, [event]); + }); + } } }; \ No newline at end of file From 2b16123a4f5b62db1a922b0692727f2eb58299b6 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 10:45:08 -0400 Subject: [PATCH 10/12] fixed field type error on user edit form --- app/views/users/edit.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 82166dbf..069a28a4 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -15,8 +15,10 @@
    <%= @user.name %>
    -
    <%= form.label :name, "Name:", :class => "firstFieldText" %> - <%= form.email_field :name %>
    +
    + <%= form.label :name, "Name:", :class => "firstFieldText" %> + <%= form.text_field :name %> +
    <%= form.label :email, "Email:", :class => "firstFieldText" %> <%= form.email_field :email %>
    Change Password
    From 06f18215dd3484049845518366cc46c494791251 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 16:04:36 -0400 Subject: [PATCH 11/12] bug fixes for mapping experience. able to store multiple references to synapses on each edge --- app/assets/javascripts/src/JIT.js | 3 +- app/assets/javascripts/src/Metamaps.JIT.js | 40 ++++++--- app/assets/javascripts/src/Metamaps.Router.js | 1 + app/assets/javascripts/src/Metamaps.js | 83 +++++++++++++------ app/assets/stylesheets/application.css | 2 +- app/assets/stylesheets/clean.css | 8 ++ 6 files changed, 95 insertions(+), 42 deletions(-) diff --git a/app/assets/javascripts/src/JIT.js b/app/assets/javascripts/src/JIT.js index 1cc4b8e1..bc3f23c3 100644 --- a/app/assets/javascripts/src/JIT.js +++ b/app/assets/javascripts/src/JIT.js @@ -7081,7 +7081,8 @@ Graph.Plot = { var l = Metamaps.Mouse.synapseStartCoordinates.length; for (var i = l - 1; i >= 0; i -= 1) { start = Metamaps.Mouse.synapseStartCoordinates[i]; - Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.5, true); + Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.3, true); + Metamaps.JIT.renderMidArrow(start, end, 13, false, canvas, 0.7, true); } ctx.restore(); } diff --git a/app/assets/javascripts/src/Metamaps.JIT.js b/app/assets/javascripts/src/Metamaps.JIT.js index 41481c56..3c5b79c9 100644 --- a/app/assets/javascripts/src/Metamaps.JIT.js +++ b/app/assets/javascripts/src/Metamaps.JIT.js @@ -20,6 +20,7 @@ Metamaps.JIT = { */ prepareVizData: function () { var self = Metamaps.JIT; + var synapsesToRemove = []; var topic; var mapping; var node; @@ -39,7 +40,12 @@ Metamaps.JIT = { Metamaps.Synapses.each(function (s) { edge = s.createEdge(); - if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) { + if(Metamaps.Topics.get(s.get('node1_id')) === undefined || Metamaps.Topics.get(s.get('node2_id')) === undefined) { + // this means it's an invalid synapse + synapsesToRemove.push(s); + } + else if (nodes[edge.nodeFrom] && nodes[edge.nodeTo]) { + existingEdge = _.findWhere(edges, { nodeFrom: edge.nodeFrom, nodeTo: edge.nodeTo @@ -53,15 +59,24 @@ Metamaps.JIT = { // for when you're dealing with multiple relationships between the same two topics if (Metamaps.Active.Map) { mapping = s.getMapping(); - existingEdge['$mappingIDs'].push(mapping.isNew() ? mapping.cid : mapping.id); + existingEdge.data['$mappingIDs'].push(mapping.id); } - existingEdge['$synapseIDs'].push(s.id); + existingEdge.data['$synapseIDs'].push(s.id); } else { // for when you're dealing with a topic that has relationships to many different nodes nodes[edge.nodeFrom].adjacencies.push(edge); + edges.push(edge); } } }); + + // clean up the synapses array in case of any faulty data + _.each(synapsesToRemove, function (synapse) { + mapping = synapse.getMapping(); + Metamaps.Synapses.remove(synapse); + Metamaps.Mappings.remove(mapping); + }); + _.each(nodes, function (node) { self.vizData.push(node); }); @@ -319,7 +334,7 @@ Metamaps.JIT = { if (Metamaps.Mouse.boxStartCoordinates) { Metamaps.Visualize.mGraph.busy = false; Metamaps.Mouse.boxEndCoordinates = eventInfo.getPos(); - Metamaps.JIT.zoomToBox(); + Metamaps.JIT.zoomToBox(e); return; } @@ -816,8 +831,8 @@ Metamaps.JIT = { } else if (tempInit && tempNode2 != null) { // this means you want to create a synapse between two existing topics Metamaps.Create.newTopic.addSynapse = false; - Metamaps.Create.newSynapse.topic1id = tempNode.id; - Metamaps.Create.newSynapse.topic2id = tempNode2.id; + Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id; + Metamaps.Create.newSynapse.topic2id = tempNode2.getData('topic').id; tempNode2.setData('dim', 25, 'current'); Metamaps.Visualize.mGraph.plot(); midpoint.x = tempNode.pos.getc().x + (tempNode2.pos.getc().x - tempNode.pos.getc().x) / 2; @@ -1414,9 +1429,9 @@ Metamaps.JIT = { var v2 = intermediatePoint.$add(normal.$scale(-1)); if (newSynapse) { - ctx.strokeStyle = "#222222"; + ctx.strokeStyle = "#4fc059"; ctx.lineWidth = 2; - ctx.globalAlpha = 0.4; + ctx.globalAlpha = 1; } ctx.beginPath(); ctx.moveTo(from.x, from.y); @@ -1465,8 +1480,7 @@ Metamaps.JIT = { y: posChild.y }, 13, false, canvas, 0.7); } else if (directionCat == "from-to") { - var direction = adj.data.$direction; - var inv = (direction && direction.length > 1 && direction[0] != adj.nodeFrom.id); + var inv = (direction[0] != adj.nodeFrom.id); self.renderMidArrow({ x: pos.x, y: pos.y @@ -1502,7 +1516,7 @@ Metamaps.JIT = { canvas.translate(-1*offsetX,-1*offsetY); }, - zoomToBox: function () { + zoomToBox: function (event) { var sX = Metamaps.Mouse.boxStartCoordinates.x, sY = Metamaps.Mouse.boxStartCoordinates.y, eX = Metamaps.Mouse.boxEndCoordinates.x, @@ -1538,14 +1552,14 @@ Metamaps.JIT = { var cogY = (sY + eY)/2; canvas.translate(-1* cogX, -1* cogY); - + $(document).trigger(Metamaps.JIT.events.zoom, [event]); Metamaps.Mouse.boxStartCoordinates = false; Metamaps.Mouse.boxEndCoordinates = false; Metamaps.Visualize.mGraph.plot(); }, - zoomExtents: function () { + zoomExtents: function (event) { Metamaps.JIT.centerMap(); var height = $(document).height(), width = $(document).width(), diff --git a/app/assets/javascripts/src/Metamaps.Router.js b/app/assets/javascripts/src/Metamaps.Router.js index dadc3771..b8df146a 100644 --- a/app/assets/javascripts/src/Metamaps.Router.js +++ b/app/assets/javascripts/src/Metamaps.Router.js @@ -130,6 +130,7 @@ Metamaps.GlobalUI.Search.unlock(); Metamaps.GlobalUI.Search.close(0, true); + Metamaps.Loading.show(); Metamaps.Map.end(); Metamaps.Map.launch(id); }, diff --git a/app/assets/javascripts/src/Metamaps.js b/app/assets/javascripts/src/Metamaps.js index ba648acf..83ece7d7 100644 --- a/app/assets/javascripts/src/Metamaps.js +++ b/app/assets/javascripts/src/Metamaps.js @@ -217,15 +217,15 @@ Metamaps.Backbone.init = function () { else return false; }, getTopic1: function () { - return Metamaps.Topic.get(this.get('node1_id')); + return Metamaps.Topics.get(this.get('node1_id')); }, getTopic2: function () { - return Metamaps.Topic.get(this.get('node2_id')); + return Metamaps.Topics.get(this.get('node2_id')); }, getDirection: function () { return [ - this.get('node1_id'), - this.get('node2_id') + this.getTopic1().get('node').id, + this.getTopic2().get('node').id ]; }, getMapping: function () { @@ -1232,11 +1232,15 @@ Metamaps.Visualize = { topic.updateNode(); n.eachAdjacency(function (edge) { - l = edge.getData('synapseIDs').length; - for (i = 0; i < l; i++) { - synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); - synapse.set('edge', edge); - synapse.updateEdge(); + if(!edge.getData('init')) { + edge.setData('init', true); + + l = edge.getData('synapseIDs').length; + for (i = 0; i < l; i++) { + synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); + synapse.set('edge', edge); + synapse.updateEdge(); + } } }); @@ -1254,11 +1258,15 @@ Metamaps.Visualize = { mapping = topic.getMapping(); n.eachAdjacency(function (edge) { - l = edge.getData('synapseIDs').length; - for (i = 0; i < l; i++) { - synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); - synapse.set('edge', edge); - synapse.updateEdge(); + if(!edge.getData('init')) { + edge.setData('init', true); + + l = edge.getData('synapseIDs').length; + for (i = 0; i < l; i++) { + synapse = Metamaps.Synapses.get(edge.getData('synapseIDs')[i]); + synapse.set('edge', edge); + synapse.updateEdge(); + } } }); @@ -1274,7 +1282,6 @@ Metamaps.Visualize = { /** * render does the heavy lifting of creating the engine that renders the graph with the properties we desire * - * @param vizData a json structure containing the data to be rendered. */ render: function () { var self = Metamaps.Visualize, RGraphSettings, FDSettings; @@ -2902,6 +2909,8 @@ Metamaps.Topic = { var newnode = topic.createNode(); + var midpoint = {}, pixelPos; + if (!$.isEmptyObject(Metamaps.Visualize.mGraph.graph.nodes)) { Metamaps.Visualize.mGraph.graph.addNode(newnode); Metamaps.Visualize.mGraph.graph.eachNode(function (n) { @@ -2927,8 +2936,15 @@ Metamaps.Topic = { nodeOnViz.setPos(new $jit.Complex(mapping.get('xloc'), mapping.get('yloc')), "end"); } if (Metamaps.Create.newTopic.addSynapse) { - Metamaps.Create.newSynapse.topic1id = tempNode.id; - Metamaps.Create.newSynapse.topic2id = nodeOnViz.id; + Metamaps.Create.newSynapse.topic1id = tempNode.getData('topic').id; + + // position the form + midpoint.x = tempNode.pos.getc().x + (nodeOnViz.pos.getc().x - tempNode.pos.getc().x) / 2; + midpoint.y = tempNode.pos.getc().y + (nodeOnViz.pos.getc().y - tempNode.pos.getc().y) / 2; + pixelPos = Metamaps.Util.coordsToPixels(midpoint); + $('#new_synapse').css('left', pixelPos.x + "px"); + $('#new_synapse').css('top', pixelPos.y + "px"); + // show the form Metamaps.Create.newSynapse.open(); Metamaps.Visualize.mGraph.fx.animate({ modes: ["node-property:dim"], @@ -2970,14 +2986,21 @@ Metamaps.Topic = { }); } + + var successCallback = function (topicModel, response) { + if (Metamaps.Active.Map) { + mapping.save({ topic_id: topicModel.id }); + } + + if (Metamaps.Create.newTopic.addSynapse) { + Metamaps.Create.newSynapse.topic2id = topicModel.id; + } + }; + if (!Metamaps.Settings.sandbox && createNewInDB) { if (topic.isNew()) { topic.save(null, { - success: function (topicModel, response) { - if (Metamaps.Active.Map) { - mapping.save({ topic_id: topicModel.id }); - } - }, + success: successCallback, error: function (model, response) { console.log('error saving topic to database'); } @@ -3116,12 +3139,13 @@ Metamaps.Synapse = { //for each node in this array we will create a synapse going to the position2 node. var synapsesToCreate = []; - node2 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic2id); - topic2 = node2.getData('topic'); + topic2 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id); + node2 = topic2.get('node'); var len = Metamaps.Selected.Nodes.length; if (len == 0) { - synapsesToCreate[0] = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic1id); + topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id); + synapsesToCreate[0] = topic1.get('node'); } else if (len > 0) { synapsesToCreate = Metamaps.Selected.Nodes; } @@ -3150,6 +3174,8 @@ Metamaps.Synapse = { }, getSynapseFromAutocomplete: function (id) { var self = Metamaps.Synapse, + topic1, + topic2, node1, node2; @@ -3161,8 +3187,10 @@ Metamaps.Synapse = { }); Metamaps.Mappings.add(mapping); - node1 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic1id); - node2 = Metamaps.Visualize.mGraph.graph.getNode(Metamaps.Create.newSynapse.topic2id); + topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic1id); + node1 = topic1.get('node'); + topic1 = Metamaps.Topics.get(Metamaps.Create.newSynapse.topic2id); + node2 = topic2.get('node'); Metamaps.Create.newSynapse.hide(); self.renderSynapse(mapping, synapse, node1, node2, true); @@ -3220,6 +3248,7 @@ Metamaps.Map = { Metamaps.Filter.checkMappers(); Metamaps.Realtime.startActiveMap(); + Metamaps.Loading.hide(); } $.ajax({ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 8ae9967a..cebb5434 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -862,7 +862,7 @@ label[for="user_remember_me"] { .sidebarFilterBox { display:none; - width: 304px; + width: 319px; padding: 16px 0; overflow-y: auto; } diff --git a/app/assets/stylesheets/clean.css b/app/assets/stylesheets/clean.css index 918af0c3..06f7ea90 100644 --- a/app/assets/stylesheets/clean.css +++ b/app/assets/stylesheets/clean.css @@ -606,6 +606,14 @@ background-color: #9150bc; } +.github-fork-ribbon-wrapper { + display:none; +} + +.homePage .github-fork-ribbon-wrapper { + display: block; +} + /* end home page */ /* infoAndHelp */ From 2d2f98373efbc0709b8a54c9df22c5c0c42112c7 Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 29 Sep 2014 16:41:16 -0400 Subject: [PATCH 12/12] fixed error in _filterBox that was causing maps not to load when a synapse had a nil description --- app/views/shared/_filterBox.html.erb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/views/shared/_filterBox.html.erb b/app/views/shared/_filterBox.html.erb index 4ba9b91a..9f9f2cb7 100644 --- a/app/views/shared/_filterBox.html.erb +++ b/app/views/shared/_filterBox.html.erb @@ -33,9 +33,21 @@ end end - @metacodes.sort! {|x,y| x.name <=> y.name } - @synapses.sort! {|x,y| x.desc <=> y.desc } - @mappers.sort! {|x,y| x.name <=> y.name } + @metacodes.sort! {|x,y| + n1 = x.name || "" + n2 = y.name || "" + n1 <=> n2 + } + @synapses.sort! {|x,y| + d1 = x.desc || "" + d2 = y.desc || "" + d1 <=> d2 + } + @mappers.sort! {|x,y| + n1 = x.name || "" + n2 = y.name || "" + n1 <=> n2 + } @metacodes.each_with_index do |metacode, index| @metacodelist += '
  • '