diff --git a/app/assets/javascripts/Jit/ForceDirected/metamapFD.js b/app/assets/javascripts/Jit/ForceDirected/metamapFD.js
index fbcac2d6..695ba090 100644
--- a/app/assets/javascripts/Jit/ForceDirected/metamapFD.js
+++ b/app/assets/javascripts/Jit/ForceDirected/metamapFD.js
@@ -171,9 +171,17 @@ function initFD(){
});
// Build the right column relations list.
// This is done by traversing the clicked node connections.
- var html = '
-<%= form_for Item.new, url: items_path, remote: true do |form| %>
+<%= form_for Item.new, url: user_items_url(user), remote: true do |form| %>
close
Add Topic
Category
@@ -10,6 +10,8 @@
<%= form.text_area :desc, class: "description", :rows => 5 %>
Link
<%= form.text_field :link, class: "link" %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
<%= form.submit "Add Item", class: "addItem", id: "addItem" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/items/create.js.erb b/app/views/items/create.js.erb
index b6e67a44..0910f085 100644
--- a/app/views/items/create.js.erb
+++ b/app/views/items/create.js.erb
@@ -36,6 +36,10 @@ if (map2 != null) {
duration: 400
});
}
+ else {
+ json = newnode;
+ initFD();
+ }
// add the new node to the synapse select list
$("#node1_id").prepend("
-<%= form_for @item || Item.new, url: items_path do |form| %>
+<%= form_for @item || Item.new, url: user_items_path do |form| %>
Add Topic
Category
<%= select_tag "category", options_from_collection_for_select(ItemCategory.order("name ASC").all, "id", "name") %>
@@ -9,6 +9,8 @@
<%= form.text_area :desc, class: "description", :rows => 5 %>
Link
<%= form.text_field :link, class: "link" %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
<%= form.submit "Add Item", class: "add" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/items/show.html.erb b/app/views/items/show.html.erb
index f3de9ac6..eb13810b 100644
--- a/app/views/items/show.html.erb
+++ b/app/views/items/show.html.erb
@@ -1,11 +1,10 @@
-
<%= @item.item_category.name %>
<%= image_tag @item.item_category.icon, :class => 'icon', :size => '50x50' %>
-
<%= @item.name %> <% if @user %><%= link_to "[edit]", edit_item_path(@item) %><% end %>
+
<%= @item.name %> <% if authenticated? %><%= link_to "[edit]", edit_user_item_path(@user, @item) %><% end %>
@@ -34,5 +33,8 @@
});
-<%= render :partial => 'items/new' %>
-<%= render :partial => 'synapses/new' %>
+<% if authenticated? %>
+ <%= render :partial => 'items/new' %>
+ <%= render :partial => 'synapses/new' %>
+<% end %>
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 1cd23c83..e28d7ece 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -4,6 +4,8 @@
Metamaps
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
+
+
<%= csrf_meta_tags %>
@@ -52,20 +54,24 @@
<%= link_to "Login", new_session_path, id: "Login" %>
|
- <%= link_to "Topics", items_path %>
+ <%= link_to "Maps", allmaps_path %>
<% end %>
<% if authenticated? %>
<%= link_to "Logout", session_path, method: 'delete', id: "Login" %>
- <%= link_to "My Synapses", usersynapses_path %>
- <%= link_to "My Topics", userobjects_path %>
+ <%= link_to "Account", edit_user_url(user) %>
+ <%= link_to "My Maps", user_maps_url(user) %>
+ <%= link_to "My Synapses", user_synapses_url(user) %>
+ <%= link_to "My Topics", user_items_url(user) %>
|
- <%= link_to "Add Synapse", new_synapse_path, id: "newsynapse" %>
+ <%= link_to "Add Map", new_user_map_path(user), id: "newmap" %>
|
- <%= link_to "Add Topic", new_item_path, id: "newtopic" %>
+ <%= link_to "Add Synapse", new_user_synapse_path(user), id: "newsynapse" %>
|
- <%= link_to "Topics", items_path %>
+ <%= link_to "Add Topic", new_user_item_path(user), id: "newtopic" %>
+ |
+ <%= link_to "Maps", allmaps_path %>
<% end %>
diff --git a/app/views/main/allmaps.html.erb b/app/views/main/allmaps.html.erb
new file mode 100644
index 00000000..dbe8b55d
--- /dev/null
+++ b/app/views/main/allmaps.html.erb
@@ -0,0 +1,11 @@
+
All Maps
+
+
+ <% @maps.each do |map| %>
+ <%= render map %>
+ <% end %>
+ <% if @maps.empty? %>
+
Shucks, there are no maps.
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/main/home.html.erb b/app/views/main/home.html.erb
index 12363628..0f9e900c 100644
--- a/app/views/main/home.html.erb
+++ b/app/views/main/home.html.erb
@@ -18,6 +18,8 @@
Shucks, there is nothing in metamaps.
<% end %>
-<%= render :partial => 'items/new' %>
-<%= render :partial => 'synapses/new' %>
+<% if authenticated? %>
+ <%= render :partial => 'items/new' %>
+ <%= render :partial => 'synapses/new' %>
+<% end %>
diff --git a/app/views/maps/_map.html.erb b/app/views/maps/_map.html.erb
new file mode 100644
index 00000000..425115a0
--- /dev/null
+++ b/app/views/maps/_map.html.erb
@@ -0,0 +1,6 @@
+<%= div_for map do %>
+ <% if authenticated? %><%= link_to 'Delete', user_map_path(map.user,map), :class => 'delete', :confirm => 'Delete this map (nodes and synapses will remain)?', :method => :delete %><% end %>
+ <%= link_to map.name, user_map_path(map.user, map), :class => 'title' %>
+
<%= map.desc %>
# of Topics: <%= map.items.count %>
# of Synapses: <%= map.synapses.count %>
+
Permissions:<%= map.permission %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/maps/_newsynapse.html.erb b/app/views/maps/_newsynapse.html.erb
new file mode 100644
index 00000000..11760702
--- /dev/null
+++ b/app/views/maps/_newsynapse.html.erb
@@ -0,0 +1,21 @@
+
+ <%= form_for Synapse.new, url: user_synapses_url(user), remote: true do |form| %>
+ close
+
Add Synapse Between Topics
+ <%= hidden_field_tag(:category, "Item") %>
+ <% if Item.all.count > 0 %>
+ Choose First Item
+ <%= select_tag :node1_id, options_from_collection_for_select(Item.order("name ASC").all, "id", "name") %>
+ <% end %>
+ Describe The Connection
+ <%= form.text_field :desc, class: "description" %>
+ <% if Item.all.count > 0 %>
+ Choose Second Item
+ <%= select_tag :node2_id, options_from_collection_for_select(Item.order("name ASC").all, "id", "name") %>
+ <% end %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
+ <%= form.hidden_field :map, :value => @map.id %>
+ <%= form.submit "Add Synapse", class: "add" %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/maps/_newtopic.html.erb b/app/views/maps/_newtopic.html.erb
new file mode 100644
index 00000000..75fe05e3
--- /dev/null
+++ b/app/views/maps/_newtopic.html.erb
@@ -0,0 +1,18 @@
+
+<%= form_for Item.new, url: user_items_url(user), remote: true do |form| %>
+ close
+
Add Topic
+ Category
+ <%= select_tag "category", options_from_collection_for_select(ItemCategory.order("name ASC").all, "id", "name") %>
+ Title
+ <%= form.text_field :name %>
+ Description
+ <%= form.text_area :desc, class: "description", :rows => 5 %>
+ Link
+ <%= form.text_field :link, class: "link" %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
+ <%= form.hidden_field :map, :value => @map.id %>
+ <%= form.submit "Add Item", class: "addItem", id: "addItem" %>
+<% end %>
+
\ No newline at end of file
diff --git a/app/views/maps/edit.html.erb b/app/views/maps/edit.html.erb
new file mode 100644
index 00000000..3577aa6c
--- /dev/null
+++ b/app/views/maps/edit.html.erb
@@ -0,0 +1,10 @@
+<%= form_for @map, url: user_map_url(@user, @map) do |form| %>
+
Edit Map
+
Name
+ <%= form.text_field :name %>
+
Description
+ <%= form.text_area :desc, class: "description", :rows => 5 %>
+
Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private']), { :selected => @map.permission }) %>
+ <%= form.submit "Update", class: "update" %>
+<% end %>
diff --git a/app/views/maps/index.html.erb b/app/views/maps/index.html.erb
new file mode 100644
index 00000000..092b3438
--- /dev/null
+++ b/app/views/maps/index.html.erb
@@ -0,0 +1,11 @@
+
Maps
+
+
+ <% @maps.each do |map| %>
+ <%= render map %>
+ <% end %>
+ <% if @maps.empty? %>
+
Shucks, there are no maps.
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/maps/new.html.erb b/app/views/maps/new.html.erb
new file mode 100644
index 00000000..33a51e25
--- /dev/null
+++ b/app/views/maps/new.html.erb
@@ -0,0 +1,12 @@
+
+<%= form_for @map || Map.new, url: user_maps_url do |form|%>
+
Add Map
+ Name
+ <%= form.text_field :name %>
+ Description
+ <%= form.text_area :desc, class: "description", :rows => 5 %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
+ <%= form.submit "Add Map", class: "add" %>
+<% end %>
+
diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb
new file mode 100644
index 00000000..848fb6d3
--- /dev/null
+++ b/app/views/maps/show.html.erb
@@ -0,0 +1,37 @@
+
+
+
# of Topics: <%= @map.items.count %>
+
# of Synapses: <%= @map.synapses.count %>
+
+
+
<%= @map.name %> <% if authenticated? %><%= link_to "[edit]", edit_user_map_path(@user, @map) %><% end %>
+
+
+
+
Permissions:<%= @map.permission %>
+
+
+
+
+
+
+
+
+
+<%= render :partial => 'newtopic' %>
+<%= render :partial => 'newsynapse' %>
diff --git a/app/views/synapses/_new.html.erb b/app/views/synapses/_new.html.erb
index 535576cf..712f82f4 100644
--- a/app/views/synapses/_new.html.erb
+++ b/app/views/synapses/_new.html.erb
@@ -1,5 +1,5 @@
- <%= form_for Synapse.new, url: synapses_url, remote: true do |form| %>
+ <%= form_for Synapse.new, url: user_synapses_url(user), remote: true do |form| %>
close
Add Synapse Between Topics
<%= hidden_field_tag(:category, "Item") %>
@@ -13,6 +13,8 @@
Choose Second Item
<%= select_tag :node2_id, options_from_collection_for_select(Item.order("name ASC").all, "id", "name") %>
<% end %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
<%= form.submit "Add Synapse", class: "add" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/synapses/create.js.erb b/app/views/synapses/create.js.erb
index 960d500f..5b6906c1 100644
--- a/app/views/synapses/create.js.erb
+++ b/app/views/synapses/create.js.erb
@@ -6,7 +6,7 @@ map1 = document.getElementById('container');
if (map1 != null) {
- var mymap, newnode, select1, select2, option, temp1, temp2, temp;
+ var mymap, newnode, temp1, temp2, temp;
if (fd != null) {
mymap = fd;
}
@@ -14,69 +14,69 @@ if (map1 != null) {
mymap = rg;
}
- temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>);
- if (temp1 == null) {
- newnode = <%= @synapse.item1.self_as_json.html_safe %>;
- mymap.graph.addNode(newnode);
- temp = mymap.graph.getNode('<%= @synapse.item1.id %>');
- temp.setData('dim', 1, 'start');
- temp.setData('dim', 40, 'end');
- if (mymap == fd) {
- temp.setPos(new $jit.Complex(0, 0), 'current');
- temp.setPos(new $jit.Complex(0, 0), 'start');
- temp.setPos(new $jit.Complex(0, 0), 'end');
- }
- else if (mymap == rg) {
- temp.setPos(new $jit.Polar(5.54, 347.6), 'current');
- temp.setPos(new $jit.Polar(5.54, 347.6), 'start');
- temp.setPos(new $jit.Polar(5.54, 347.6), 'end');
- }
- mymap.fx.plotNode(temp, mymap.canvas);
- temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>);
- // add the new node to the synapse select list
- $("#node1_id").prepend("
<%= @synapse.item1.name %> ");
- $("#node2_id").prepend("
<%= @synapse.item1.name %> ");
+ if (mymap == fd || mymap == rg) {
+ temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>);
+ if (temp1 == null) {
+ newnode = <%= @synapse.item1.self_as_json.html_safe %>;
+ mymap.graph.addNode(newnode);
+ temp = mymap.graph.getNode('<%= @synapse.item1.id %>');
+ temp.setData('dim', 1, 'start');
+ temp.setData('dim', 40, 'end');
+ if (mymap == fd) {
+ temp.setPos(new $jit.Complex(0, 0), 'current');
+ temp.setPos(new $jit.Complex(0, 0), 'start');
+ temp.setPos(new $jit.Complex(0, 0), 'end');
+ }
+ else if (mymap == rg) {
+ temp.setPos(new $jit.Polar(5.54, 347.6), 'current');
+ temp.setPos(new $jit.Polar(5.54, 347.6), 'start');
+ temp.setPos(new $jit.Polar(5.54, 347.6), 'end');
+ }
+ mymap.fx.plotNode(temp, mymap.canvas);
+ temp1 = mymap.graph.getNode(<%= @synapse.item1.id %>);
+ }
+ temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>);
+ if (temp2 == null) {
+ newnode = <%= @synapse.item2.self_as_json.html_safe %>;
+ mymap.graph.addNode(newnode);
+ temp = mymap.graph.getNode('<%= @synapse.item2.id %>');
+ temp.setData('dim', 1, 'start');
+ temp.setData('dim', 40, 'end');
+ if (mymap == fd) {
+ temp.setPos(new $jit.Complex(0, 0), 'current');
+ temp.setPos(new $jit.Complex(0, 0), 'start');
+ temp.setPos(new $jit.Complex(0, 0), 'end');
+ }
+ else if (mymap == rg) {
+ temp.setPos(new $jit.Polar(5.54, 347.6), 'current');
+ temp.setPos(new $jit.Polar(5.54, 347.6), 'start');
+ temp.setPos(new $jit.Polar(5.54, 347.6), 'end');
+ }
+ mymap.fx.plotNode(temp, mymap.canvas);
+ temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>);
+ }
+ mymap.graph.addAdjacence(temp1, temp2, {});
+ temp = mymap.graph.getAdjacence(temp1.id, temp2.id);
+ temp.setDataset('start', {
+ lineWidth: 0.4,
+ color: '#d1d1d1'
+ });
+ temp.setDataset('end', {
+ lineWidth: 3,
+ color: '#36acfb'
+ });
+ temp.setDataset('current', {
+ desc: '<%= @synapse.desc %>',
+ category: '<%= @synapse.category %>'
+ });
+ mymap.fx.plotLine(temp, mymap.canvas);
+ mymap.fx.animate({
+ modes: ['node-property:dim','edge-property:lineWidth:color'],
+ duration: 400
+ });
}
- temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>);
- if (temp2 == null) {
- newnode = <%= @synapse.item2.self_as_json.html_safe %>;
- mymap.graph.addNode(newnode);
- temp = mymap.graph.getNode('<%= @synapse.item2.id %>');
- temp.setData('dim', 1, 'start');
- temp.setData('dim', 40, 'end');
- if (mymap == fd) {
- temp.setPos(new $jit.Complex(0, 0), 'current');
- temp.setPos(new $jit.Complex(0, 0), 'start');
- temp.setPos(new $jit.Complex(0, 0), 'end');
- }
- else if (mymap == rg) {
- temp.setPos(new $jit.Polar(5.54, 347.6), 'current');
- temp.setPos(new $jit.Polar(5.54, 347.6), 'start');
- temp.setPos(new $jit.Polar(5.54, 347.6), 'end');
- }
- mymap.fx.plotNode(temp, mymap.canvas);
- temp2 = mymap.graph.getNode(<%= @synapse.item2.id %>);
- // add the new node to the synapse select list
- $("#node1_id").prepend("
<%= @synapse.item2.name %> ");
- $("#node2_id").prepend("
<%= @synapse.item2.name %> ");
+ else {
+ json = <%= @synapse.selfplusnodes_as_json.html_safe %>
+ initFD();
}
- mymap.graph.addAdjacence(temp1, temp2, {});
- temp = mymap.graph.getAdjacence(temp1.id, temp2.id);
- temp.setDataset('start', {
- lineWidth: 0.4,
- color: '#d1d1d1'
- });
- temp.setDataset('end', {
- lineWidth: 3,
- color: '#36acfb'
- });
- temp.setDataset('current', {
- desc: '<%= @synapse.desc %>',
- category: '<%= @synapse.category %>'
- });
- mymap.fx.plotLine(temp, mymap.canvas);
- mymap.fx.animate({
- modes: ['node-property:dim','edge-property:lineWidth:color'],
- duration: 400
- });
}
\ No newline at end of file
diff --git a/app/views/synapses/edit.html.erb b/app/views/synapses/edit.html.erb
index c681a896..e182d4f9 100644
--- a/app/views/synapses/edit.html.erb
+++ b/app/views/synapses/edit.html.erb
@@ -1,4 +1,4 @@
-<%= form_for @synapse, url: synapse_url do |form| %>
+<%= form_for @synapse, url: user_synapse_url do |form| %>
Edit Synapse
<% if @collection.count > 0 %>
Choose First <%= @synapse.category %>
@@ -10,5 +10,7 @@
Choose Second <%= @synapse.category %>
<%= select "node2_id", "node2", @collection.order("name ASC").map {|p| [ p.name, p.id ] }, { :selected => @synapse.node2_id } %>
<% end %>
+
Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
<%= form.submit "Update", class: "update" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/synapses/index.html.erb b/app/views/synapses/index.html.erb
index 1c76b5d2..88002110 100644
--- a/app/views/synapses/index.html.erb
+++ b/app/views/synapses/index.html.erb
@@ -1,11 +1,20 @@
-
Synapses
-
-
- <% @synapses.each do |synapse| %>
- <%= render synapse %>
- <% end %>
- <% if @synapses.empty? %>
-
Shucks, there are no synapses.
- <% end %>
+
+
+
+
+<% if authenticated? %>
+ <%= render :partial => 'items/new' %>
+ <%= render :partial => 'synapses/new' %>
+<% end %>
diff --git a/app/views/synapses/new.html.erb b/app/views/synapses/new.html.erb
index d4e652c0..1cb598e4 100644
--- a/app/views/synapses/new.html.erb
+++ b/app/views/synapses/new.html.erb
@@ -1,5 +1,5 @@
- <%= form_for @synapse, url: synapses_url do |form| %>
+ <%= form_for @synapse, url: user_synapses_url do |form| %>
Add Synapse Between Topics
<%= hidden_field_tag(:category, "Item") %>
<% if Item.all.count > 0 %>
@@ -12,6 +12,8 @@
Choose Second Item
<%= select_tag :node2_id, options_from_collection_for_select(Item.order("name ASC").all, "id", "name") %>
<% end %>
+ Permission
+ <%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
<%= form.submit "Add Synapse", class: "add" %>
<% end %>
\ No newline at end of file
diff --git a/app/views/synapses/show.html.erb b/app/views/synapses/show.html.erb
index 9f7f67a0..2720bfb1 100644
--- a/app/views/synapses/show.html.erb
+++ b/app/views/synapses/show.html.erb
@@ -13,4 +13,9 @@
$(document).ready(function() {
initFD();
});
-
\ No newline at end of file
+
+
+<% if authenticated? %>
+ <%= render :partial => 'items/new' %>
+ <%= render :partial => 'synapses/new' %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index e69de29b..e5185ea2 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -0,0 +1,7 @@
+<%= formula_form_for @user, url: user_url do |form| %>
+
Edit Account
+ <%= form.input :name, label: "Name", class: "name" %>
+ <%= form.input :email, label: "Email", class: "email" %>
+ <%= form.input :password, label: "Password", class: "password" %>
+ <%= form.submit "Update", class: "update" %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index 3e36ec4a..e7c273a7 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -1,4 +1,4 @@
-<%= formula_form_for @user, url: user_url do |form| %>
+<%= formula_form_for @user, url: users_url do |form| %>
Create Account
<%= form.input :name, label: "Name", class: "name" %>
<%= form.input :email, label: "Email", class: "email" %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index e69de29b..cd1902f1 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -0,0 +1,18 @@
+
+
+
# of Topics: <%= @user.items.count %>
+
# of Synapses: <%= @user.synapses.count %>
+
# of Maps: <%= @user.maps.count %>
+
+
+
<%= @user.name %>
+
+
<%= link_to "View their topics", user_items_path(@user)%>
+
<%= link_to "View their synapses", user_synapses_path(@user)%>
+
<%= link_to "View their maps", user_maps_path(@user) %>
+
+
+
+
+
+
diff --git a/config/database.yml b/config/database.yml
index f53b7940..8129268a 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,14 +1,25 @@
+#development:
+# min_messages: WARNING
+# adapter: postgresql
+# host: ec2-54-243-188-58.compute-1.amazonaws.com
+# port: 5442
+# encoding: unicode
+# database: da81fvorvn5pp9
+# pool: 5
+# username: yolhqgtlivenrk
+# password: "oi_EAZwbXboYjqB_9tWPh2x5YS"
+
development:
min_messages: WARNING
adapter: postgresql
- host: ec2-54-243-188-58.compute-1.amazonaws.com
- port: 5442
+ host: 127.0.0.1
+ port: 5432
encoding: unicode
- database: da81fvorvn5pp9
+ database: metamap002_development
pool: 5
- username: yolhqgtlivenrk
- password: "oi_EAZwbXboYjqB_9tWPh2x5YS"
-
+ username: postgres
+ password: "3112"
+
test:
min_messages: WARNING
adapter: postgresql
diff --git a/config/routes.rb b/config/routes.rb
index 8a35d982..ee5f2e24 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -2,16 +2,15 @@ ISSAD::Application.routes.draw do
root to: 'main#home', via: :get
- match 'my-topics', to: 'main#userobjects', via: :get, as: :userobjects
- match 'my-synapses', to: 'main#usersynapses', via: :get, as: :usersynapses
+ match 'maps', to: 'main#allmaps', via: :get, as: :allmaps
- resource :user
resource :session
- resources :items
- resources :people
- resources :groups
- resources :synapses
+ resources :users do
+ resources :items
+ resources :synapses
+ resources :maps
+ end
# The priority is based upon order of creation:
# first created -> highest priority.
diff --git a/db/migrate/20120920014810_create_items.rb b/db/migrate/20120920014810_create_items.rb
index 7e98f63e..20457350 100644
--- a/db/migrate/20120920014810_create_items.rb
+++ b/db/migrate/20120920014810_create_items.rb
@@ -4,6 +4,7 @@ class CreateItems < ActiveRecord::Migration
t.text :name
t.text :desc
t.text :link
+ t.text :permission
t.integer :user_id
t.integer :item_category_id
diff --git a/db/migrate/20121005160234_create_synapses.rb b/db/migrate/20121005160234_create_synapses.rb
index 28c6f599..17b1f5a3 100644
--- a/db/migrate/20121005160234_create_synapses.rb
+++ b/db/migrate/20121005160234_create_synapses.rb
@@ -3,6 +3,8 @@ class CreateSynapses < ActiveRecord::Migration
create_table :synapses 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
diff --git a/db/migrate/20121023231434_create_maps.rb b/db/migrate/20121023231434_create_maps.rb
index 628e032f..2266067a 100644
--- a/db/migrate/20121023231434_create_maps.rb
+++ b/db/migrate/20121023231434_create_maps.rb
@@ -1,7 +1,10 @@
class CreateMaps < ActiveRecord::Migration
def change
create_table :maps do |t|
-
+ t.text :name
+ t.text :desc
+ t.text :permission
+ t.integer :user_id
t.timestamps
end
end
diff --git a/db/migrate/20121025234111_add_permission_to_item.rb b/db/migrate/20121025234111_add_permission_to_item.rb
new file mode 100644
index 00000000..0b8fb156
--- /dev/null
+++ b/db/migrate/20121025234111_add_permission_to_item.rb
@@ -0,0 +1,10 @@
+class AddPermissionToItem < ActiveRecord::Migration
+ def self.up
+ add_column :items, :permission, :text
+ Item.update_all ["permission = ?", "commons"]
+ end
+
+ def self.down
+ remove_column :items, :permission
+ end
+end
diff --git a/db/migrate/20121025234344_add_permission_to_synapse.rb b/db/migrate/20121025234344_add_permission_to_synapse.rb
new file mode 100644
index 00000000..8bea0c03
--- /dev/null
+++ b/db/migrate/20121025234344_add_permission_to_synapse.rb
@@ -0,0 +1,13 @@
+class AddPermissionToSynapse < ActiveRecord::Migration
+ def self.up
+ add_column :synapses, :permission, :text
+ add_column :synapses, :weight, :text
+ Synapse.update_all ["permission = ?", "commons"]
+ Synapse.update_all ["weight = ?", "5"]
+ end
+
+ def self.down
+ remove_column :synapses, :permission
+ remove_column :synapses, :weight
+ end
+end
diff --git a/db/migrate/20121026000731_create_mappings.rb b/db/migrate/20121026000731_create_mappings.rb
new file mode 100644
index 00000000..b03ee426
--- /dev/null
+++ b/db/migrate/20121026000731_create_mappings.rb
@@ -0,0 +1,14 @@
+class CreateMappings < ActiveRecord::Migration
+ def change
+ create_table :mappings 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.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 5e30d2b0..0b29163d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,54 +1,78 @@
-# 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 => 20121005160234) 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.integer "user_id"
- t.integer "item_category_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.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 "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 => 20121026064859) 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.integer "user_id"
+ t.integer "item_category_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "permission"
+ end
+
+ create_table "mappings", :force => true do |t|
+ t.text "category"
+ t.integer "xloc"
+ t.integer "yloc"
+ t.integer "map_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "item_id"
+ t.integer "synapse_id"
+ end
+
+ create_table "maps", :force => true do |t|
+ t.text "name"
+ t.text "desc"
+ t.text "permission"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "user_id"
+ end
+
+ create_table "synapses", :force => true do |t|
+ t.text "desc"
+ t.text "category"
+ t.integer "node1_id"
+ t.integer "node2_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "permission"
+ t.text "weight"
+ end
+
+ create_table "users", :force => true do |t|
+ t.string "name"
+ t.string "email"
+ 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
diff --git a/test/fixtures/mappings.yml b/test/fixtures/mappings.yml
new file mode 100644
index 00000000..c63aac0b
--- /dev/null
+++ b/test/fixtures/mappings.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
diff --git a/test/functional/maps_controller_test.rb b/test/functional/maps_controller_test.rb
new file mode 100644
index 00000000..9517ea55
--- /dev/null
+++ b/test/functional/maps_controller_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class MapsControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/unit/helpers/maps_helper_test.rb b/test/unit/helpers/maps_helper_test.rb
new file mode 100644
index 00000000..0a0efccd
--- /dev/null
+++ b/test/unit/helpers/maps_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class MapsHelperTest < ActionView::TestCase
+end
diff --git a/test/unit/mapping_test.rb b/test/unit/mapping_test.rb
new file mode 100644
index 00000000..20115809
--- /dev/null
+++ b/test/unit/mapping_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class MappingTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end