From 31ab10b3387ebc92a214ec24922ae7cafc39f41e Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 9 Dec 2012 19:43:53 -0500 Subject: [PATCH 1/3] Revert "fixed bug that wasn't letting you save the layout of a map if you had added new synapses to it." This reverts commit 698690effd8e2b421683ab3d2e0a359c4f4965ea. --- app/controllers/synapses_controller.rb | 2 +- app/views/synapses/create.js.erb | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index 1d0d2225..08ab27dd 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -89,7 +89,7 @@ class SynapsesController < ApplicationController respond_to do |format| format.html { respond_with(@user, location: user_synapse_url(@user, @synapse)) } - format.js { respond_with(@synapse, @mapping1, @mapping2) } + format.js { respond_with(@synapse) } end end diff --git a/app/views/synapses/create.js.erb b/app/views/synapses/create.js.erb index 134b9ab4..05a73133 100644 --- a/app/views/synapses/create.js.erb +++ b/app/views/synapses/create.js.erb @@ -18,7 +18,7 @@ if (map1 != null) { mymap = map; } - if (mymap == fd || mymap == rg || mymap == map) { + if (mymap == fd || mymap == rg || mymap = map) { temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>); if (temp1 == null) { newnode = <%= @synapse.item1.self_as_json.html_safe %>; @@ -36,11 +36,6 @@ if (map1 != null) { temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } - <% unless (@mapping1.nil?) %> - temp.setData('xloc',0); - temp.setData('yloc',0); - temp.setData('mappingid', '<%= @mapping1.id %>'); - <% end %> mymap.fx.plotNode(temp, mymap.canvas); temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>); } @@ -61,11 +56,6 @@ if (map1 != null) { temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } - <% unless (@mapping2.nil?) %> - temp.setData('xloc',0); - temp.setData('yloc',0); - temp.setData('mappingid', '<%= @mapping2.id %>'); - <% end %> mymap.fx.plotNode(temp, mymap.canvas); temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>); } From 7e1610147aabf7c6c3dd10bbd7a0aa6627eabe7c Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 9 Dec 2012 19:44:18 -0500 Subject: [PATCH 2/3] Revert "removed 20121203225613_add_arranged_to_map.rb" This reverts commit baaa746a478eddc4bc3872aed858bfe94f4d8293. --- app/assets/stylesheets/items.css.scss | 13 +- config/database.yml | 2 + .../20121203225613_add_arranged_to_map.rb | 6 + db/schema.rb | 162 +++++++++--------- 4 files changed, 90 insertions(+), 93 deletions(-) create mode 100644 db/migrate/20121203225613_add_arranged_to_map.rb diff --git a/app/assets/stylesheets/items.css.scss b/app/assets/stylesheets/items.css.scss index e0402e36..a8f73290 100644 --- a/app/assets/stylesheets/items.css.scss +++ b/app/assets/stylesheets/items.css.scss @@ -29,21 +29,10 @@ line-height: 24px;} .item .icon { position:absolute; top:135px; left:-25px; } -.item .title { - font-size:22px; - line-height:25px; - display:block; - border-bottom:2px solid #000; - padding-bottom:5px; -} +.item .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; } .item .desc { font-size:15px; font-family:Arial, Helvetica, sans-serif; } .item .desc h3 { font-style:normal; margin-top:5px; } .item .link { position:absolute; width:170px; top:295px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.item .add-synapse { - position: absolute; - bottom: 48%; - right: 0.3em; -} diff --git a/config/database.yml b/config/database.yml index 24d22eda..6705ca8f 100644 --- a/config/database.yml +++ b/config/database.yml @@ -6,6 +6,8 @@ development: encoding: unicode database: metamap002_development pool: 5 + username: postgres + password: "3112" production: min_messages: WARNING diff --git a/db/migrate/20121203225613_add_arranged_to_map.rb b/db/migrate/20121203225613_add_arranged_to_map.rb new file mode 100644 index 00000000..f5a88665 --- /dev/null +++ b/db/migrate/20121203225613_add_arranged_to_map.rb @@ -0,0 +1,6 @@ +class AddArrangedToMap < ActiveRecord::Migration + def change + add_column :maps, :arranged, :boolean + Map.update_all ["arranged = ?", false] + end +end diff --git a/db/schema.rb b/db/schema.rb index b1835047..c4f01152 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,81 +1,81 @@ -# 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 => 20121026000731) do - - create_table "item_categories", :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 "items", :force => true do |t| - t.text "name" - t.text "desc" - t.text "link" - t.text "permission" - t.integer "user_id" - t.integer "item_category_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "mappings", :force => true do |t| - t.text "category" - t.integer "xloc" - t.integer "yloc" - t.integer "item_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 - 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 "users", :force => true do |t| - t.string "name" - t.string "email" - 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 - end - -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 => 20121203225613) do + + create_table "item_categories", :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 "items", :force => true do |t| + t.text "name" + t.text "desc" + t.text "link" + t.text "permission" + t.integer "user_id" + t.integer "item_category_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "mappings", :force => true do |t| + t.text "category" + t.integer "xloc" + t.integer "yloc" + t.integer "item_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.text "desc" + t.text "permission" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "arranged" + 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 "users", :force => true do |t| + t.string "name" + t.string "email" + 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 + end + +end From dd8e421cd467ae1795733b919a20547560504f14 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 9 Dec 2012 19:44:50 -0500 Subject: [PATCH 3/3] Revert "Revert "fixed bug that wasn't letting you save the layout of a map if you had added new synapses to it."" This reverts commit 31ab10b3387ebc92a214ec24922ae7cafc39f41e. --- app/controllers/synapses_controller.rb | 2 +- app/views/synapses/create.js.erb | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index 08ab27dd..1d0d2225 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -89,7 +89,7 @@ class SynapsesController < ApplicationController respond_to do |format| format.html { respond_with(@user, location: user_synapse_url(@user, @synapse)) } - format.js { respond_with(@synapse) } + format.js { respond_with(@synapse, @mapping1, @mapping2) } end end diff --git a/app/views/synapses/create.js.erb b/app/views/synapses/create.js.erb index 05a73133..134b9ab4 100644 --- a/app/views/synapses/create.js.erb +++ b/app/views/synapses/create.js.erb @@ -18,7 +18,7 @@ if (map1 != null) { mymap = map; } - if (mymap == fd || mymap == rg || mymap = map) { + if (mymap == fd || mymap == rg || mymap == map) { temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>); if (temp1 == null) { newnode = <%= @synapse.item1.self_as_json.html_safe %>; @@ -36,6 +36,11 @@ if (map1 != null) { temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } + <% unless (@mapping1.nil?) %> + temp.setData('xloc',0); + temp.setData('yloc',0); + temp.setData('mappingid', '<%= @mapping1.id %>'); + <% end %> mymap.fx.plotNode(temp, mymap.canvas); temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>); } @@ -56,6 +61,11 @@ if (map1 != null) { temp.setPos(new $jit.Polar(5.54, 347.6), 'start'); temp.setPos(new $jit.Polar(5.54, 347.6), 'end'); } + <% unless (@mapping2.nil?) %> + temp.setData('xloc',0); + temp.setData('yloc',0); + temp.setData('mappingid', '<%= @mapping2.id %>'); + <% end %> mymap.fx.plotNode(temp, mymap.canvas); temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>); }