move Metamaps.Loading into node modules
This commit is contained in:
parent
0778179ba7
commit
4b500a4428
10 changed files with 41 additions and 41 deletions
|
@ -2,28 +2,13 @@
|
||||||
<%= render :partial => 'layouts/templates' %>
|
<%= render :partial => 'layouts/templates' %>
|
||||||
<%= render :partial => 'shared/metacodeBgColors' %>
|
<%= render :partial => 'shared/metacodeBgColors' %>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
// TODO move this into Metamaps.ServerData somehow
|
<% if current_user %>
|
||||||
<% if current_user %>
|
Metamaps.Active.Mapper = <%= current_user.to_json.html_safe %>
|
||||||
Metamaps.Active.Mapper = <%= current_user.to_json.html_safe %>
|
<% else %>
|
||||||
<% else %>
|
Metamaps.Active.Mapper = null;
|
||||||
Metamaps.Active.Mapper = null;
|
<% end %>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
// TODO move this into frontend/
|
Metamaps.Loading.setup()
|
||||||
Metamaps.Loading = {
|
|
||||||
loader: new CanvasLoader('loading'),
|
|
||||||
hide: function () {
|
|
||||||
$('#loading').hide();
|
|
||||||
},
|
|
||||||
show: function () {
|
|
||||||
$('#loading').show();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Metamaps.Loading.loader.setColor('#4fb5c0'); // default is '#000000'
|
|
||||||
Metamaps.Loading.loader.setDiameter(28); // default is 40
|
|
||||||
Metamaps.Loading.loader.setDensity(41); // default is 40
|
|
||||||
Metamaps.Loading.loader.setRange(0.9); // default is 1.3
|
|
||||||
Metamaps.Loading.loader.show(); // Hidden by default
|
|
||||||
</script>
|
</script>
|
||||||
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
|
<%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -3,12 +3,9 @@
|
||||||
import Backbone from 'backbone'
|
import Backbone from 'backbone'
|
||||||
Backbone.$ = window.$
|
Backbone.$ = window.$
|
||||||
|
|
||||||
import Map from './Map'
|
import Loading from '../Loading'
|
||||||
|
|
||||||
/*
|
import Map from './Map'
|
||||||
* Dependencies:
|
|
||||||
* - Metamaps.Loading
|
|
||||||
*/
|
|
||||||
|
|
||||||
const MapCollection = Backbone.Collection.extend({
|
const MapCollection = Backbone.Collection.extend({
|
||||||
model: Map,
|
model: Map,
|
||||||
|
@ -50,7 +47,7 @@ const MapCollection = Backbone.Collection.extend({
|
||||||
getMaps: function (cb) {
|
getMaps: function (cb) {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
Metamaps.Loading.show()
|
Loading.show()
|
||||||
|
|
||||||
if (this.page !== 'loadedAll') {
|
if (this.page !== 'loadedAll') {
|
||||||
var numBefore = this.length
|
var numBefore = this.length
|
||||||
|
|
|
@ -25,7 +25,6 @@ import MappingCollection from './MappingCollection'
|
||||||
* Dependencies:
|
* Dependencies:
|
||||||
* - Metamaps.Collaborators
|
* - Metamaps.Collaborators
|
||||||
* - Metamaps.Creators
|
* - Metamaps.Creators
|
||||||
* - Metamaps.Loading
|
|
||||||
* - Metamaps.Mappers
|
* - Metamaps.Mappers
|
||||||
* - Metamaps.Mappings
|
* - Metamaps.Mappings
|
||||||
* - Metamaps.Metacodes
|
* - Metamaps.Metacodes
|
||||||
|
|
|
@ -18,8 +18,7 @@ const Search = {
|
||||||
init: function () {
|
init: function () {
|
||||||
var self = Search
|
var self = Search
|
||||||
|
|
||||||
// TODO does this overlap with Metamaps.Loading?
|
// this is similar to Metamaps.Loading, but it's for the search element
|
||||||
// devin sez: I'd like to remove Metamaps.Loading from the rails code
|
|
||||||
var loader = new CanvasLoader('searchLoading')
|
var loader = new CanvasLoader('searchLoading')
|
||||||
loader.setColor('#4fb5c0') // default is '#000000'
|
loader.setColor('#4fb5c0') // default is '#000000'
|
||||||
loader.setDiameter(24) // default is 40
|
loader.setDiameter(24) // default is 40
|
||||||
|
|
20
frontend/src/Metamaps/Loading.js
Normal file
20
frontend/src/Metamaps/Loading.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/* global CanvasLoader, $ */
|
||||||
|
|
||||||
|
const Loading = {
|
||||||
|
loader: new CanvasLoader('loading'),
|
||||||
|
hide: function () {
|
||||||
|
$('#loading').hide();
|
||||||
|
},
|
||||||
|
show: function () {
|
||||||
|
$('#loading').show();
|
||||||
|
},
|
||||||
|
setup: function () {
|
||||||
|
Loading.loader.setColor('#4fb5c0'); // default is '#000000'
|
||||||
|
Loading.loader.setDiameter(28); // default is 40
|
||||||
|
Loading.loader.setDensity(41); // default is 40
|
||||||
|
Loading.loader.setRange(0.9); // default is 1.3
|
||||||
|
Loading.loader.show(); // Hidden by default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Loading
|
|
@ -8,6 +8,7 @@ import Create from '../Create'
|
||||||
import Filter from '../Filter'
|
import Filter from '../Filter'
|
||||||
import GlobalUI from '../GlobalUI'
|
import GlobalUI from '../GlobalUI'
|
||||||
import JIT from '../JIT'
|
import JIT from '../JIT'
|
||||||
|
import Loading from '../Loading'
|
||||||
import Realtime from '../Realtime'
|
import Realtime from '../Realtime'
|
||||||
import Router from '../Router'
|
import Router from '../Router'
|
||||||
import Selected from '../Selected'
|
import Selected from '../Selected'
|
||||||
|
@ -24,7 +25,6 @@ import InfoBox from './InfoBox'
|
||||||
* Dependencies:
|
* Dependencies:
|
||||||
* - Metamaps.DataModel
|
* - Metamaps.DataModel
|
||||||
* - Metamaps.Erb
|
* - Metamaps.Erb
|
||||||
* - Metamaps.Loading
|
|
||||||
* - Metamaps.Mappers
|
* - Metamaps.Mappers
|
||||||
* - Metamaps.Mappings
|
* - Metamaps.Mappings
|
||||||
* - Metamaps.Maps
|
* - Metamaps.Maps
|
||||||
|
@ -136,7 +136,7 @@ const Map = {
|
||||||
Filter.checkMappers()
|
Filter.checkMappers()
|
||||||
|
|
||||||
Realtime.startActiveMap()
|
Realtime.startActiveMap()
|
||||||
Metamaps.Loading.hide()
|
Loading.hide()
|
||||||
|
|
||||||
// for mobile
|
// for mobile
|
||||||
$('#header_content').html(map.get('name'))
|
$('#header_content').html(map.get('name'))
|
||||||
|
|
|
@ -6,6 +6,7 @@ import Backbone from 'backbone'
|
||||||
|
|
||||||
import Active from './Active'
|
import Active from './Active'
|
||||||
import GlobalUI from './GlobalUI'
|
import GlobalUI from './GlobalUI'
|
||||||
|
import Loading from './Loading'
|
||||||
import Map from './Map'
|
import Map from './Map'
|
||||||
import Topic from './Topic'
|
import Topic from './Topic'
|
||||||
import Views from './Views'
|
import Views from './Views'
|
||||||
|
@ -15,7 +16,6 @@ import Visualize from './Visualize'
|
||||||
* Metamaps.Router.js.erb
|
* Metamaps.Router.js.erb
|
||||||
*
|
*
|
||||||
* Dependencies:
|
* Dependencies:
|
||||||
* - Metamaps.Loading
|
|
||||||
* - Metamaps.Maps
|
* - Metamaps.Maps
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ const _Router = Backbone.Router.extend({
|
||||||
self.timeoutId = setTimeout(navigate, 300)
|
self.timeoutId = setTimeout(navigate, 300)
|
||||||
}
|
}
|
||||||
if (Metamaps.Maps[capitalize].length === 0) {
|
if (Metamaps.Maps[capitalize].length === 0) {
|
||||||
Metamaps.Loading.show()
|
Loading.show()
|
||||||
Views.ExploreMaps.pending = true
|
Views.ExploreMaps.pending = true
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
Metamaps.Maps[capitalize].getMaps(navigate) // this will trigger an explore maps render
|
Metamaps.Maps[capitalize].getMaps(navigate) // this will trigger an explore maps render
|
||||||
|
@ -178,7 +178,7 @@ const _Router = Backbone.Router.extend({
|
||||||
Topic.end()
|
Topic.end()
|
||||||
Active.Topic = null
|
Active.Topic = null
|
||||||
|
|
||||||
Metamaps.Loading.show()
|
Loading.show()
|
||||||
Map.end()
|
Map.end()
|
||||||
Map.launch(id)
|
Map.launch(id)
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,12 +6,9 @@ import ReactDOM from 'react-dom' // TODO ensure this isn't a double import
|
||||||
import Active from '../Active'
|
import Active from '../Active'
|
||||||
import GlobalUI from '../GlobalUI'
|
import GlobalUI from '../GlobalUI'
|
||||||
import Realtime from '../Realtime'
|
import Realtime from '../Realtime'
|
||||||
|
import Loading from '../Loading'
|
||||||
import Maps from '../../components/Maps'
|
import Maps from '../../components/Maps'
|
||||||
|
|
||||||
/*
|
|
||||||
* - Metamaps.Loading
|
|
||||||
*/
|
|
||||||
|
|
||||||
const ExploreMaps = {
|
const ExploreMaps = {
|
||||||
pending: false,
|
pending: false,
|
||||||
mapper: null,
|
mapper: null,
|
||||||
|
@ -63,6 +60,7 @@ const ExploreMaps = {
|
||||||
).resize()
|
).resize()
|
||||||
|
|
||||||
if (cb) cb()
|
if (cb) cb()
|
||||||
|
Loading.hide()
|
||||||
},
|
},
|
||||||
loadMore: function () {
|
loadMore: function () {
|
||||||
var self = ExploreMaps
|
var self = ExploreMaps
|
||||||
|
|
|
@ -6,6 +6,7 @@ import $jit from '../patched/JIT'
|
||||||
|
|
||||||
import Active from './Active'
|
import Active from './Active'
|
||||||
import JIT from './JIT'
|
import JIT from './JIT'
|
||||||
|
import Loading from './Loading'
|
||||||
import Router from './Router'
|
import Router from './Router'
|
||||||
import TopicCard from './TopicCard'
|
import TopicCard from './TopicCard'
|
||||||
|
|
||||||
|
@ -13,7 +14,6 @@ import TopicCard from './TopicCard'
|
||||||
* Metamaps.Visualize
|
* Metamaps.Visualize
|
||||||
*
|
*
|
||||||
* Dependencies:
|
* Dependencies:
|
||||||
* - Metamaps.Loading
|
|
||||||
* - Metamaps.Metacodes
|
* - Metamaps.Metacodes
|
||||||
* - Metamaps.Synapses
|
* - Metamaps.Synapses
|
||||||
* - Metamaps.Topics
|
* - Metamaps.Topics
|
||||||
|
@ -161,7 +161,7 @@ const Visualize = {
|
||||||
if (self.type == 'ForceDirected' && Active.Mapper) $.post('/maps/' + Active.Map.id + '/events/user_presence')
|
if (self.type == 'ForceDirected' && Active.Mapper) $.post('/maps/' + Active.Map.id + '/events/user_presence')
|
||||||
|
|
||||||
function runAnimation () {
|
function runAnimation () {
|
||||||
Metamaps.Loading.hide()
|
Loading.hide()
|
||||||
// load JSON data, if it's not empty
|
// load JSON data, if it's not empty
|
||||||
if (!self.loadLater) {
|
if (!self.loadLater) {
|
||||||
// load JSON data.
|
// load JSON data.
|
||||||
|
|
|
@ -15,6 +15,7 @@ import GlobalUI, {
|
||||||
import Import from './Import'
|
import Import from './Import'
|
||||||
import JIT from './JIT'
|
import JIT from './JIT'
|
||||||
import Listeners from './Listeners'
|
import Listeners from './Listeners'
|
||||||
|
import Loading from './Loading'
|
||||||
import Map, { CheatSheet, InfoBox } from './Map'
|
import Map, { CheatSheet, InfoBox } from './Map'
|
||||||
import Mapper from './Mapper'
|
import Mapper from './Mapper'
|
||||||
import Mobile from './Mobile'
|
import Mobile from './Mobile'
|
||||||
|
@ -51,6 +52,7 @@ Metamaps.GlobalUI.ImportDialog = ImportDialog
|
||||||
Metamaps.Import = Import
|
Metamaps.Import = Import
|
||||||
Metamaps.JIT = JIT
|
Metamaps.JIT = JIT
|
||||||
Metamaps.Listeners = Listeners
|
Metamaps.Listeners = Listeners
|
||||||
|
Metamaps.Loading = Loading
|
||||||
Metamaps.Map = Map
|
Metamaps.Map = Map
|
||||||
Metamaps.Map.CheatSheet = CheatSheet
|
Metamaps.Map.CheatSheet = CheatSheet
|
||||||
Metamaps.Map.InfoBox = InfoBox
|
Metamaps.Map.InfoBox = InfoBox
|
||||||
|
|
Loading…
Reference in a new issue