converted all references to items to topics
|
@ -1,6 +0,0 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
||||
|
||||
jQuery ->
|
||||
$('.best_in_place').best_in_place()
|
|
@ -1,38 +0,0 @@
|
|||
// Place all the styles related to the items controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
|
||||
.item { display:block; float:left; position:relative; width:175px; height:300px; padding:10px 5px 10px 35px; background: url('bg.png'); border-radius:15px; margin:30px 0 30px 50px; color:#000; }
|
||||
|
||||
.item .delete {position: absolute;
|
||||
top: -14px;
|
||||
left: 0px;
|
||||
background: none;
|
||||
border: 0;
|
||||
color: white;
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.item .scroll { display:block; height:283px; }
|
||||
|
||||
.item .type {position: absolute;
|
||||
color: white;
|
||||
top: -22px;
|
||||
right: 0;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
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 .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; }
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
class ItemsController < ApplicationController
|
||||
|
||||
before_filter :require_user, only: [:new, :create, :edit, :update]
|
||||
|
||||
respond_to :html, :js, :json
|
||||
|
||||
autocomplete :item, :name, :full => true, :extra_data => [:user_id]
|
||||
|
||||
|
||||
# GET items
|
||||
# or GET /users/:user_id/items
|
||||
def index
|
||||
@current = current_user
|
||||
|
||||
if params[:user_id]
|
||||
@user = User.find(params[:user_id])
|
||||
@items = Item.order("name ASC").visibleToUser(@current, @user)
|
||||
elsif
|
||||
@items = Item.order("name ASC").visibleToUser(@current, nil)
|
||||
end
|
||||
|
||||
respond_with(@user,@items)
|
||||
end
|
||||
|
||||
# Get items/new
|
||||
def new
|
||||
@item = Item.new
|
||||
@user = current_user
|
||||
|
||||
respond_with(@item)
|
||||
end
|
||||
|
||||
# GET items/:id
|
||||
def show
|
||||
@current = current_user
|
||||
@item = Item.find(params[:id]).authorize_to_show(@current)
|
||||
|
||||
if @item
|
||||
@relatives = @item.network_as_json(@current).html_safe
|
||||
else
|
||||
redirect_to root_url and return
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { respond_with(@item, @user) }
|
||||
format.json { respond_with(@relatives) }
|
||||
end
|
||||
end
|
||||
|
||||
# GET showcard/:id
|
||||
def showcard
|
||||
@user = current_user
|
||||
@item = Item.find(params[:id]).authorize_to_show(@user)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { respond_with(@item, @user) }
|
||||
end
|
||||
end
|
||||
|
||||
# POST items
|
||||
def create
|
||||
|
||||
@user = current_user
|
||||
|
||||
# if the topic exists grab it and return it
|
||||
if params[:item][:grabItem] != "null"
|
||||
@item = Item.find(params[:item][:grabItem])
|
||||
# if the topic doesn't exist yet, create it
|
||||
else
|
||||
@item = Item.new()
|
||||
@item.name = params[:item][:name]
|
||||
@item.desc = ""
|
||||
@item.link = ""
|
||||
@item.permission = 'commons'
|
||||
@item.item_category = ItemCategory.find_by_name(params[:item][:metacode])
|
||||
@item.user = @user
|
||||
|
||||
@item.save
|
||||
end
|
||||
|
||||
# pass on to the item create js whether it's being created with a synapse
|
||||
@synapse = "false"
|
||||
if params[:item][:addSynapse] == "true"
|
||||
@synapse = "true"
|
||||
end
|
||||
|
||||
# also create an object to return the position to the canvas
|
||||
@position = Hash.new()
|
||||
@position['x'] = params[:item][:x]
|
||||
@position['y'] = params[:item][:y]
|
||||
|
||||
# set this for the case where the item is being created on a map.
|
||||
@mapping = Mapping.new()
|
||||
if params[:item][:map]
|
||||
@mapping.category = "Item"
|
||||
@mapping.user = @user
|
||||
@mapping.map = Map.find(params[:item][:map])
|
||||
@mapping.item = @item
|
||||
@mapping.xloc = params[:item][:x]
|
||||
@mapping.yloc = params[:item][:y]
|
||||
@mapping.save
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { respond_with(@user, location: item_url(@item)) }
|
||||
format.js { respond_with(@item, @mapping, @synapse, @position) }
|
||||
end
|
||||
end
|
||||
|
||||
# GET items/:id/edit
|
||||
def edit
|
||||
@current = current_user
|
||||
@item = Item.find(params[:id]).authorize_to_edit(@current)
|
||||
|
||||
if not @item
|
||||
redirect_to root_url and return
|
||||
end
|
||||
|
||||
respond_with(@item)
|
||||
end
|
||||
|
||||
# PUT items/:id
|
||||
def update
|
||||
@current = current_user
|
||||
@item = Item.find(params[:id]).authorize_to_edit(@current)
|
||||
|
||||
if @item
|
||||
@item.name = params[:item][:name]
|
||||
@item.desc = params[:item][:desc]
|
||||
@item.link = params[:item][:link]
|
||||
@item.permission = params[:item][:permission]
|
||||
@item.item_category = ItemCategory.find(params[:category][:item_category_id])
|
||||
@item.save
|
||||
end
|
||||
|
||||
respond_with(@user, location: item_url(@item)) do |format|
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE items/:id
|
||||
def destroy
|
||||
@current = current_user
|
||||
@item = Item.find(params[:id]).authorize_to_edit(@current)
|
||||
|
||||
if @item
|
||||
@synapses = @item.synapses
|
||||
@mappings = @item.mappings
|
||||
|
||||
@synapses.each do |synapse|
|
||||
synapse.delete
|
||||
end
|
||||
|
||||
@mappings.each do |mapping|
|
||||
mapping.delete
|
||||
end
|
||||
|
||||
@item.delete
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,128 +0,0 @@
|
|||
module ItemsHelper
|
||||
|
||||
#find all nodes in any given nodes network
|
||||
def network(node, array, count)
|
||||
# recurse starting with a node to find all connected nodes and return an array of items that constitutes the starting nodes network
|
||||
|
||||
# if the array of nodes is empty initialize it
|
||||
if array.nil?
|
||||
array = Array.new
|
||||
end
|
||||
|
||||
# add the node to the array
|
||||
array.push(node)
|
||||
|
||||
if count == 0
|
||||
return array
|
||||
end
|
||||
|
||||
count = count - 1
|
||||
|
||||
# check if each relative is already in the array and if not, call the network function again
|
||||
if not node.relatives.empty?
|
||||
if (node.relatives-array).empty?
|
||||
return array
|
||||
else
|
||||
(node.relatives-array).each do |relative|
|
||||
array = (array | network(relative, array, count))
|
||||
end
|
||||
return array
|
||||
end
|
||||
|
||||
elsif node.relatives.empty?
|
||||
return array
|
||||
end
|
||||
end
|
||||
|
||||
#return a json object containing all of a users added synapses
|
||||
def synapses_as_json(current, synapses)
|
||||
Jbuilder.encode do |json|
|
||||
@items = Array.new
|
||||
|
||||
synapses.each do |synapse|
|
||||
@items.push(synapse.item1) if (not @items.include?(synapse.item1)) && synapse.item1.authorize_to_view(current)
|
||||
@items.push(synapse.item2) if (not @items.include?(synapse.item2)) && synapse.item2.authorize_to_view(current)
|
||||
end
|
||||
|
||||
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|
|
||||
json.nodeTo synapse.node1_id
|
||||
json.nodeFrom synapse.node2_id
|
||||
|
||||
@synapsedata = Hash.new
|
||||
@synapsedata['$desc'] = synapse.desc
|
||||
@synapsedata['$showDesc'] = false
|
||||
@synapsedata['$category'] = synapse.category
|
||||
@synapsedata['$id'] = synapse.id
|
||||
@synapsedata['$userid'] = synapse.user.id
|
||||
@synapsedata['$username'] = synapse.user.name
|
||||
@synapsedata['$direction'] = [synapse.node1_id.to_s(), synapse.node2_id.to_s()]
|
||||
json.data @synapsedata
|
||||
end
|
||||
|
||||
@inmaps = Array.new
|
||||
item.maps.each do |map|
|
||||
@inmaps.push(map.id)
|
||||
end
|
||||
|
||||
@itemdata = Hash.new
|
||||
@itemdata['$desc'] = item.desc
|
||||
@itemdata['$link'] = item.link
|
||||
@itemdata['$itemcatname'] = item.item_category.name
|
||||
@itemdata['$inmaps'] = @inmaps
|
||||
@itemdata['$userid'] = item.user.id
|
||||
@itemdata['$username'] = item.user.name
|
||||
json.data @itemdata
|
||||
json.id item.id
|
||||
json.name item.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def all_as_json(current, user)
|
||||
|
||||
# current is current user
|
||||
|
||||
Jbuilder.encode do |json|
|
||||
if user.nil?
|
||||
@items = Item.visibleToUser(current, nil)
|
||||
@synapses = Synapse.visibleToUser(current, nil)
|
||||
else
|
||||
@items = Item.visibleToUser(current, user)
|
||||
@synapses = Synapse.visibleToUser(current, user)
|
||||
end
|
||||
|
||||
json.array!(@items) do |item|
|
||||
json.adjacencies item.synapses2.delete_if{|synapse| (not @items.include?(Item.find_by_id(synapse.node1_id))) || (not @synapses.include?(synapse))} do |json, synapse|
|
||||
json.nodeTo synapse.node1_id
|
||||
json.nodeFrom synapse.node2_id
|
||||
|
||||
@synapsedata = Hash.new
|
||||
@synapsedata['$desc'] = synapse.desc
|
||||
@synapsedata['$category'] = synapse.category
|
||||
@synapsedata['$userid'] = synapse.user.id
|
||||
@synapsedata['$username'] = synapse.user.name
|
||||
json.data @synapsedata
|
||||
end
|
||||
|
||||
@inmaps = Array.new
|
||||
item.maps.each do |map|
|
||||
@inmaps.push(map.id)
|
||||
end
|
||||
|
||||
@itemdata = Hash.new
|
||||
@itemdata['$desc'] = item.desc
|
||||
@itemdata['$link'] = item.link
|
||||
@itemdata['$itemcatname'] = item.item_category.name
|
||||
@itemdata['$inmaps'] = @inmaps
|
||||
@itemdata['$userid'] = item.user.id
|
||||
@itemdata['$username'] = item.user.name
|
||||
|
||||
json.data @itemdata
|
||||
json.id item.id
|
||||
json.name item.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,170 +0,0 @@
|
|||
class Item < ActiveRecord::Base
|
||||
include ItemsHelper
|
||||
|
||||
belongs_to :user
|
||||
|
||||
has_many :synapses1, :class_name => 'Synapse', :foreign_key => 'node1_id'
|
||||
has_many :synapses2, :class_name => 'Synapse', :foreign_key => 'node2_id'
|
||||
has_many :items1, :through => :synapses2, :source => :item1
|
||||
has_many :items2, :through => :synapses1, :source => :item2
|
||||
|
||||
has_many :mappings
|
||||
has_many :maps, :through => :mappings
|
||||
|
||||
def synapses
|
||||
synapses1 + synapses2
|
||||
end
|
||||
|
||||
def relatives
|
||||
items1 + items2
|
||||
end
|
||||
|
||||
belongs_to :item_category
|
||||
|
||||
# has no viewable synapses helper function
|
||||
def has_viewable_synapses(current)
|
||||
result = false
|
||||
self.synapses.each do |synapse|
|
||||
if synapse.authorize_to_view(current)
|
||||
result = true
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
###### JSON ######
|
||||
|
||||
def self_as_json
|
||||
Jbuilder.encode do |json|
|
||||
@inmaps = Array.new
|
||||
self.maps.each do |map|
|
||||
@inmaps.push(map.id)
|
||||
end
|
||||
|
||||
@itemdata = Hash.new
|
||||
@itemdata['$desc'] = self.desc
|
||||
@itemdata['$link'] = self.link
|
||||
@itemdata['$itemcatname'] = self.item_category.name
|
||||
@itemdata['$inmaps'] = @inmaps
|
||||
@itemdata['$userid'] = self.user.id
|
||||
@itemdata['$username'] = self.user.name
|
||||
json.data @itemdata
|
||||
json.id self.id
|
||||
json.name self.name
|
||||
end
|
||||
end
|
||||
|
||||
#build a json object of everything connected to a specified node
|
||||
def network_as_json(current)
|
||||
Jbuilder.encode do |json|
|
||||
@items = network(self,nil,4)
|
||||
|
||||
if @items.count > 1
|
||||
json.array!(@items.delete_if{|item| (not item.authorize_to_view(current)) || (not item.has_viewable_synapses(current))}) do |item|
|
||||
|
||||
json.adjacencies item.synapses1.delete_if{|synapse| (not @items.include?(synapse.item2)) || (not synapse.authorize_to_view(current)) || (not synapse.item2.authorize_to_view(current)) } do |json, synapse|
|
||||
json.nodeTo synapse.node2_id
|
||||
json.nodeFrom synapse.node1_id
|
||||
|
||||
@synapsedata = Hash.new
|
||||
@synapsedata['$desc'] = synapse.desc
|
||||
@synapsedata['$showDesc'] = false
|
||||
@synapsedata['$category'] = synapse.category
|
||||
@synapsedata['$id'] = synapse.id
|
||||
@synapsedata['$userid'] = synapse.user.id
|
||||
@synapsedata['$username'] = synapse.user.name
|
||||
@synapsedata['$direction'] = [synapse.node1_id.to_s(), synapse.node2_id.to_s()]
|
||||
json.data @synapsedata
|
||||
end
|
||||
|
||||
@inmaps = Array.new
|
||||
item.maps.each do |map|
|
||||
@inmaps.push(map.id)
|
||||
end
|
||||
|
||||
@itemdata = Hash.new
|
||||
@itemdata['$desc'] = item.desc
|
||||
@itemdata['$link'] = item.link
|
||||
@itemdata['$itemcatname'] = item.item_category.name
|
||||
@itemdata['$inmaps'] = @inmaps
|
||||
@itemdata['$userid'] = item.user.id
|
||||
@itemdata['$username'] = item.user.name
|
||||
json.data @itemdata
|
||||
json.id item.id
|
||||
json.name item.name
|
||||
end
|
||||
elsif @items.count == 1
|
||||
json.array!(@items) do |item|
|
||||
@inmaps = Array.new
|
||||
item.maps.each do |map|
|
||||
@inmaps.push(map.id)
|
||||
end
|
||||
|
||||
@itemdata = Hash.new
|
||||
@itemdata['$desc'] = item.desc
|
||||
@itemdata['$link'] = item.link
|
||||
@itemdata['$itemcatname'] = item.item_category.name
|
||||
@itemdata['$inmaps'] = @inmaps
|
||||
@itemdata['$userid'] = item.user.id
|
||||
@itemdata['$username'] = item.user.name
|
||||
json.data @itemdata
|
||||
json.id item.id
|
||||
json.name item.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##### PERMISSIONS ######
|
||||
|
||||
scope :visibleToUser, lambda { |current, user|
|
||||
if user != nil
|
||||
if user != current
|
||||
Item.find_all_by_user_id_and_permission(user.id, "commons") | Item.find_all_by_user_id_and_permission(user.id, "public")
|
||||
elsif user == current
|
||||
Item.find_all_by_user_id_and_permission(user.id, "commons") | Item.find_all_by_user_id_and_permission(user.id, "public") | current.items.where(:permission => "private")
|
||||
end
|
||||
elsif (current != nil && user == nil)
|
||||
Item.find_all_by_permission("commons") | Item.find_all_by_permission("public") | current.items.where(:permission => "private")
|
||||
elsif (current == nil)
|
||||
Item.find_all_by_permission("commons") | Item.find_all_by_permission("public")
|
||||
end
|
||||
}
|
||||
|
||||
# returns false if user not allowed to 'show' Topic, Synapse, or Map
|
||||
def authorize_to_show(user)
|
||||
if (self.permission == "private" && self.user != user)
|
||||
return false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
# returns false if user not allowed to 'edit' Topic, Synapse, or Map
|
||||
def authorize_to_edit(user)
|
||||
if (self.permission == "private" && self.user != user)
|
||||
return false
|
||||
elsif (self.permission == "public" && self.user != user)
|
||||
return false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
# returns Boolean if user allowed to view Topic, Synapse, or Map
|
||||
def authorize_to_view(user)
|
||||
if (self.permission == "private" && self.user != user)
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
# returns Boolean based on whether user has permissions to edit or not
|
||||
def authorize_linkto_edit(user)
|
||||
if (self.user == user)
|
||||
return true
|
||||
elsif (self.permission == "commons")
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
class ItemCategory < ActiveRecord::Base
|
||||
|
||||
has_many :items
|
||||
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
<%= div_for item, class: item.item_category.name do %>
|
||||
<% if item.user == user %><%= link_to 'Delete', item_path(item), :class => 'delete', :confirm => 'Delete this topic and all synapses linking to it?', :method => :delete, :remote => true%><% end %>
|
||||
<p class="type"><%= item.item_category.name %></p>
|
||||
<%= image_tag item.item_category.icon, :class => 'icon', :size => '50x50' %>
|
||||
<div class="scroll">
|
||||
<%= link_to item.name, item_path(item), :class => 'title' %>
|
||||
<div class="desc"><p><%=item.desc %></p></div>
|
||||
</div>
|
||||
<%= link_to item.link, item.link, :class => 'link', :target => '_blank' %>
|
||||
<% end %>
|
|
@ -1,15 +0,0 @@
|
|||
<div class="anypage">
|
||||
<%= form_for Item.new, url: items_url, remote: true do |form| %>
|
||||
<div id="metacodeImg"><img class="cloudcarousel" width="40" height="40" src="/assets/action.png" alt="Action" title="Action"/><img class="cloudcarousel" width="40" height="40" src="/assets/activity.png" alt="Activity" title="Activity"/><img class="cloudcarousel" width="40" height="40" src="/assets/bizarre.png" alt="Bizarre" title="Bizarre"/><img class="cloudcarousel" width="40" height="40" src="/assets/catalyst.png" alt="Catalyst" title="Catalyst"/><img class="cloudcarousel" width="40" height="40" src="/assets/closed.png" alt="Closed" title="Closed"/><img class="cloudcarousel" width="40" height="40" src="/assets/experience.png" alt="Experience" title="Experience"/><img class="cloudcarousel" width="40" height="40" src="/assets/futuredev.png" alt="Future Dev" title="Future Dev"/><img class="cloudcarousel" width="40" height="40" src="/assets/group.png" alt="Group" title="Group"/><img class="cloudcarousel" width="40" height="40" src="/assets/idea.png" alt="Idea" title="Idea"/><img class="cloudcarousel" width="40" height="40" src="/assets/implication.png" alt="Implication" title="Implication"/><img class="cloudcarousel" width="40" height="40" src="/assets/insight.png" alt="Insight" title="Insight"/><img class="cloudcarousel" width="40" height="40" src="/assets/intention.png" alt="Intention" title="Intention"/><img class="cloudcarousel" width="40" height="40" src="/assets/knowledge.png" alt="Knowledge" title="Knowledge"/><img class="cloudcarousel" width="40" height="40" src="/assets/location.png" alt="Location" title="Location"/><img class="cloudcarousel" width="40" height="40" src="/assets/openissue.png" alt="Open Issue" title="Open Issue"/><img class="cloudcarousel" width="40" height="40" src="/assets/opinion.png" alt="Opinion" title="Opinion"/><img class="cloudcarousel" width="40" height="40" src="/assets/opportunity.png" alt="Opportunity" title="Opportunity"/><img class="cloudcarousel" width="40" height="40" src="/assets/person.png" alt="Person" title="Person"/><img class="cloudcarousel" width="40" height="40" src="/assets/platform.png" alt="Platform" title="Platform"/><img class="cloudcarousel" width="40" height="40" src="/assets/problem.png" alt="Problem" title="Problem"/><img class="cloudcarousel" width="40" height="40" src="/assets/question.png" alt="Question" title="Question"/><img class="cloudcarousel" width="40" height="40" src="/assets/reference.png" alt="Reference" title="Reference"/><img class="cloudcarousel" width="40" height="40" src="/assets/requirement.png" alt="Requirement" title="Requirement"/><img class="cloudcarousel" width="40" height="40" src="/assets/resource.png" alt="Resource" title="Resource"/><img class="cloudcarousel" width="40" height="40" src="/assets/role.png" alt="Role" title="Role"/><img class="cloudcarousel" width="40" height="40" src="/assets/task.png" alt="Task" title="Task"/><img class="cloudcarousel" width="40" height="40" src="/assets/tool.png" alt="Tool" title="Tool"/><img class="cloudcarousel" width="40" height="40" src="/assets/trajectory.png" alt="Trajectory" title="Trajectory"/></div>
|
||||
<%= form.autocomplete_field :name, autocomplete_item_name_items_path, :placeholder => "What is the name of your topic?" %>
|
||||
<%= form.hidden_field :metacode, :value => "Action" %>
|
||||
<%= form.hidden_field :x, :value => 0 %>
|
||||
<%= form.hidden_field :y, :value => 0 %>
|
||||
<%= form.hidden_field :grabItem, :value => "null" %>
|
||||
<%= form.hidden_field :addSynapse, :value => false %>
|
||||
<!--<input id="left-but" type="button" value="Left" />-->
|
||||
<div id="metacodeImgTitle"></div>
|
||||
<!--<input id="right-but" type="button" value="Right" />-->
|
||||
<div class="clearfloat"></div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,83 +0,0 @@
|
|||
$('#new_item').fadeOut('fast');
|
||||
$('#item_name').data().autocomplete.term = null;
|
||||
$('.ui-autocomplete').children().remove();
|
||||
$('.ui-autocomplete').css('display','none');
|
||||
$('#item_name').attr('value','');
|
||||
$('#item_grabItem').attr('value','null');
|
||||
$('#item_addSynapse').attr('value','false');
|
||||
|
||||
|
||||
|
||||
var newnode = <%= @item.self_as_json.html_safe %>;
|
||||
var x = <%= @position['x'] %>;
|
||||
var y = <%= @position['y'] %>;
|
||||
|
||||
|
||||
if (!$.isEmptyObject(Mconsole.graph.nodes)) {
|
||||
Mconsole.graph.addNode(newnode);
|
||||
|
||||
// set the animation for everything back to normal
|
||||
Mconsole.graph.eachNode( function (n) {
|
||||
n.setData('dim', 25, 'start');
|
||||
n.setData('dim', 25, 'end');
|
||||
});
|
||||
var temp = Mconsole.graph.getNode('<%= @item.id %>');
|
||||
temp.setData('dim', 1, 'start');
|
||||
temp.setData('dim', 40, 'end');
|
||||
|
||||
if (gType == "centered") {
|
||||
var tempPos = new $jit.Complex(x, y);
|
||||
tempPos = tempPos.toPolar();
|
||||
temp.setPos(tempPos, 'current');
|
||||
temp.setPos(tempPos, 'start');
|
||||
temp.setPos(tempPos, 'end');
|
||||
}
|
||||
else if (gType == "arranged" || gType == "chaotic") {
|
||||
temp.setData('xloc',0);
|
||||
temp.setData('yloc',0);
|
||||
temp.setData('mappingid', '<%= @mapping.id %>');
|
||||
temp.setPos(new $jit.Complex(x, y), 'current');
|
||||
temp.setPos(new $jit.Complex(x, y), 'start');
|
||||
temp.setPos(new $jit.Complex(x, y), 'end');
|
||||
}
|
||||
|
||||
if ( '<%= @synapse %>' == "true" ) {
|
||||
$('#synapse_item1id').val(tempNode.id);
|
||||
$('#synapse_item2id').val(temp.id);
|
||||
$('#new_synapse').fadeIn('fast');
|
||||
$('#synapse_desc').focus();
|
||||
Mconsole.fx.animate({
|
||||
modes: ['node-property:dim'],
|
||||
duration: 500,
|
||||
onComplete: function() {
|
||||
renderMidArrow({ x: tempNode.pos.getc().x, y: tempNode.pos.getc().y }, { x: temp.pos.getc().x, y: temp.pos.getc().y }, 13, false, Mconsole.canvas);
|
||||
Mconsole.fx.plotNode(tempNode, Mconsole.canvas);
|
||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||
tempNode = null;
|
||||
tempNode2 = null;
|
||||
tempInit = false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||
Mconsole.fx.animate({
|
||||
modes: ['node-property:dim'],
|
||||
duration: 500
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
json = newnode;
|
||||
Mconsole.loadJSON(json);
|
||||
var temp = Mconsole.graph.getNode('<%= @item.id %>');
|
||||
temp.setData('dim', 1, 'start');
|
||||
temp.setData('dim', 25, 'end');
|
||||
temp.setPos(new $jit.Complex(x, y), 'current');
|
||||
temp.setPos(new $jit.Complex(x, y), 'start');
|
||||
temp.setPos(new $jit.Complex(x, y), 'end');
|
||||
Mconsole.fx.plotNode(temp, Mconsole.canvas);
|
||||
Mconsole.fx.animate({
|
||||
modes: ['node-property:dim'],
|
||||
duration: 500
|
||||
});
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
$('#<%= dom_id(@item) %>').fadeOut('slow');
|
|
@ -1,14 +0,0 @@
|
|||
<%= form_for @item, url: item_url do |form| %>
|
||||
<h3>Edit Item</h3>
|
||||
<label for="category">Category</label>
|
||||
<%= select "category", "item_category_id", ItemCategory.order("name ASC").all.collect {|p| [ p.name, p.id ] }, { :selected => @item.item_category.id } %>
|
||||
<label for="item_name">Title</label>
|
||||
<%= form.text_field :name %>
|
||||
<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" %>
|
||||
<label for="item_permission">Permission</label>
|
||||
<%= form.select :permission, options_for_select(['commons', 'public', 'private'], @item.permission) %>
|
||||
<%= form.submit "Update", class: "update" %>
|
||||
<% end %>
|
|
@ -1,11 +0,0 @@
|
|||
<h1 class="index"><% if @user %><%= @user.name %>'s<% end %> Topics</h1>
|
||||
|
||||
<div class="items" id="cards">
|
||||
<% @items.each do |item| %>
|
||||
<%= render item %>
|
||||
<% end %>
|
||||
<% if @items.empty? %>
|
||||
<p class="empty"><br>Shucks, there are no topics. <% if authenticated? %><%= link_to "Create some if you want.", console_url %><% end %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
|
@ -1,16 +0,0 @@
|
|||
<div class="nothidden">
|
||||
<%= form_for @item || Item.new, url: items_path do |form| %>
|
||||
<h3>Add Topic</h3>
|
||||
<label for="category">Category</label>
|
||||
<%= select_tag "category", options_from_collection_for_select(ItemCategory.order("name ASC").all, "id", "name") %>
|
||||
<label for="item_name">Title</label>
|
||||
<%= form.text_field :name %>
|
||||
<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" %>
|
||||
<label for="item_permission">Permission</label>
|
||||
<%= form.select(:permission, options_for_select(['commons', 'public', 'private'])) %>
|
||||
<%= form.submit "Add Topic", class: "addTopic", id: "addTopic" %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,38 +0,0 @@
|
|||
<div class="focus">
|
||||
<div class="focusleft">
|
||||
<p><%= @item.item_category.name %></p>
|
||||
<%= image_tag @item.item_category.icon, :class => 'icon', :size => '50x50' %>
|
||||
</div>
|
||||
<div class="focusmiddle">
|
||||
<h1 class="title"><%= @item.name %> <% if (@item.permission == "commons" && authenticated?) || @item.user == user %><%= link_to "[edit]", edit_item_path(@item) %><% end %></h1>
|
||||
<div class="desc">
|
||||
<p><%= @item.desc %></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="focusright">
|
||||
<p>Link</p>
|
||||
<%= link_to @item.link, @item.link, :class => 'link', :target => '_blank' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat nodemargin"></div>
|
||||
|
||||
<div class="relatives" id="container">
|
||||
<div id="center-container">
|
||||
<div id="infovis"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
|
||||
<script>
|
||||
json = <%= @relatives %>;
|
||||
console.log(json);
|
||||
$(document).ready(function() {
|
||||
initialize("centered");
|
||||
});
|
||||
</script>
|
||||
|
||||
<% if authenticated? %>
|
||||
<%= render :partial => 'items/new' %>
|
||||
<%= render :partial => 'synapses/new' %>
|
||||
<% end %>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<div class="showcard item_<%= @item.id %>">
|
||||
<div class="CardOnGraph" title="Click to Hide" id="item_' + node.id + '">
|
||||
<p class="type">
|
||||
<%= @item.item_category.name %>
|
||||
</p>
|
||||
<img alt="<%= @item.item_category.name %>"
|
||||
src="/assets/<%= @item.item_category.name %>.png"
|
||||
class="icon" height="50" width="50" />
|
||||
<div class="scroll">
|
||||
<a href="/items/<%=@item.id%>" class="title">
|
||||
<%= @item.name %>
|
||||
</a>
|
||||
<div class="contributor">
|
||||
Added by:
|
||||
<a href="/users/<%= @user.id %>">
|
||||
<%= @user.name %>
|
||||
</a>
|
||||
</div>
|
||||
<div class="desc">
|
||||
<p>
|
||||
<%= @item.desc %>
|
||||
</p>
|
||||
</div>
|
||||
</div><!-- div.scroll -->
|
||||
<a href="<%= @item.link %>" class="link" target="_blank">
|
||||
<%= @item.link %>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
|
@ -1,14 +0,0 @@
|
|||
class CreateItems < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :items do |t|
|
||||
t.text :name
|
||||
t.text :desc
|
||||
t.text :link
|
||||
t.text :permission
|
||||
t.integer :user_id
|
||||
t.integer :item_category_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
class CreateItemCategories < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :item_categories do |t|
|
||||
t.text :name
|
||||
t.string :icon
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
Before Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 676 KiB |
Before Width: | Height: | Size: 676 KiB |
Before Width: | Height: | Size: 370 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 370 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 9.9 KiB |
|
@ -1,53 +0,0 @@
|
|||
---
|
||||
action.png: action-02bd981b8466a7b2cb167afffc284703.png
|
||||
activity.png: activity-27aedb9b5baea69ea88f1f2b5303862c.png
|
||||
argument.png: argument-4c3b1c568d758e134c36e4be294ed3a5.png
|
||||
background.jpg: background-2fcc9f96ace4764a02278ada04bc0d9d.jpg
|
||||
background2-for-repeating.jpg: background2-for-repeating-8d022369a362b364c9395039167f1ffd.jpg
|
||||
background2.jpg: background2-c2b46d9ebc7d31aea8135e3c505aa1e9.jpg
|
||||
bg.png: bg-eea3f1ec61623cbc3833f8fcbf114bf8.png
|
||||
bizarre.png: bizarre-4154e4b7b2e0169cfc4af24c32119305.png
|
||||
catalyst.png: catalyst-21e04cdb0f34140b3e00d0b98aca240c.png
|
||||
closed.png: closed-11f6970ed42d52bc9352fa8860ab7479.png
|
||||
con_icon.png: con_icon-d8aee295fac276c5de66ba835b251137.png
|
||||
decision.png: decision-7cee13c9510c1119ba34c8bb654ffdde.png
|
||||
example.png: example-fc70515d308ee9ef5b3b2b38d0eecb8e.png
|
||||
experience.png: experience-79528f6bceb2a66a98bdbdff2c64dc02.png
|
||||
foresight.png: foresight-0e62c71e1eb88a2b7ff4d20ba12f3f54.png
|
||||
futuredev.png: futuredev-e3c62458cfd457b0501dddc6d9b2d8d4.png
|
||||
goodpractice.png: goodpractice-928b04810ec395c188e90cc05f219387.png
|
||||
group.png: group-70155e13e72ec389d64a4f80a8d62d24.png
|
||||
idea.png: idea-5092d85514a1fdacec53760d7ecf63c4.png
|
||||
implication.png: implication-652ece8bc0b1060dd5ca0756393cf21e.png
|
||||
insight.png: insight-858ccca7357b37837a257e0202319b27.png
|
||||
intention.png: intention-a487d116bfcf64c7ac559ef89ed61544.png
|
||||
junto.png: junto-3bca283ec5fe80ef34d6a888b7c676b4.png
|
||||
knowledge.png: knowledge-eb4b1dc4412b210c286b934737b04f80.png
|
||||
list.png: list-c2cade39d3e1e606162d860d9eb58690.png
|
||||
location.png: location-e1642892214a5cb4b2891f3837f437de.png
|
||||
map.png: map-acf615128f2f9f581a225ed908fd5f3b.png
|
||||
moviemap.png: moviemap-7b2052b46a57fd1554fdeaed5470ac87.png
|
||||
note.png: note-607459da5972ee3b48469762ad879864.png
|
||||
openissue.png: openissue-d9c50446b2dbd0587942ae298bda2a75.png
|
||||
opinion.png: opinion-eabcaf3f05d2bf38dfd075e8449cea57.png
|
||||
opportunity.png: opportunity-4fe7c2f4f5cbe678058c76924ec43a7f.png
|
||||
person.png: person-2cb4eace780426c21c109ca6475431ce.png
|
||||
platform.png: platform-29f4dc32fb5f2a9f369b92d2f51ba005.png
|
||||
pro.png: pro-205bd7f40d88f6d13369780d0d115ebf.png
|
||||
problem.png: problem-d660aa3522f737dfd25487937bed6db1.png
|
||||
question.png: question-9ac8258ba7e5bcb83114651b43dcc92e.png
|
||||
reference.png: reference-114b70ecccc3971ad9942f5fc8b5b654.png
|
||||
requirement.png: requirement-d200e129a41fff36f64111f554abea72.png
|
||||
research.png: research-0c10ce1c3fbdad073555b64ab85aef9d.png
|
||||
resource.png: resource-4017b1e9535d80d205ceff916930cf5d.png
|
||||
role.png: role-c474b1fcb4b4f836e7ca0db67e744dc3.png
|
||||
spinner.gif: spinner-3dc049c5763846dcf9ff6cab669b2b87.gif
|
||||
task.png: task-0ac599d122a709a5e73990f1745019e0.png
|
||||
tool.png: tool-92f28a86b5ece18668698a0b9a19aca7.png
|
||||
topbg.png: topbg-eb18f5cf8dcfaf7dfd7e47f503956a5d.png
|
||||
topbg2.png: topbg2-f9640f6cb183bb610d0954c7759ecc23.png
|
||||
trajectory.png: trajectory-a7c520e746d4c1ffe401805b3d0cb6cd.png
|
||||
wildcard.png: wildcard-22dead854b0b5f4ec0aba7a05425839e.png
|
||||
application.js: application-7a9c810f59df3ccecf89c7fb4bda1129.js
|
||||
scroll/mCSB_buttons.png: scroll/mCSB_buttons-6eb1e766df3b6b28f5cb2a218697658f.png
|
||||
application.css: application-d95c136b90ec89004bc1220f162d3694.css
|
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB |