initial commit

This commit is contained in:
Connor Turland 2012-10-17 20:51:54 -04:00
parent c5d080b9a2
commit 775d97cdbb
27 changed files with 286 additions and 409 deletions

View file

@ -10,6 +10,7 @@ var labelType, useGradients, nativeTextSupport, animate, json;
//I'm setting this based on the fact that ExCanvas provides text support for IE
//and that as of today iPhone/iPad current text support is lame
labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML';
console.log(labelType);
nativeTextSupport = labelType == 'Native';
useGradients = nativeCanvasSupport;
animate = !(iStuff || !nativeCanvasSupport);
@ -25,9 +26,56 @@ var Log = {
}
};
var imgArray = new Object();
imgArray['Group'] = new Image(); imgArray['Group'].src = '/assets/group.png';
imgArray['Person'] = new Image(); imgArray['Person'].src = '/assets/person.png';
imgArray['Bizarre'] = new Image(); imgArray['Bizarre'].src = '/assets/bizarre.png';
imgArray['Catalyst'] = new Image(); imgArray['Catalyst'].src = '/assets/catalyst.png';
imgArray['Closed'] = new Image(); imgArray['Closed'].src = '/assets/closed.png';
imgArray['Experience'] = new Image(); imgArray['Experience'].src = '/assets/experience.png';
imgArray['Future Dev'] = new Image(); imgArray['Future Dev'].src = '/assets/futuredev.png';
imgArray['Idea'] = new Image(); imgArray['Idea'].src = '/assets/idea.png';
imgArray['Implication'] = new Image(); imgArray['Implication'].src = '/assets/implication.png';
imgArray['Insight'] = new Image(); imgArray['Insight'].src = '/assets/insight.png';
imgArray['Intention'] = new Image(); imgArray['Intention'].src = '/assets/intention.png';
imgArray['Knowledge'] = new Image(); imgArray['Knowledge'].src = '/assets/knowledge.png';
imgArray['Location'] = new Image(); imgArray['Location'].src = '/assets/location.png';
imgArray['Open Issue'] = new Image(); imgArray['Open Issue'].src = '/assets/openissue.png';
imgArray['Opinion'] = new Image(); imgArray['Opinion'].src = '/assets/opinion.png';
imgArray['Opportunity'] = new Image(); imgArray['Opportunity'].src = '/assets/opportunity.png';
imgArray['Platform'] = new Image(); imgArray['Platform'].src = '/assets/platform.png';
imgArray['Problem'] = new Image(); imgArray['Problem'].src = '/assets/problem.png';
imgArray['Question'] = new Image(); imgArray['Question'].src = '/assets/question.png';
imgArray['Reference'] = new Image(); imgArray['Reference'].src = '/assets/reference.png';
imgArray['Requirement'] = new Image(); imgArray['Requirement'].src = '/assets/requirement.png';
imgArray['Resource'] = new Image(); imgArray['Resource'].src = '/assets/resource.png';
imgArray['Role'] = new Image(); imgArray['Role'].src = '/assets/role.png';
imgArray['Task'] = new Image(); imgArray['Task'].src = '/assets/task.png';
imgArray['Tool'] = new Image(); imgArray['Tool'].src = '/assets/tool.png';
imgArray['Trajectory'] = new Image(); imgArray['Trajectory'].src = '/assets/trajectory.png';
imgArray['Action'] = new Image(); imgArray['Action'].src = '/assets/action.png';
imgArray['Activity'] = new Image(); imgArray['Activity'].src = '/assets/activity.png';
function init(){
// init data
// init custom node type
$jit.ForceDirected.Plot.NodeTypes.implement({
'customNode': {
'render': function (node, canvas) {
var pos = node.pos.getc(true),
dim = node.getData('dim'),
cat = node.getData('itemcatname'),
ctx = canvas.getCtx();
ctx.drawImage(imgArray[cat], pos.x - dim, pos.y - dim, dim*2, dim*2);
},
'contains': function(node, pos) {
var npos = node.pos.getc(true),
dim = node.getData('dim');
return this.nodeHelper.circle.contains(npos, pos, dim);
}
}
});
// end
// init ForceDirected
var fd = new $jit.ForceDirected({
@ -37,6 +85,7 @@ function init(){
//by scrolling and DnD
Navigation: {
enable: true,
type: 'HTML',
//Enable panning events only if we're dragging the empty
//canvas (and not a node).
panning: 'avoid nodes',
@ -50,8 +99,8 @@ function init(){
Node: {
overridable: true,
color: '#2D6A5D',
type: 'circle',
dim: 15
type: 'customNode',
dim: 25
},
Edge: {
overridable: true,
@ -60,8 +109,8 @@ function init(){
},
//Native canvas text styling
Label: {
type: labelType, //Native or HTML
size: 17,
type: 'HTML', //Native or HTML
size: 20,
//style: 'bold'
},
//Add Tips
@ -79,12 +128,13 @@ function init(){
// Add node events
Events: {
enable: true,
type: 'HTML',
//Change cursor style when hovering a node
onMouseEnter: function() {
fd.canvas.getElement().style.cursor = 'move';
//fd.canvas.getElement().style.cursor = 'move';
},
onMouseLeave: function() {
fd.canvas.getElement().style.cursor = '';
//fd.canvas.getElement().style.cursor = '';
},
//Update node positions when dragged
onDragMove: function(node, eventInfo, e) {
@ -100,15 +150,40 @@ function init(){
//Add also a click handler to nodes
onClick: function(node) {
if(!node) return;
//set final styles
fd.graph.eachNode(function(n) {
if(n.id != node.id) delete n.selected;
n.setData('dim', 25, 'end');
n.eachAdjacency(function(adj) {
adj.setDataset('end', {
lineWidth: 0.4,
color: '#d1d1d1'
});
});
});
if(!node.selected) {
node.selected = true;
node.setData('dim', 35, 'end');
node.eachAdjacency(function(adj) {
adj.setDataset('end', {
lineWidth: 3,
color: '#36acfb'
});
});
} else {
delete node.selected;
}
//trigger animation to final styles
fd.fx.animate({
modes: ['node-property:dim',
'edge-property:lineWidth:color'],
duration: 500
});
// Build the right column relations list.
// This is done by traversing the clicked node connections.
var html = "<h4>" + node.name + "</h4><b>has connections to:</b><ul><li>",
list = [];
node.eachAdjacency(function(adj){
list.push(adj.nodeTo.name);
});
var html = '<div class="item" id="item_' + node.id + '"><p class="type">' + node.getData("itemcatname") + '</p><img alt="' + node.getData("itemcatname") + '" class="icon" height="50" src="' + imgArray[node.getData("itemcatname")].src + '" width="50" /><a href="http://localhost:3000/items/' + node.id + '" class="title">' + node.name + '</a><div class="desc"><p>' + node.getData('desc') + '</p></div><a href="' + node.getData('link') + '" class="link" target="_blank">' + node.getData('link') + '</a></div>';
//append connections information
$jit.id('inner-details').innerHTML = html + list.join("</li><li>") + "</li></ul>";
$jit.id('inner-details').innerHTML = html;
}
},
//Number of iterations for the FD algorithm
@ -117,12 +192,74 @@ function init(){
levelDistance: 130,
// Add text to the labels. This method is only triggered
// on label creation and only for DOM labels (not native canvas ones).
onCreateLabel: function(domElement, node){
domElement.innerHTML = node.name;
var style = domElement.style;
style.fontSize = "0.9em";
style.color = "#fff";
},
onCreateLabel: function(domElement, node){
// Create a 'name' and 'close' buttons and add them
// to the main node label
var nameContainer = document.createElement('span'),
closeButton = document.createElement('span'),
style = nameContainer.style;
nameContainer.className = 'name';
nameContainer.innerHTML = node.name;
closeButton.className = 'close';
closeButton.innerHTML = 'x';
domElement.appendChild(nameContainer);
domElement.appendChild(closeButton);
style.fontSize = "0.9em";
style.color = "#ddd";
//Fade the node and its connections when
//clicking the close button
closeButton.onclick = function() {
node.setData('alpha', 0, 'end');
node.eachAdjacency(function(adj) {
adj.setData('alpha', 0, 'end');
});
fd.fx.animate({
modes: ['node-property:alpha',
'edge-property:alpha'],
duration: 500
});
};
//Toggle a node selection when clicking
//its name. This is done by animating some
//node styles like its dimension and the color
//and lineWidth of its adjacencies.
nameContainer.onclick = function() {
//set final styles
fd.graph.eachNode(function(n) {
if(n.id != node.id) delete n.selected;
n.setData('dim', 25, 'end');
n.eachAdjacency(function(adj) {
adj.setDataset('end', {
lineWidth: 0.4,
color: '#d1d1d1'
});
});
});
if(!node.selected) {
node.selected = true;
node.setData('dim', 35, 'end');
node.eachAdjacency(function(adj) {
adj.setDataset('end', {
lineWidth: 3,
color: '#36acfb'
});
});
} else {
delete node.selected;
}
//trigger animation to final styles
fd.fx.animate({
modes: ['node-property:dim',
'edge-property:lineWidth:color'],
duration: 500
});
// Build the right column relations list.
// This is done by traversing the clicked node connections.
var html = '<div class="item" id="item_' + node.id + '"><p class="type">' + node.getData("itemcatname") + '</p><img alt="' + node.getData("itemcatname") + '" class="icon" height="50" src="' + imgArray[node.getData("itemcatname")].src + '" width="50" /><a href="http://localhost:3000/items/' + node.id + '" class="title">' + node.name + '</a><div class="desc"><p>' + node.getData('desc') + '</p></div><a href="' + node.getData('link') + '" class="link" target="_blank">' + node.getData('link') + '</a></div>';
//append connections information
$jit.id('inner-details').innerHTML = html;
};
},
// Change node styles when DOM labels are placed
// or moved.
onPlaceLabel: function(domElement, node){
@ -130,8 +267,9 @@ function init(){
var left = parseInt(style.left);
var top = parseInt(style.top);
var w = domElement.offsetWidth;
var dim = node.getData('dim');
style.left = (left - w / 2) + 'px';
style.top = (top + 10) + 'px';
style.top = (top + dim) + 'px';
style.display = '';
}
});
@ -154,4 +292,8 @@ function init(){
}
});
// end
fd.graph.eachNode(function(n) {
var x = n.getData('itemcatname');
console.log(x);
});
}

View file

@ -20,3 +20,5 @@
$(document).ready(function() {
$('.nodemargin').css('padding-top',$('.focus').css('height'));
});

View file

@ -1,27 +1,27 @@
#inner-details {
font-size:12px;
}
span.close {
color:#FF5555;
cursor:pointer;
font-weight:bold;
margin-left:3px;
}
span.name {
cursor: pointer;
}
/*TOOLTIPS*/
.tip {
text-align: left;
width:auto;
max-width:500px;
}
.tip-title {
font-size: 11px;
text-align:center;
margin-bottom:2px;
}
#inner-details {
}
span.close {
color:#FF5555;
cursor:pointer;
font-weight:bold;
margin-left:3px;
}
span.name {
cursor: pointer;
}
/*TOOLTIPS*/
.tip {
text-align: left;
width:auto;
max-width:500px;
}
.tip-title {
font-size: 11px;
text-align:center;
margin-bottom:2px;
}

View file

@ -68,10 +68,4 @@ input[type="submit"] { margin-top:5px; }
.focus .link { padding:0 0 0 10px; display:block; width:90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { margin: 20px 50px 20px 50px; border-bottom:2px solid #FFF; }
.empty { margin-left:50px; }
.selecttype { display:block; margin:100px auto 0; width:500px; }
.selecttype button { display:inline-block; width:150px; height:50px; background: #2D6A5D; color: white; border-radius: 15px; cursor: pointer; }
.selecttype button:hover { border-width:4px; border-color:#CCC; }
.selecttype .middle { margin:0 20px; }
.newsynapses form {display:none; }
.empty { margin-left:50px; }

View file

@ -1,15 +1,16 @@
#center-container {
position:relative;
height:500px;
width:80%;
width:70%;
float:left;
/* background-color:#031924; */
color:#ccc;
max-width:900px;
}
#right-container {
height:500px;
width:19%;
width:29%;
color:#FFF;
text-align: left;
overflow: auto;
@ -25,9 +26,6 @@
}
#inner-details {
font-size:0.8em;
list-style:none;
margin:7px;
}
#log {

View file

@ -16,7 +16,7 @@ line-height: 24px;}
.item .title { font-size:22px; line-height:25px; display:block; border-bottom:2px solid #000; padding-bottom:5px; }
.item .desc { font-style:italic; }
.item .desc { font-style:italic; font-size:15px; }
.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; }

View file

@ -24,14 +24,10 @@ class ItemsController < ApplicationController
def show
@item = Item.find(params[:id])
@gparents = @item.groups
@pparents = @item.people
@iparents = @item.parent_items
@relatives = @item.as_json.html_safe
@ichildren = @item.child_items
respond_to do |format|
format.html { respond_with(@item, @gparents, @pparents, @iparents, @ichildren) }
format.html { respond_with(@item) }
format.json { respond_with(@relatives) }
end
end

View file

@ -6,7 +6,7 @@ class MainController < ApplicationController
def home
@current_user = current_user
@all = Group.all + Person.all + Item.all
@all = Item.all
respond_with(@all)
end
@ -14,7 +14,15 @@ class MainController < ApplicationController
def userobjects
@user = current_user
@all = @user.groups + @user.people + @user.items
@all = @user.items
respond_with(@all)
end
def usersynapses
@user = current_user
@all = @user.synapses
respond_with(@all)
end

View file

@ -14,18 +14,11 @@ class SynapsesController < ApplicationController
# Get /synapse/new
def new
@synapse1 = Synapse.new
@synapse1.category = "Group"
@synapse2 = Synapse.new
@synapse2.category = "Person"
@synapse3 = Synapse.new
@synapse3.category = "Item"
@synapse = Synapse.new
@user = current_user
@allgroups = Group.all
@allpeople = Person.all
@allitems = Item.all
respond_with(@synapse1, @synapse2, @synapse3, @allgroups, @allpeople, @allitems)
respond_with(@synapse, @allitems)
end
# GET /synapse/:id
@ -36,18 +29,8 @@ class SynapsesController < ApplicationController
@node2 = nil
if @synapse
if (@synapse.category == "Group")
@node1 = @synapse.group1
@node2 = @synapse.group2
end
if (@synapse.category == "Person")
@node1 = @synapse.person1
@node2 = @synapse.person2
end
if (@synapse.category == "Item")
@node1 = @synapse.item1
@node2 = @synapse.item2
end
@node1 = @synapse.item1
@node2 = @synapse.item2
end
respond_to do |format|
@ -63,20 +46,9 @@ class SynapsesController < ApplicationController
@synapse = Synapse.new()
@synapse.desc = params[:synapse][:desc]
@synapse.category = params[:category]
if ( @synapse.category == "Group" )
@synapse.group1 = Group.find(params[:node1_id])
@synapse.group2 = Group.find(params[:node2_id])
end
if ( @synapse.category == "Person" )
@synapse.person1 = Person.find(params[:node1_id])
@synapse.person2 = Person.find(params[:node2_id])
end
if ( @synapse.category == "Item" )
@synapse.item1 = Item.find(params[:node1_id])
@synapse.item2 = Item.find(params[:node2_id])
end
@synapse.user = @user
@synapse.item1 = Item.find(params[:node1_id])
@synapse.item2 = Item.find(params[:node2_id])
@synapse.user = @user
@synapse.save
respond_to do |format|
@ -90,22 +62,13 @@ class SynapsesController < ApplicationController
def edit
@synapse = Synapse.find_by_id(params[:id])
@collection1 = nil
@collection2 = nil
@items = nil
if @synapse
if (@synapse.category == "Group")
@collection = Group.all
end
if (@synapse.category == "Person")
@collection = Person.all
end
if (@synapse.category == "Item")
@collection = Item.all
end
if @synapse
@items = Item.all
end
respond_with(@synapse, @collection)
respond_with(@synapse, @items)
end
# PUT /actions/:id
@ -114,18 +77,8 @@ class SynapsesController < ApplicationController
if @synapse
@synapse.desc = params[:synapse][:desc]
if ( @synapse.category == "Group" )
@synapse.group1 = Group.find(params[:node1_id][:node1])
@synapse.group2 = Group.find(params[:node2_id][:node2])
end
if ( @synapse.category == "Person" )
@synapse.person1 = Person.find(params[:node1_id][:node1])
@synapse.person2 = Person.find(params[:node2_id][:node2])
end
if ( @synapse.category == "Item" )
@synapse.item1 = Item.find(params[:node1_id][:node1])
@synapse.item2 = Item.find(params[:node2_id][:node2])
end
@synapse.item1 = Item.find(params[:node1_id][:node1])
@synapse.item2 = Item.find(params[:node2_id][:node2])
@synapse.save
end

View file

@ -2,17 +2,8 @@ class Item < ActiveRecord::Base
belongs_to :user
has_many :itemitem_c, :foreign_key => 'parent_item_id', :class_name => 'Itemitem'
has_many :itemitem_p, :foreign_key => 'item_id', :class_name => 'Itemitem'
has_many :groupitems
has_many :personitems
has_many :groups, :through => :groupitems
has_many :people, :through => :personitems
has_many :synapses1, :class_name => 'Synapse', :foreign_key => 'node1_id', :conditions => {:category => 'Item'}
has_many :synapses2, :class_name => 'Synapse', :foreign_key => 'node2_id', :conditions => {:category => 'Item'}
has_many :synapses1, :class_name => 'Synapse', :foreign_key => 'node1_id' #, :conditions => {:category => 'Item'}
has_many :synapses2, :class_name => 'Synapse', :foreign_key => 'node2_id' #, :conditions => {:category => 'Item'}
has_many :items1, :through => :synapses2, :source => :item1
has_many :items2, :through => :synapses1, :source => :item2
@ -26,14 +17,12 @@ has_many :items2, :through => :synapses1, :source => :item2
belongs_to :item_category
has_many :child_items, :through => :itemitem_c, :source => :item
has_many :parent_items, :through => :itemitem_p, :source => :parent_item
def as_json
Jbuilder.encode do |json|
@single = Array.new
@single.push(self)
@items = @single + self.relatives
#@items = @single + self.relatives
@items = Item.all
json.array!(@items) do |item|
json.adjacencies item.synapses2.delete_if{|synapse| not @items.include?(Item.find_by_id(synapse.node1_id))} do |json, synapse|
@ -41,13 +30,15 @@ has_many :parent_items, :through => :itemitem_p, :source => :parent_item
json.nodeFrom synapse.node2_id
@synapsedata = Hash.new
@synapsedata['desc'] = synapse.desc
@synapsedata['$desc'] = synapse.desc
@synapsedata['$category'] = synapse.category
json.data @synapsedata
end
@itemdata = Hash.new
@itemdata['desc'] = item.desc
@itemdata['link'] = item.link
@itemdata['$desc'] = item.desc
@itemdata['$link'] = item.link
@itemdata['$itemcatname'] = item.item_category.name
json.data @itemdata
json.id item.id
json.name item.name

View file

@ -5,10 +5,4 @@ belongs_to :user
belongs_to :item1, :class_name => "Item", :foreign_key => "node1_id"
belongs_to :item2, :class_name => "Item", :foreign_key => "node2_id"
belongs_to :person1, :class_name => "Person", :foreign_key => "node1_id"
belongs_to :person2, :class_name => "Person", :foreign_key => "node2_id"
belongs_to :group1, :class_name => "Group", :foreign_key => "node1_id"
belongs_to :group2, :class_name => "Group", :foreign_key => "node2_id"
end

View file

@ -2,9 +2,8 @@ require 'open-uri'
class User < ActiveRecord::Base
has_many :people
has_many :groups
has_many :items
has_many :synapses
acts_as_authentic do |configuration|
configuration.session_class = Session

View file

@ -7,73 +7,6 @@
<label for="item_desc">Description</label>
<%= form.text_area :desc, class: "description", :rows => 5 %>
<label for="item_link">Link</label>
<%= form.text_field :link, class: "link" %>
<% if @ingroups.count > 0 %>
<label for="ingroups">Remove Parent Groups</label>
<%= select_tag "ingroups", options_from_collection_for_select(@ingroups, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "ingroups", options_from_collection_for_select(@ingroups, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @outgroups.count > 0 %>
<label for="outgroups">Add Parent Groups</label>
<%= select_tag "outgroups", options_from_collection_for_select(@outgroups, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "outgroups", options_from_collection_for_select(@outgroups, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @inpeople.count > 0 %>
<label for="inpeople">Remove Parent People</label>
<%= select_tag "inpeople", options_from_collection_for_select(@inpeople, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "inpeople", options_from_collection_for_select(@inpeople, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @outpeople.count > 0 %>
<label for="outpeople">Add Parent People</label>
<%= select_tag "outpeople", options_from_collection_for_select(@outpeople, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "outpeople", options_from_collection_for_select(@outpeople, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @initems1.count > 0 %>
<label for="initems1">Remove Parent Items</label>
<%= select_tag "initems1", options_from_collection_for_select(@initems1, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "initems1", options_from_collection_for_select(@initems1, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @outitems1.count > 0 %>
<label for="outitems1">Add Parent Items</label>
<%= select_tag "outitems1", options_from_collection_for_select(@outitems1, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "outitems1", options_from_collection_for_select(@outitems1, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @initems2.count > 0 %>
<label for="initems2">Remove Child Items</label>
<%= select_tag "initems2", options_from_collection_for_select(@initems2, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "initems2", options_from_collection_for_select(@initems2, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<% if @outitems2.count > 0 %>
<label for="outitems2">Add Child Items</label>
<%= select_tag "outitems2", options_from_collection_for_select(@outitems2, "id", "name"), { :multiple => true } %>
<% else %>
<div style="display:none">
<%= select_tag "outitems2", options_from_collection_for_select(@outitems2, "id", "name"), { :multiple => true } %>
</div>
<% end %>
<%= form.text_field :link, class: "link" %>
<%= form.submit "Update", class: "update" %>
<% end %>

View file

@ -1,11 +1,11 @@
<h1>Items</h1>
<h1>All Topics</h1>
<div class="items" id="items">
<% @items.each do |item| %>
<%= render item %>
<% end %>
<% if @items.empty? %>
<p><br>Shucks, there are no items.<p>
<p><br>Shucks, there are no topics.<p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -17,39 +17,6 @@
</div>
<div class="clearfloat nodemargin"></div>
<div class="groups">
<div class="divider"><%= @item.name %> is included in these groups</div>
<% @gparents.each do |group| %>
<%= render group %>
<% end %>
<% if @gparents.empty? %>
<p class="empty">Shucks, there are no groups.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="parents">
<div class="divider"><%= @item.name %> is included by these people</div>
<% @pparents.each do |person| %>
<%= render person %>
<% end %>
<% if @pparents.empty? %>
<p class="empty">Shucks, there are no people.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="items">
<div class="divider"><%= @item.name %> is included by these items</div>
<% @iparents.each do |item| %>
<%= render item %>
<% end %>
<% if @iparents.empty? %>
<p class="empty">Shucks, there are no items.</p>
<% end %>
</div>
<div class="clearfloat"></div>
<div class="relatives" id="container">
<div class="divider"><%= @item.name %> is connected to these items</div>
<div id="center-container">
@ -68,15 +35,4 @@
$(document).ready(function() {
init();
});
</script>
<div class="items">
<div class="divider"><%= @item.name %> includes these items</div>
<% @ichildren.each do |item| %>
<%= render item %>
<% end %>
<% if @ichildren.empty? %>
<p class="empty">Shucks, there are no items.</p>
<% end %>
</div>
<div class="clearfloat"></div>
</script>

View file

@ -15,25 +15,20 @@
<ul>
<li><%= link_to "Login", new_session_path, id: "Login" %></li>
<li>|</li>
<li><%= link_to "Items", items_path %></li>
<li><%= link_to "People", people_path %></li>
<li><%= link_to "Groups", groups_path %></li>
<li><%= link_to "Topics", items_path %></li>
</ul>
<% end %>
<% if authenticated? %>
<ul>
<li><%= link_to "Logout", session_path, method: 'delete', id: "Login" %></li>
<li><%= link_to "My Cards", userobjects_path %></li>
<li><%= link_to "My Synapses", usersynapses_path %></li>
<li><%= link_to "My Topics", userobjects_path %></li>
<li>|</li>
<li><%= link_to "Add Synapse", new_synapse_path %></li>
<li>|</li>
<li><%= link_to "Add Item", new_item_path %></li>
<li><%= link_to "Add Person", new_person_path %></li>
<li><%= link_to "Add Group", new_group_path %></li>
<li><%= link_to "Add Topic", new_item_path %></li>
<li>|</li>
<li><%= link_to "Items", items_path %></li>
<li><%= link_to "People", people_path %></li>
<li><%= link_to "Groups", groups_path %></li>
<li><%= link_to "Topics", items_path %></li>
</ul>
<% end %>
</div>

View file

@ -3,7 +3,7 @@
<%= render object %>
<% end %>
<% if @all.empty? %>
<p><br>Shucks, there is nothing in metamap.<p>
<p><br>Shucks, there is nothing in metamaps.<p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -3,7 +3,7 @@
<%= render object %>
<% end %>
<% if @all.empty? %>
<p><br>You haven't added any objects yet.<p>
<p><br>You haven't added any topics yet.<p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -0,0 +1,9 @@
<div class="everything" id="everything">
<% @all.each do |object| %>
<%= render object %>
<% end %>
<% if @all.empty? %>
<p><br>You haven't added any synapses yet.<p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -0,0 +1,11 @@
<h1>Synapses</h1>
<div class="synapses" id="synapses">
<% @synapses.each do |synapse| %>
<%= render synapse %>
<% end %>
<% if @synapses.empty? %>
<p><br>Shucks, there are no synapses.<p>
<% end %>
</div>
<div class="clearfloat"></div>

View file

@ -1,40 +1,5 @@
<div class="selecttype">
<button onclick="$('.selecttype').fadeOut('fast', function(){$('.newsynapses form:eq(0)').fadeIn('fast')});">Group to Group</button>
<button class="middle" onclick="$('.selecttype').fadeOut('fast', function(){$('.newsynapses form:eq(1)').fadeIn('fast')});">Person to Person</button>
<button onclick="$('.selecttype').fadeOut('fast', function(){$('.newsynapses form:eq(2)').fadeIn('fast')});">Item to Item</button>
</div>
<div class="newsynapses">
<%= form_for @synapse1, url: synapses_url do |form| %>
<h3>Add Synapse Between Groups</h3>
<%= hidden_field_tag(:category, "Group") %>
<% if @allgroups.count > 0 %>
<label for="node1_id">Choose First Group</label>
<%= select_tag :node1_id, options_from_collection_for_select(@allgroups, "id", "name") %>
<% end %>
<label for="item_desc">Describe The Connection</label>
<%= form.text_field :desc, class: "description" %>
<% if @allgroups.count > 0 %>
<label for="node2_id">Choose Second Group</label>
<%= select_tag :node2_id, options_from_collection_for_select(@allgroups, "id", "name") %>
<% end %>
<%= form.submit "Add Synapse", class: "add" %>
<% end %>
<%= form_for @synapse2, url: synapses_url do |form| %>
<h3>Add Synapse Between People</h3>
<%= hidden_field_tag(:category, "Person") %>
<% if @allpeople.count > 0 %>
<label for="node1_id">Choose First Person</label>
<%= select_tag :node1_id, options_from_collection_for_select(@allpeople, "id", "name") %>
<% end %>
<label for="item_desc">Describe The Connection</label>
<%= form.text_field :desc, class: "description" %>
<% if @allpeople.count > 0 %>
<label for="node2_id">Choose Second Person</label>
<%= select_tag :node2_id, options_from_collection_for_select(@allpeople, "id", "name") %>
<% end %>
<%= form.submit "Add Synapse", class: "add" %>
<% end %>
<%= form_for @synapse3, url: synapses_url do |form| %>
<%= form_for @synapse, url: synapses_url do |form| %>
<h3>Add Synapse Between Items</h3>
<%= hidden_field_tag(:category, "Item") %>
<% if @allitems.count > 0 %>

View file

@ -1,13 +1,7 @@
<div class="focus">
<div class="focusleft">
<p><%= @node1.name %></p>
<% if (@node1.class == Group) %>
<%= image_tag "group.png", :class => 'icon', :size => '50x50' %>
<% elsif (@node1.class == Person) %>
<%= image_tag "person.png", :class => 'icon', :size => '50x50' %>
<% elsif (@node1.class == Item) %>
<%= image_tag @node1.item_category.icon, :class => 'icon', :size => '50x50' %>
<% end %>
<%= image_tag @node1.item_category.icon, :class => 'icon', :size => '50x50' %>
<p><%= @node1.desc %></p>
</div>
<div class="focusmiddle">
@ -18,13 +12,7 @@
</div>
<div class="focusright">
<p><%= @node2.name %></p>
<% if (@node2.class == Group) %>
<%= image_tag "group.png", :class => 'icon', :size => '50x50' %>
<% elsif (@node2.class == Person) %>
<%= image_tag "person.png", :class => 'icon', :size => '50x50' %>
<% elsif (@node2.class == Item) %>
<%= image_tag @node2.item_category.icon, :class => 'icon', :size => '50x50' %>
<% end %>
<%= image_tag @node2.item_category.icon, :class => 'icon', :size => '50x50' %>
<p><%= @node2.desc %></p>
</div>
</div>

View file

@ -1,13 +1,13 @@
development:
min_messages: WARNING
adapter: postgresql
host: ec2-54-243-217-241.compute-1.amazonaws.com
host: 127.0.0.1
port: 5432
encoding: unicode
database: dbct9hosrirq2h
database: metamap002_development
pool: 5
username: tkbwavghytilon
password: "To6z-64f1Lr3LqpWrcLBPG2Xdv"
username: postgres
password: "3112"
test:
min_messages: WARNING
@ -15,7 +15,7 @@ test:
host: 127.0.0.1
port: 5432
encoding: unicode
database: metamap_test
database: metamap002_test
pool: 5
username: postgres
password: "3112"
@ -23,10 +23,10 @@ test:
production:
min_messages: WARNING
adapter: postgresql
host: ec2-54-243-217-241.compute-1.amazonaws.com
host: 127.0.0.1
port: 5432
encoding: unicode
database: dbct9hosrirq2h
database: metamap002_production
pool: 5
username: tkbwavghytilon
password: "To6z-64f1Lr3LqpWrcLBPG2Xdv"
username: postgres
password: "3112"

View file

@ -2,7 +2,8 @@ ISSAD::Application.routes.draw do
root to: 'main#home', via: :get
match 'my-cards', to: 'main#userobjects', via: :get, as: :userobjects
match 'my-topics', to: 'main#userobjects', via: :get, as: :userobjects
match 'my-synapses', to: 'main#usersynapses', via: :get, as: :usersynapses
resource :user
resource :session

View file

@ -5,8 +5,6 @@ class CreateItems < ActiveRecord::Migration
t.text :desc
t.text :link
t.integer :user_id
t.integer :person_id
t.integer :group_id
t.integer :item_category_id
t.timestamps

View file

@ -13,39 +13,6 @@
ActiveRecord::Schema.define(:version => 20121005160234) do
create_table "groupgroups", :force => true do |t|
t.integer "group_id"
t.integer "parent_group_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groupitems", :force => true do |t|
t.integer "group_id"
t.integer "item_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "grouppeople", :force => true do |t|
t.integer "group_id"
t.integer "person_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups", :force => true do |t|
t.text "name"
t.text "desc"
t.text "city"
t.text "province"
t.text "country"
t.text "link"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "item_categories", :force => true do |t|
t.text "name"
t.string "icon"
@ -53,44 +20,16 @@ ActiveRecord::Schema.define(:version => 20121005160234) do
t.datetime "updated_at", :null => false
end
create_table "itemitems", :force => true do |t|
t.integer "item_id"
t.integer "parent_item_id"
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 "person_id"
t.integer "group_id"
t.integer "item_category_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "people", :force => true do |t|
t.text "name"
t.text "desc"
t.text "city"
t.text "province"
t.text "country"
t.text "link"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "personitems", :force => true do |t|
t.integer "person_id"
t.integer "item_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"

View file

@ -1,12 +1,12 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
name: Action
icon: action.png
name: Person
icon: person.png
two:
name: Activity
icon: activity.png
name: Group
icon: group.png
three:
name: Bizarre
@ -28,7 +28,6 @@ seven:
name: Future Dev
icon: futuredev.png
eight:
name: Idea
icon: idea.png
@ -105,7 +104,13 @@ twentysix:
name: Trajectory
icon: trajectory.png
twentyseven:
name: Action
icon: action.png
twentyeight:
name: Activity
icon: activity.png