Merge branch 'develop' into paring.down

This commit is contained in:
Connor Turland 2016-08-10 17:09:37 +00:00
commit f71d552504
15 changed files with 283 additions and 185 deletions

View file

@ -1 +1,2 @@
https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/heroku/heroku-buildpack-ruby.git https://github.com/heroku/heroku-buildpack-ruby.git

View file

@ -16,6 +16,6 @@ before_script:
- . $HOME/.nvm/nvm.sh - . $HOME/.nvm/nvm.sh
- nvm install stable - nvm install stable
- nvm use stable - nvm use stable
- (cd frontend && npm install) - npm install
script: script:
- bundle exec rspec && (cd frontend && npm test) && bundle exec brakeman -q -z - bundle exec rspec && npm test && bundle exec brakeman -q -z

View file

@ -2,7 +2,7 @@ Metamaps
======= =======
[![Join the chat at https://gitter.im/metamaps/metamaps](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/metamaps/metamaps?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Join the chat at https://gitter.im/metamaps/metamaps](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/metamaps/metamaps?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/metamaps/metamaps.svg)](https://travis-ci.org/metamaps/metamaps) [![Build Status](https://travis-ci.org/metamaps/metamaps.svg?branch=develop)](https://travis-ci.org/metamaps/metamaps)
Welcome to the Metamaps GitHub repo. Welcome to the Metamaps GitHub repo.

View file

@ -111,6 +111,19 @@ Metamaps.Control = {
} }
}, },
removeSelectedNodes: function () { // refers to removing topics permanently from a map removeSelectedNodes: function () { // refers to removing topics permanently from a map
if (Metamaps.Active.Topic) {
// hideNode will handle synapses as well
var nodeids = _.map(Metamaps.Selected.Nodes, function(node) {
return node.id
})
_.each(nodeids, function(nodeid) {
if (Metamaps.Active.Topic.id !== nodeid) {
Metamaps.Topics.remove(nodeid)
Metamaps.Control.hideNode(nodeid)
}
})
return
}
if (!Metamaps.Active.Map) return if (!Metamaps.Active.Map) return
var l = Metamaps.Selected.Nodes.length, var l = Metamaps.Selected.Nodes.length,
@ -285,12 +298,13 @@ Metamaps.Control = {
} }
}, },
removeSelectedEdges: function () { removeSelectedEdges: function () {
// Topic view is handled by removeSelectedNodes
if (!Metamaps.Active.Map) return
var l = Metamaps.Selected.Edges.length, var l = Metamaps.Selected.Edges.length,
i, i,
edge edge
if (!Metamaps.Active.Map) return
var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper) var authorized = Metamaps.Active.Map.authorizeToEdit(Metamaps.Active.Mapper)
if (!authorized) { if (!authorized) {

View file

@ -275,7 +275,7 @@ Metamaps.Import = {
name: name, name: name,
metacode_id: metacode.id, metacode_id: metacode.id,
permission: permission || Metamaps.Active.Map.get('permission'), permission: permission || Metamaps.Active.Map.get('permission'),
desc: desc, desc: desc || "",
link: link link: link
}) })
Metamaps.Topics.add(topic) Metamaps.Topics.add(topic)
@ -295,7 +295,7 @@ Metamaps.Import = {
Metamaps.Famous.viz.hideInstructions() Metamaps.Famous.viz.hideInstructions()
}, },
createSynapseWithParameters: function (description, category, permission, createSynapseWithParameters: function (desc, category, permission,
topic1, topic2) { topic1, topic2) {
var node1 = topic1.get('node') var node1 = topic1.get('node')
var node2 = topic2.get('node') var node2 = topic2.get('node')
@ -306,7 +306,7 @@ Metamaps.Import = {
} // if } // if
var synapse = new Metamaps.Backbone.Synapse({ var synapse = new Metamaps.Backbone.Synapse({
desc: description, desc: desc || "",
category: category, category: category,
permission: permission, permission: permission,
node1_id: topic1.id, node1_id: topic1.id,

View file

@ -1084,7 +1084,18 @@ Metamaps.JIT = {
} }
return 'nothing'; // case 4? return 'nothing'; // case 4?
}, // handleSelectionBeforeDragging }, // handleSelectionBeforeDragging
getNodeXY: function(node) {
if (typeof node.pos.x === "number" && typeof node.pos.y === "number") {
return node.pos
} else if (typeof node.pos.theta === "number" && typeof node.pos.rho === "number") {
return new $jit.Polar(node.pos.theta, node.pos.rho).getc(true)
} else {
console.error('getNodeXY: unrecognized node pos format')
return {}
}
},
selectWithBox: function (e) { selectWithBox: function (e) {
var self = this
var sX = Metamaps.Mouse.boxStartCoordinates.x, var sX = Metamaps.Mouse.boxStartCoordinates.x,
sY = Metamaps.Mouse.boxStartCoordinates.y, sY = Metamaps.Mouse.boxStartCoordinates.y,
eX = Metamaps.Mouse.boxEndCoordinates.x, eX = Metamaps.Mouse.boxEndCoordinates.x,
@ -1096,11 +1107,17 @@ Metamaps.JIT = {
} }
// select all nodes that are within the box // select all nodes that are within the box
Metamaps.Visualize.mGraph.graph.eachNode(function (n) { Metamaps.Visualize.mGraph.graph.eachNode(function(n) {
var x = n.pos.x, var pos = self.getNodeXY(n)
y = n.pos.y var x = pos.x,
y = pos.y
if ((sX < x && x < eX && sY < y && y < eY) || (sX > x && x > eX && sY > y && y > eY) || (sX > x && x > eX && sY < y && y < eY) || (sX < x && x < eX && sY > y && y > eY)) { // depending on which way the person dragged the box, check that
// x and y are between the start and end values of the box
if ((sX < x && x < eX && sY < y && y < eY) ||
(sX > x && x > eX && sY > y && y > eY) ||
(sX > x && x > eX && sY < y && y < eY) ||
(sX < x && x < eX && sY > y && y > eY)) {
if (e.shiftKey) { if (e.shiftKey) {
if (n.selected) { if (n.selected) {
Metamaps.Control.deselectNode(n) Metamaps.Control.deselectNode(n)
@ -1125,10 +1142,12 @@ Metamaps.JIT = {
} }
}) })
edgesToToggle.forEach(function (edge) { edgesToToggle.forEach(function (edge) {
var fromNodeX = edge.nodeFrom.pos.x var fromNodePos = self.getNodeXY(edge.nodeFrom)
var fromNodeY = -1 * edge.nodeFrom.pos.y var fromNodeX = fromNodePos.x
var toNodeX = edge.nodeTo.pos.x var fromNodeY = -1 * fromNodePos.y
var toNodeY = -1 * edge.nodeTo.pos.y var toNodePos = self.getNodeXY(edge.nodeTo)
var toNodeX = toNodePos.x
var toNodeY = -1 * toNodePos.y
var maxX = fromNodeX var maxX = fromNodeX
var maxY = fromNodeY var maxY = fromNodeY
@ -1315,10 +1334,11 @@ Metamaps.JIT = {
if (Metamaps.Active.Map) menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh<div class="rc-keyboard">Ctrl+H</div></li>' if (Metamaps.Active.Map) menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh<div class="rc-keyboard">Ctrl+H</div></li>'
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove ' + disabled + '"><div class="rc-icon"></div>Remove from map<div class="rc-keyboard">Ctrl+M</div></li>' if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove ' + disabled + '"><div class="rc-icon"></div>Remove from map<div class="rc-keyboard">Ctrl+M</div></li>'
if (Metamaps.Active.Topic) menustring += '<li class="rc-remove"><div class="rc-icon"></div>Remove from view<div class="rc-keyboard">Ctrl+M</div></li>'
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete<div class="rc-keyboard">Ctrl+D</div></li>' if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete<div class="rc-keyboard">Ctrl+D</div></li>'
if (Metamaps.Active.Topic) { if (Metamaps.Active.Topic) {
menustring += '<li class="rc-center"><div class="rc-icon"></div>Center this topic</li>' menustring += '<li class="rc-center"><div class="rc-icon"></div>Center this topic<div class="rc-keyboard">Alt+E</div></li>'
} }
menustring += '<li class="rc-popout"><div class="rc-icon"></div>Open in new tab</li>' menustring += '<li class="rc-popout"><div class="rc-icon"></div>Open in new tab</li>'
if (Metamaps.Active.Mapper) { if (Metamaps.Active.Mapper) {
@ -1343,10 +1363,10 @@ Metamaps.JIT = {
// set up the get sibling menu as a "lazy load" // set up the get sibling menu as a "lazy load"
// only fill in the submenu when they hover over the get siblings list item // only fill in the submenu when they hover over the get siblings list item
var siblingMenu = '<ul id="fetchSiblingList"> \ var siblingMenu = '<ul id="fetchSiblingList"> \
<li class="fetchAll">All</li> \ <li class="fetchAll">All<div class="rc-keyboard">Alt+R</div></li> \
<li id="loadingSiblings"></li> \ <li id="loadingSiblings"></li> \
</ul>' </ul>'
menustring += '<li class="rc-siblings"><div class="rc-icon"></div>Get siblings' + siblingMenu + '<div class="expandLi"></div></li>' menustring += '<li class="rc-siblings"><div class="rc-icon"></div>Reveal siblings' + siblingMenu + '<div class="expandLi"></div></li>'
} }
menustring += '</ul>' menustring += '</ul>'
@ -1399,7 +1419,7 @@ Metamaps.JIT = {
} }
// remove the selected things from the map // remove the selected things from the map
if (authorized) { if (Metamaps.Active.Topic || authorized) {
$('.rc-remove').click(function () { $('.rc-remove').click(function () {
$('.rightclickmenu').remove() $('.rightclickmenu').remove()
Metamaps.Control.removeSelectedEdges() Metamaps.Control.removeSelectedEdges()
@ -1442,11 +1462,11 @@ Metamaps.JIT = {
}) })
// fetch relatives // fetch relatives
var fetched = false var fetch_sent = false
$('.rc-siblings').hover(function () { $('.rc-siblings').hover(function () {
if (!fetched) { if (!fetch_sent) {
Metamaps.JIT.populateRightClickSiblings(node) Metamaps.JIT.populateRightClickSiblings(node)
fetched = true fetch_sent = true
} }
}) })
$('.rc-siblings .fetchAll').click(function () { $('.rc-siblings .fetchAll').click(function () {
@ -1459,13 +1479,6 @@ Metamaps.JIT = {
var self = Metamaps.JIT var self = Metamaps.JIT
// depending on how many topics are selected, do different things // depending on how many topics are selected, do different things
/*if (Metamaps.Selected.Nodes.length > 1) {
// we don't bother filling the submenu with
// specific numbers, because there are too many topics
// selected to find those numbers
$('#loadingSiblings').remove()
return
}*/
var topic = node.getData('topic') var topic = node.getData('topic')
@ -1496,7 +1509,7 @@ Metamaps.JIT = {
} }
$.ajax({ $.ajax({
type: 'Get', type: 'GET',
url: '/topics/' + topic.id + '/relative_numbers.json?network=' + topics_string, url: '/topics/' + topic.id + '/relative_numbers.json?network=' + topics_string,
success: successCallback, success: successCallback,
error: function () {} error: function () {}
@ -1569,6 +1582,7 @@ Metamaps.JIT = {
if (Metamaps.Active.Map) menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh<div class="rc-keyboard">Ctrl+H</div></li>' if (Metamaps.Active.Map) menustring += '<li class="rc-hide"><div class="rc-icon"></div>Hide until refresh<div class="rc-keyboard">Ctrl+H</div></li>'
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove ' + disabled + '"><div class="rc-icon"></div>Remove from map<div class="rc-keyboard">Ctrl+M</div></li>' if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-remove ' + disabled + '"><div class="rc-icon"></div>Remove from map<div class="rc-keyboard">Ctrl+M</div></li>'
if (Metamaps.Active.Topic) menustring += '<li class="rc-remove"><div class="rc-icon"></div>Remove from view<div class="rc-keyboard">Ctrl+M</div></li>'
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete<div class="rc-keyboard">Ctrl+D</div></li>' if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-delete ' + disabled + '"><div class="rc-icon"></div>Delete<div class="rc-keyboard">Ctrl+D</div></li>'
if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-spacer"></li>' if (Metamaps.Active.Map && Metamaps.Active.Mapper) menustring += '<li class="rc-spacer"></li>'

View file

@ -11,6 +11,7 @@
*/ */
Metamaps.Listeners = { Metamaps.Listeners = {
init: function () { init: function () {
var self = this
$(document).on('keydown', function (e) { $(document).on('keydown', function (e) {
if (!(Metamaps.Active.Map || Metamaps.Active.Topic)) return if (!(Metamaps.Active.Map || Metamaps.Active.Topic)) return
@ -35,21 +36,6 @@ Metamaps.Listeners = {
Metamaps.Visualize.mGraph.plot() Metamaps.Visualize.mGraph.plot()
} }
break
case 69: // if e or E is pressed
if (e.ctrlKey) {
e.preventDefault()
if (Metamaps.Active.Map) {
Metamaps.JIT.zoomExtents(null, Metamaps.Visualize.mGraph.canvas)
}
}
break
case 77: // if m or M is pressed
if (e.ctrlKey) {
e.preventDefault()
Metamaps.Control.removeSelectedNodes()
Metamaps.Control.removeSelectedEdges()
}
break break
case 68: // if d or D is pressed case 68: // if d or D is pressed
if (e.ctrlKey) { if (e.ctrlKey) {
@ -57,6 +43,24 @@ Metamaps.Listeners = {
Metamaps.Control.deleteSelected() Metamaps.Control.deleteSelected()
} }
break break
case 69: // if e or E is pressed
if (e.ctrlKey && Metamaps.Active.Map) {
e.preventDefault()
Metamaps.JIT.zoomExtents(null, Metamaps.Visualize.mGraph.canvas)
break
}
if (e.altKey && Metamaps.Active.Topic) {
e.preventDefault()
if (Metamaps.Active.Topic) {
self.centerAndReveal(Metamaps.Selected.Nodes, {
center: true,
reveal: false
})
}
break
}
break
case 72: // if h or H is pressed case 72: // if h or H is pressed
if (e.ctrlKey) { if (e.ctrlKey) {
e.preventDefault() e.preventDefault()
@ -64,8 +68,34 @@ Metamaps.Listeners = {
Metamaps.Control.hideSelectedEdges() Metamaps.Control.hideSelectedEdges()
} }
break break
case 77: // if m or M is pressed
if (e.ctrlKey) {
e.preventDefault()
Metamaps.Control.removeSelectedNodes()
Metamaps.Control.removeSelectedEdges()
}
break
case 82: // if r or R is pressed
if (e.altKey && Metamaps.Active.Topic) {
e.preventDefault()
self.centerAndReveal(Metamaps.Selected.Nodes, {
center: false,
reveal: true
})
}
break
case 84: // if t or T is pressed
if (e.altKey && Metamaps.Active.Topic) {
e.preventDefault()
self.centerAndReveal(Metamaps.Selected.Nodes, {
center: true,
reveal: true
})
}
break
default: default:
break; // alert(e.which) // console.log(e.which)
break
} }
}) })
@ -74,5 +104,18 @@ Metamaps.Listeners = {
if ((Metamaps.Active.Map || Metamaps.Active.Topic) && Metamaps.Famous && Metamaps.Famous.maps.surf) Metamaps.Famous.maps.reposition() if ((Metamaps.Active.Map || Metamaps.Active.Topic) && Metamaps.Famous && Metamaps.Famous.maps.surf) Metamaps.Famous.maps.reposition()
if (Metamaps.Active.Map && Metamaps.Realtime.inConversation) Metamaps.Realtime.positionVideos() if (Metamaps.Active.Map && Metamaps.Realtime.inConversation) Metamaps.Realtime.positionVideos()
}) })
},
centerAndReveal: function(nodes, opts) {
if (nodes.length < 1) return
var node = nodes[nodes.length - 1]
if (opts.center && opts.reveal) {
Metamaps.Topic.centerOn(node.id, function() {
Metamaps.Topic.fetchRelatives(nodes)
})
} else if (opts.center) {
Metamaps.Topic.centerOn(node.id)
} else if (opts.reveal) {
Metamaps.Topic.fetchRelatives(nodes)
}
} }
}; // end Metamaps.Listeners }; // end Metamaps.Listeners

View file

@ -673,6 +673,8 @@ Metamaps.Map.InfoBox = {
return string return string
}, },
updateNumbers: function () { updateNumbers: function () {
if (!Metamaps.Active.Map) return
var self = Metamaps.Map.InfoBox var self = Metamaps.Map.InfoBox
var mapper = Metamaps.Active.Mapper var mapper = Metamaps.Active.Mapper
var relevantPeople = Metamaps.Active.Map.get('permission') === 'commons' ? Metamaps.Mappers : Metamaps.Collaborators var relevantPeople = Metamaps.Active.Map.get('permission') === 'commons' ? Metamaps.Mappers : Metamaps.Collaborators

View file

@ -99,16 +99,25 @@ Metamaps.Topic = {
Metamaps.Filter.close() Metamaps.Filter.close()
} }
}, },
centerOn: function (nodeid) { centerOn: function (nodeid, callback) {
// don't clash with fetchRelatives
if (!Metamaps.Visualize.mGraph.busy) { if (!Metamaps.Visualize.mGraph.busy) {
Metamaps.Visualize.mGraph.onClick(nodeid, { Metamaps.Visualize.mGraph.onClick(nodeid, {
hideLabels: false, hideLabels: false,
duration: 1000, duration: 1000,
onComplete: function () {} onComplete: function () {
if (callback) callback()
}
}) })
Metamaps.Router.navigate('/topics/' + nodeid)
Metamaps.Active.Topic = Metamaps.Topics.get(nodeid)
} }
}, },
fetchRelatives: function (node, metacode_id) { fetchRelatives: function (nodes, metacode_id) {
var self = this
var node = $.isArray(nodes) ? nodes[0] : nodes
var topics = Metamaps.Topics.map(function (t) { return t.id }) var topics = Metamaps.Topics.map(function (t) { return t.id })
var topics_string = topics.join() var topics_string = topics.join()
@ -117,7 +126,13 @@ Metamaps.Topic = {
var topic = node.getData('topic') var topic = node.getData('topic')
var successCallback = function (data) { var successCallback;
successCallback = function (data) {
if (Metamaps.Visualize.mGraph.busy) {
// don't clash with centerOn
window.setTimeout(function() { successCallback(data) }, 100)
return
}
if (data.creators.length > 0) Metamaps.Creators.add(data.creators) if (data.creators.length > 0) Metamaps.Creators.add(data.creators)
if (data.topics.length > 0) Metamaps.Topics.add(data.topics) if (data.topics.length > 0) Metamaps.Topics.add(data.topics)
if (data.synapses.length > 0) Metamaps.Synapses.add(data.synapses) if (data.synapses.length > 0) Metamaps.Synapses.add(data.synapses)
@ -153,13 +168,16 @@ Metamaps.Topic = {
} }
}) })
}) })
if ($.isArray(nodes) && nodes.length > 1) {
self.fetchRelatives(nodes.slice(1), metacode_id)
}
} }
var paramsString = metacode_id ? 'metacode=' + metacode_id + '&' : '' var paramsString = metacode_id ? 'metacode=' + metacode_id + '&' : ''
paramsString += 'network=' + topics_string + '&creators=' + creators_string paramsString += 'network=' + topics_string + '&creators=' + creators_string
$.ajax({ $.ajax({
type: 'Get', type: 'GET',
url: '/topics/' + topic.id + '/relatives.json?' + paramsString, url: '/topics/' + topic.id + '/relatives.json?' + paramsString,
success: successCallback, success: successCallback,
error: function () {} error: function () {}

View file

@ -1249,8 +1249,9 @@ h3.filterBox {
.rightclickmenu .rc-metacode > ul > li, .rightclickmenu .rc-metacode > ul > li,
.rightclickmenu .rc-siblings > ul > li { .rightclickmenu .rc-siblings > ul > li {
padding: 6px 24px 6px 8px; padding: 6px 24px 6px 8px;
width: auto;
white-space: nowrap; white-space: nowrap;
width: auto;
min-width: 5em;
} }
.rightclickmenu .rc-metacode ul ul, .rightclickmenu .rc-metacode ul ul,
.rightclickmenu .rc-siblings ul ul { .rightclickmenu .rc-siblings ul ul {

View file

@ -26,8 +26,9 @@
</ul> </ul>
<div id="csTopicView"> <div id="csTopicView">
<div class="csItem"><span class="csTitle">Recenter Topics around chosen Topic:</span> Alt + click on the topic OR Right-click + 'center this topic'</div> <div class="csItem"><span class="csTitle">Recenter Topics around chosen Topic:</span> Alt + click on the topic OR Alt + E</div>
<div class="csItem"><span class="csTitle">Reveal the siblings for a Topic:</span> Right-click and choose 'Reveal siblings' OR Alt + R</div>
<div class="csItem"><span class="csTitle">Center topic and reveal siblings:</span> Alt + T</div>
</div> </div>
<div id="csCreatingTopics"> <div id="csCreatingTopics">

View file

@ -29,30 +29,27 @@ ActiveRecord::Schema.define(version: 20_160_401_133_937) do
t.datetime 'updated_at' t.datetime 'updated_at'
end end
add_index 'delayed_jobs', %w(priority run_at), name: 'delayed_jobs_priority', using: :btree add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
create_table 'events', force: :cascade do |t| create_table "events", force: :cascade do |t|
t.string 'kind', limit: 255 t.string "kind", limit: 255
t.integer 'eventable_id' t.integer "eventable_id"
t.string 'eventable_type' t.string "eventable_type"
t.integer 'user_id' t.integer "user_id"
t.integer 'map_id' t.integer "map_id"
t.integer 'sequence_id' t.datetime "created_at"
t.datetime 'created_at' t.datetime "updated_at"
t.datetime 'updated_at'
end end
add_index 'events', %w(eventable_type eventable_id), name: 'index_events_on_eventable_type_and_eventable_id', using: :btree add_index "events", ["eventable_type", "eventable_id"], name: "index_events_on_eventable_type_and_eventable_id", using: :btree
add_index 'events', %w(map_id sequence_id), name: 'index_events_on_map_id_and_sequence_id', unique: true, using: :btree add_index "events", ["map_id"], name: "index_events_on_map_id", using: :btree
add_index 'events', ['map_id'], name: 'index_events_on_map_id', using: :btree add_index "events", ["user_id"], name: "index_events_on_user_id", using: :btree
add_index 'events', ['sequence_id'], name: 'index_events_on_sequence_id', using: :btree
add_index 'events', ['user_id'], name: 'index_events_on_user_id', using: :btree
create_table 'in_metacode_sets', force: :cascade do |t| create_table "in_metacode_sets", force: :cascade do |t|
t.integer 'metacode_id' t.integer "metacode_id"
t.integer 'metacode_set_id' t.integer "metacode_set_id"
t.datetime 'created_at', null: false t.datetime "created_at", null: false
t.datetime 'updated_at', null: false t.datetime "updated_at", null: false
end end
add_index 'in_metacode_sets', ['metacode_id'], name: 'index_in_metacode_sets_on_metacode_id', using: :btree add_index 'in_metacode_sets', ['metacode_id'], name: 'index_in_metacode_sets_on_metacode_id', using: :btree
@ -72,25 +69,25 @@ ActiveRecord::Schema.define(version: 20_160_401_133_937) do
t.string 'mappable_type' t.string 'mappable_type'
end end
add_index 'mappings', %w(map_id synapse_id), name: 'index_mappings_on_map_id_and_synapse_id', using: :btree add_index "mappings", ["map_id", "synapse_id"], name: "index_mappings_on_map_id_and_synapse_id", using: :btree
add_index 'mappings', %w(map_id topic_id), name: 'index_mappings_on_map_id_and_topic_id', using: :btree add_index "mappings", ["map_id", "topic_id"], name: "index_mappings_on_map_id_and_topic_id", using: :btree
add_index 'mappings', ['map_id'], name: 'index_mappings_on_map_id', using: :btree add_index "mappings", ["map_id"], name: "index_mappings_on_map_id", using: :btree
add_index 'mappings', %w(mappable_id mappable_type), name: 'index_mappings_on_mappable_id_and_mappable_type', using: :btree add_index "mappings", ["mappable_id", "mappable_type"], name: "index_mappings_on_mappable_id_and_mappable_type", using: :btree
add_index 'mappings', ['user_id'], name: 'index_mappings_on_user_id', using: :btree add_index "mappings", ["user_id"], name: "index_mappings_on_user_id", using: :btree
create_table 'maps', force: :cascade do |t| create_table "maps", force: :cascade do |t|
t.text 'name' t.datetime "created_at", null: false
t.boolean 'arranged' t.datetime "updated_at", null: false
t.text 'desc' t.text "name"
t.text 'permission' t.text "desc"
t.integer 'user_id' t.text "permission"
t.datetime 'created_at', null: false t.integer "user_id"
t.datetime 'updated_at', null: false t.boolean "arranged"
t.boolean 'featured' t.boolean "featured"
t.string 'screenshot_file_name' t.string "screenshot_file_name", limit: 255
t.string 'screenshot_content_type' t.string "screenshot_content_type", limit: 255
t.integer 'screenshot_file_size' t.integer "screenshot_file_size"
t.datetime 'screenshot_updated_at' t.datetime "screenshot_updated_at"
end end
add_index 'maps', ['user_id'], name: 'index_maps_on_user_id', using: :btree add_index 'maps', ['user_id'], name: 'index_maps_on_user_id', using: :btree
@ -104,31 +101,31 @@ ActiveRecord::Schema.define(version: 20_160_401_133_937) do
t.datetime 'updated_at' t.datetime 'updated_at'
end end
add_index 'messages', ['resource_id'], name: 'index_messages_on_resource_id', using: :btree add_index "messages", ["resource_id"], name: "index_messages_on_resource_id", using: :btree
add_index 'messages', ['resource_type'], name: 'index_messages_on_resource_type', using: :btree add_index "messages", ["resource_type"], name: "index_messages_on_resource_type", using: :btree
add_index 'messages', ['user_id'], name: 'index_messages_on_user_id', using: :btree add_index "messages", ["user_id"], name: "index_messages_on_user_id", using: :btree
create_table 'metacode_sets', force: :cascade do |t| create_table "metacode_sets", force: :cascade do |t|
t.string 'name' t.string "name", limit: 255
t.text 'desc' t.text "desc"
t.integer 'user_id' t.integer "user_id"
t.boolean 'mapperContributed' t.boolean "mapperContributed"
t.datetime 'created_at', null: false t.datetime "created_at", null: false
t.datetime 'updated_at', null: false t.datetime "updated_at", null: false
end end
add_index 'metacode_sets', ['user_id'], name: 'index_metacode_sets_on_user_id', using: :btree add_index "metacode_sets", ["user_id"], name: "index_metacode_sets_on_user_id", using: :btree
create_table 'metacodes', force: :cascade do |t| create_table "metacodes", force: :cascade do |t|
t.text 'name' t.text "name"
t.string 'manual_icon' t.string "manual_icon", limit: 255
t.datetime 'created_at', null: false t.datetime "created_at", null: false
t.datetime 'updated_at', null: false t.datetime "updated_at", null: false
t.string 'color' t.string "color", limit: 255
t.string 'aws_icon_file_name' t.string "aws_icon_file_name"
t.string 'aws_icon_content_type' t.string "aws_icon_content_type"
t.integer 'aws_icon_file_size' t.integer "aws_icon_file_size"
t.datetime 'aws_icon_updated_at' t.datetime "aws_icon_updated_at"
end end
create_table 'oauth_access_grants', force: :cascade do |t| create_table 'oauth_access_grants', force: :cascade do |t|
@ -169,19 +166,19 @@ ActiveRecord::Schema.define(version: 20_160_401_133_937) do
t.datetime 'updated_at' t.datetime 'updated_at'
end end
add_index 'oauth_applications', ['uid'], name: 'index_oauth_applications_on_uid', unique: true, using: :btree add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
create_table 'synapses', force: :cascade do |t| create_table "synapses", force: :cascade do |t|
t.text 'desc' t.text "desc"
t.text 'category' t.text "category"
t.text 'weight' t.integer "node1_id"
t.text 'permission' t.integer "node2_id"
t.integer 'node1_id' t.integer "user_id"
t.integer 'node2_id' t.datetime "created_at", null: false
t.integer 'user_id' t.datetime "updated_at", null: false
t.datetime 'created_at', null: false t.text "permission"
t.datetime 'updated_at', null: false t.text "weight"
t.integer 'defer_to_map_id' t.integer "defer_to_map_id"
end end
add_index 'synapses', %w(node1_id node1_id), name: 'index_synapses_on_node1_id_and_node1_id', using: :btree add_index 'synapses', %w(node1_id node1_id), name: 'index_synapses_on_node1_id_and_node1_id', using: :btree
@ -198,26 +195,26 @@ ActiveRecord::Schema.define(version: 20_160_401_133_937) do
t.datetime 'updated_at', null: false t.datetime 'updated_at', null: false
end end
add_index 'tokens', ['user_id'], name: 'index_tokens_on_user_id', using: :btree add_index "tokens", ["user_id"], name: "index_tokens_on_user_id", using: :btree
create_table 'topics', force: :cascade do |t| create_table "topics", force: :cascade do |t|
t.text 'name' t.text "name"
t.text 'desc' t.text "desc"
t.text 'link' t.text "link"
t.text 'permission' t.integer "user_id"
t.integer 'user_id' t.integer "metacode_id"
t.integer 'metacode_id' t.datetime "created_at", null: false
t.datetime 'created_at', null: false t.datetime "updated_at", null: false
t.datetime 'updated_at', null: false t.text "permission"
t.string 'image_file_name' t.string "image_file_name", limit: 255
t.string 'image_content_type' t.string "image_content_type", limit: 255
t.integer 'image_file_size' t.integer "image_file_size"
t.datetime 'image_updated_at' t.datetime "image_updated_at"
t.string 'audio_file_name' t.string "audio_file_name", limit: 255
t.string 'audio_content_type' t.string "audio_content_type", limit: 255
t.integer 'audio_file_size' t.integer "audio_file_size"
t.datetime 'audio_updated_at' t.datetime "audio_updated_at"
t.integer 'defer_to_map_id' t.integer "defer_to_map_id"
end end
add_index 'topics', ['metacode_id'], name: 'index_topics_on_metacode_id', using: :btree add_index 'topics', ['metacode_id'], name: 'index_topics_on_metacode_id', using: :btree
@ -230,37 +227,37 @@ ActiveRecord::Schema.define(version: 20_160_401_133_937) do
t.datetime 'updated_at' t.datetime 'updated_at'
end end
add_index 'user_maps', ['map_id'], name: 'index_user_maps_on_map_id', using: :btree add_index "user_maps", ["map_id"], name: "index_user_maps_on_map_id", using: :btree
add_index 'user_maps', ['user_id'], name: 'index_user_maps_on_user_id', using: :btree add_index "user_maps", ["user_id"], name: "index_user_maps_on_user_id", using: :btree
create_table 'users', force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string 'name' t.string "name", limit: 255
t.string 'email' t.string "email", limit: 255
t.text 'settings' t.string "crypted_password", limit: 255
t.string 'code', limit: 8 t.string "password_salt", limit: 255
t.string 'joinedwithcode', limit: 8 t.string "persistence_token", limit: 255
t.string 'crypted_password' t.string "perishable_token", limit: 255
t.string 'password_salt' t.datetime "created_at", null: false
t.string 'persistence_token' t.datetime "updated_at", null: false
t.string 'perishable_token' t.string "code", limit: 8
t.datetime 'created_at', null: false t.string "joinedwithcode", limit: 8
t.datetime 'updated_at', null: false t.text "settings"
t.string 'encrypted_password', limit: 128, default: '' t.string "encrypted_password", limit: 128, default: ""
t.string 'remember_token' t.string "remember_token", limit: 255
t.datetime 'remember_created_at' t.datetime "remember_created_at"
t.string 'reset_password_token' t.string "reset_password_token", limit: 255
t.datetime 'last_sign_in_at' t.datetime "last_sign_in_at"
t.string 'last_sign_in_ip' t.string "last_sign_in_ip", limit: 255
t.integer 'sign_in_count', default: 0 t.integer "sign_in_count", default: 0
t.datetime 'current_sign_in_at' t.datetime "current_sign_in_at"
t.string 'current_sign_in_ip' t.string "current_sign_in_ip", limit: 255
t.datetime 'reset_password_sent_at' t.datetime "reset_password_sent_at"
t.boolean 'admin' t.boolean "admin"
t.string 'image_file_name' t.string "image_file_name", limit: 255
t.string 'image_content_type' t.string "image_content_type", limit: 255
t.integer 'image_file_size' t.integer "image_file_size"
t.datetime 'image_updated_at' t.datetime "image_updated_at"
t.integer 'generation' t.integer "generation"
end end
add_index 'users', ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true, using: :btree add_index 'users', ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true, using: :btree

View file

@ -2,7 +2,7 @@
const chai = require('chai') const chai = require('chai')
const expect = chai.expect const expect = chai.expect
const Metamaps = {} Metamaps = {}
require('../../app/assets/javascripts/src/Metamaps.Import') require('../../app/assets/javascripts/src/Metamaps.Import')
describe('Metamaps.Import.js', function () { describe('Metamaps.Import.js', function () {

View file

@ -0,0 +1,8 @@
namespace :assets do
task :js_compile do
system "npm install"
system "npm run build"
end
end
Rake::Task[:'assets:precompile'].enhance([:'assets:js_compile'])

View file

@ -1,11 +1,11 @@
{ {
"name": "metamaps-frontend", "name": "metamaps",
"version": "1.0.0", "version": "1.0.0",
"description": "Metamaps frontend - currently just tests", "description": "Metamaps webpacked javascript code",
"scripts": { "scripts": {
"build": "webpack", "build": "webpack",
"build:watch": "webpack --watch", "build:watch": "webpack --watch",
"test": "mocha test || echo 'Run `npm install` to setup testing'" "test": "mocha frontend/test || (echo 'Run `npm install` to setup testing' && false)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -17,21 +17,20 @@
"url": "https://github.com/metamaps/metamaps/issues" "url": "https://github.com/metamaps/metamaps/issues"
}, },
"homepage": "https://github.com/metamaps/metamaps#readme", "homepage": "https://github.com/metamaps/metamaps#readme",
"devDependencies": { "dependencies": {
"babel-cli": "^6.11.4", "babel-cli": "^6.11.4",
"babel-loader": "^6.2.4", "babel-loader": "^6.2.4",
"babel-plugin-transform-class-properties": "^6.11.5", "babel-plugin-transform-class-properties": "^6.11.5",
"babel-preset-es2015": "^6.9.0", "babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1", "babel-preset-react": "^6.11.1",
"backbone": "^1.0.0",
"chai": "^3.5.0", "chai": "^3.5.0",
"jquery": "^1.12.1", "jquery": "^1.12.1",
"mocha": "^2.4.5", "mocha": "^2.4.5",
"webpack": "^1.13.1"
},
"dependencies": {
"backbone": "1.0.0",
"react": "^15.3.0", "react": "^15.3.0",
"react-dom": "^15.3.0", "react-dom": "^15.3.0",
"underscore": "1.4.4" "requirejs": "^2.1.1",
"underscore": "^1.4.4",
"webpack": "^1.13.1"
} }
} }