remove Metamaps.Erb
This commit is contained in:
parent
7c9b6a2205
commit
518782e1c7
11 changed files with 41 additions and 81 deletions
18
app/assets/javascripts/Metamaps.ServerData.js.erb
Normal file
18
app/assets/javascripts/Metamaps.ServerData.js.erb
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* global Metamaps */
|
||||
|
||||
/* erb variables from rails */
|
||||
Metamaps.ServerData = Metamaps.ServerData || {}
|
||||
Metamaps.ServerData['junto_spinner_darkgrey.gif'] = '<%= asset_path('junto_spinner_darkgrey.gif') %>'
|
||||
Metamaps.ServerData['user.png'] = '<%= asset_path('user.png') %>'
|
||||
Metamaps.ServerData['icons/wildcard.png'] = '<%= asset_path('icons/wildcard.png') %>'
|
||||
Metamaps.ServerData['topic_description_signifier.png'] = '<%= asset_path('topic_description_signifier.png') %>'
|
||||
Metamaps.ServerData['topic_link_signifier.png'] = '<%= asset_path('topic_link_signifier.png') %>'
|
||||
Metamaps.ServerData['synapse16.png'] = '<%= asset_path('synapse16.png') %>'
|
||||
Metamaps.ServerData['sounds/MM_sounds.mp3'] = '<%= asset_path 'sounds/MM_sounds.mp3' %>'
|
||||
Metamaps.ServerData['sounds/MM_sounds.ogg'] = '<%= asset_path 'sounds/MM_sounds.ogg' %>'
|
||||
Metamaps.ServerData.Metacodes = <%= Metacode.all.to_json.gsub(%r[(icon.*?)(\"},)], '\1?purple=stupid\2').html_safe %>
|
||||
Metamaps.ServerData.REALTIME_SERVER = '<%= ENV['REALTIME_SERVER'] %>'
|
||||
Metamaps.ServerData.RAILS_ENV = '<%= ENV['RAILS_ENV'] %>'
|
||||
Metamaps.ServerData.VERSION = '<%= METAMAPS_VERSION %>'
|
||||
Metamaps.ServerData.BUILD = '<%= METAMAPS_BUILD %>'
|
||||
Metamaps.ServerData.LAST_UPDATED = '<%= METAMAPS_LAST_UPDATED %>'
|
|
@ -14,5 +14,5 @@
|
|||
//= require jquery-ui
|
||||
//= require jquery_ujs
|
||||
//= require_directory ./lib
|
||||
//= require ./src/Metamaps.Erb
|
||||
//= require ./webpacked/metamaps.bundle
|
||||
//= require ./Metamaps.ServerData
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* global Metamaps */
|
||||
|
||||
/*
|
||||
* Metamaps.Erb.js.erb
|
||||
*/
|
||||
|
||||
/* erb variables from rails */
|
||||
window.Metamaps = window.Metamaps || {}
|
||||
Metamaps.Erb = {}
|
||||
Metamaps.Erb['REALTIME_SERVER'] = '<%= ENV['REALTIME_SERVER'] %>'
|
||||
Metamaps.Erb['RAILS_ENV'] = '<%= ENV['RAILS_ENV'] %>'
|
||||
Metamaps.Erb['junto_spinner_darkgrey.gif'] = '<%= asset_path('junto_spinner_darkgrey.gif') %>'
|
||||
Metamaps.Erb['user.png'] = '<%= asset_path('user.png') %>'
|
||||
Metamaps.Erb['icons/wildcard.png'] = '<%= asset_path('icons/wildcard.png') %>'
|
||||
Metamaps.Erb['topic_description_signifier.png'] = '<%= asset_path('topic_description_signifier.png') %>'
|
||||
Metamaps.Erb['topic_link_signifier.png'] = '<%= asset_path('topic_link_signifier.png') %>'
|
||||
Metamaps.Erb['synapse16.png'] = '<%= asset_path('synapse16.png') %>'
|
||||
Metamaps.Erb['import-example.png'] = '<%= asset_path('import-example.png') %>'
|
||||
Metamaps.Erb['sounds/MM_sounds.mp3'] = '<%= asset_path 'sounds/MM_sounds.mp3' %>'
|
||||
Metamaps.Erb['sounds/MM_sounds.ogg'] = '<%= asset_path 'sounds/MM_sounds.ogg' %>'
|
||||
Metamaps.Metacodes = <%= Metacode.all.to_json.gsub(%r[(icon.*?)(\"},)], '\1?purple=stupid\2').html_safe %>
|
||||
Metamaps.VERSION = '<%= METAMAPS_VERSION %>'
|
||||
Metamaps.BUILD = '<%= METAMAPS_BUILD %>'
|
||||
Metamaps.LAST_UPDATED = '<%= METAMAPS_LAST_UPDATED %>'
|
|
@ -1,17 +1,17 @@
|
|||
/* global $, CanvasLoader */
|
||||
|
||||
/*
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
|
||||
const Account = {
|
||||
listenersInitialized: false,
|
||||
userIconUrl: null,
|
||||
initListeners: function () {
|
||||
var self = Account
|
||||
|
||||
$('#user_image').change(self.showImagePreview)
|
||||
self.listenersInitialized = true
|
||||
},
|
||||
init: function (serverData) {
|
||||
Account.userIconUrl = serverData['user.png']
|
||||
},
|
||||
toggleChangePicture: function () {
|
||||
var self = Account
|
||||
|
||||
|
@ -25,24 +25,18 @@ const Account = {
|
|||
if (!self.listenersInitialized) self.initListeners()
|
||||
},
|
||||
closeChangePicture: function () {
|
||||
var self = Account
|
||||
|
||||
$('.userImageMenu').hide()
|
||||
},
|
||||
showLoading: function () {
|
||||
var self = Account
|
||||
|
||||
var loader = new CanvasLoader('accountPageLoading')
|
||||
loader.setColor('#4FC059'); // default is '#000000'
|
||||
loader.setColor('#4FC059') // default is '#000000'
|
||||
loader.setDiameter(28) // default is 40
|
||||
loader.setDensity(41) // default is 40
|
||||
loader.setRange(0.9); // default is 1.3
|
||||
loader.setRange(0.9) // default is 1.3
|
||||
loader.show() // Hidden by default
|
||||
$('#accountPageLoading').show()
|
||||
},
|
||||
showImagePreview: function () {
|
||||
var self = Account
|
||||
|
||||
var file = $('#user_image')[0].files[0]
|
||||
|
||||
var reader = new window.FileReader()
|
||||
|
@ -90,7 +84,7 @@ const Account = {
|
|||
var self = Account
|
||||
|
||||
$('.userImageDiv canvas').remove()
|
||||
$('.userImageDiv img').attr('src', window.Metamaps.Erb['user.png']).show()
|
||||
$('.userImageDiv img').attr('src', self.userIconUrl).show()
|
||||
$('.userImageMenu').hide()
|
||||
|
||||
var input = $('#user_image')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global Metamaps, $ */
|
||||
/* global $ */
|
||||
|
||||
import _ from 'lodash'
|
||||
import Backbone from 'backbone'
|
||||
|
@ -13,10 +13,6 @@ import Visualize from '../Visualize'
|
|||
|
||||
import DataModel from './index'
|
||||
|
||||
/*
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
|
||||
const Synapse = Backbone.Model.extend({
|
||||
urlRoot: '/synapses',
|
||||
blacklist: ['edge', 'created_at', 'updated_at'],
|
||||
|
@ -82,7 +78,7 @@ const Synapse = Backbone.Model.extend({
|
|||
prepareLiForFilter: function () {
|
||||
var li = ''
|
||||
li += '<li data-id="' + this.get('desc') + '">'
|
||||
li += '<img src="' + Metamaps.Erb['synapse16.png'] + '"'
|
||||
li += '<img src="' + Metamaps.ServerData['synapse16.png'] + '"'
|
||||
li += ' alt="synapse icon" />'
|
||||
li += '<p>' + this.get('desc') + '</p></li>'
|
||||
return li
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
/* global Metamaps, $, Hogan, Bloodhound, CanvasLoader */
|
||||
/* global $, Hogan, Bloodhound, CanvasLoader */
|
||||
|
||||
import Active from '../Active'
|
||||
import Router from '../Router'
|
||||
|
||||
/*
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
|
||||
const Search = {
|
||||
locked: false,
|
||||
isOpen: false,
|
||||
|
@ -54,7 +50,7 @@ const Search = {
|
|||
return Hogan.compile(topicheader + $('#topicSearchTemplate').html()).render({
|
||||
value: 'No results',
|
||||
label: 'No results',
|
||||
typeImageURL: Metamaps.Erb['icons/wildcard.png'],
|
||||
typeImageURL: Metamaps.ServerData['icons/wildcard.png'],
|
||||
rtype: 'noresult'
|
||||
})
|
||||
},
|
||||
|
@ -122,7 +118,7 @@ const Search = {
|
|||
value: 'No results',
|
||||
label: 'No results',
|
||||
rtype: 'noresult',
|
||||
profile: Metamaps.Erb['user.png']
|
||||
profile: Metamaps.ServerData['user.png']
|
||||
})
|
||||
},
|
||||
header: mapperheader,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global Metamaps, $, Image, CanvasLoader */
|
||||
/* global $, Image, CanvasLoader */
|
||||
|
||||
import _ from 'lodash'
|
||||
import outdent from 'outdent'
|
||||
|
@ -24,10 +24,6 @@ import Util from './Util'
|
|||
import Visualize from './Visualize'
|
||||
import clipboard from 'clipboard-js'
|
||||
|
||||
/*
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
|
||||
let panningInt
|
||||
|
||||
const JIT = {
|
||||
|
@ -69,10 +65,10 @@ const JIT = {
|
|||
$('.takeScreenshot').click(Map.exportImage)
|
||||
|
||||
self.topicDescImage = new Image()
|
||||
self.topicDescImage.src = Metamaps.Erb['topic_description_signifier.png']
|
||||
self.topicDescImage.src = Metamaps.ServerData['topic_description_signifier.png']
|
||||
|
||||
self.topicLinkImage = new Image()
|
||||
self.topicLinkImage.src = Metamaps.Erb['topic_link_signifier.png']
|
||||
self.topicLinkImage.src = Metamaps.ServerData['topic_link_signifier.png']
|
||||
},
|
||||
/**
|
||||
* convert our topic JSON into something JIT can use
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global Metamaps, $, Hogan, Bloodhound, Countable */
|
||||
/* global $, Hogan, Bloodhound, Countable */
|
||||
|
||||
import outdent from 'outdent'
|
||||
|
||||
|
@ -8,10 +8,6 @@ import GlobalUI from '../GlobalUI'
|
|||
import Router from '../Router'
|
||||
import Util from '../Util'
|
||||
|
||||
/*
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
|
||||
const InfoBox = {
|
||||
isOpen: false,
|
||||
changing: false,
|
||||
|
@ -112,7 +108,7 @@ const InfoBox = {
|
|||
obj['contributor_count'] = relevantPeople.length
|
||||
obj['contributors_class'] = relevantPeople.length > 1 ? 'multiple' : ''
|
||||
obj['contributors_class'] += relevantPeople.length === 2 ? ' mTwo' : ''
|
||||
obj['contributor_image'] = relevantPeople.length > 0 ? relevantPeople.models[0].get('image') : Metamaps.Erb['user.png']
|
||||
obj['contributor_image'] = relevantPeople.length > 0 ? relevantPeople.models[0].get('image') : Metamaps.ServerData['user.png']
|
||||
obj['contributor_list'] = self.createContributorList()
|
||||
|
||||
obj['user_name'] = isCreator ? 'You' : map.get('user_name')
|
||||
|
@ -214,7 +210,7 @@ const InfoBox = {
|
|||
value: "No results",
|
||||
label: "No results",
|
||||
rtype: "noresult",
|
||||
profile: Metamaps.Erb['user.png'],
|
||||
profile: Metamaps.ServerData['user.png'],
|
||||
});
|
||||
},
|
||||
suggestion: function(s) {
|
||||
|
@ -317,7 +313,7 @@ const InfoBox = {
|
|||
if (relevantPeople.length === 2) contributors_class = 'multiple mTwo'
|
||||
else if (relevantPeople.length > 2) contributors_class = 'multiple'
|
||||
|
||||
var contributors_image = Metamaps.Erb['user.png']
|
||||
var contributors_image = Metamaps.ServerData['user.png']
|
||||
if (relevantPeople.length > 0) {
|
||||
// get the first contributor and use their image
|
||||
contributors_image = relevantPeople.models[0].get('image')
|
||||
|
|
|
@ -21,13 +21,6 @@ import Visualize from '../Visualize'
|
|||
import CheatSheet from './CheatSheet'
|
||||
import InfoBox from './InfoBox'
|
||||
|
||||
/*
|
||||
* Metamaps.Map.js.erb
|
||||
*
|
||||
* Dependencies:
|
||||
* - Metamaps.Erb
|
||||
*/
|
||||
|
||||
const Map = {
|
||||
events: {
|
||||
editedByActiveMapper: 'Metamaps:Map:events:editedByActiveMapper'
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
/* global Metamaps, $ */
|
||||
|
||||
/*
|
||||
* Dependencies:
|
||||
* Metamaps.Erb
|
||||
*/
|
||||
/* global $ */
|
||||
|
||||
import Backbone from 'backbone'
|
||||
import { Howl } from 'howler'
|
||||
|
@ -128,7 +123,7 @@ var Private = {
|
|||
},
|
||||
initializeSounds: function () {
|
||||
this.sound = new Howl({
|
||||
src: [Metamaps.Erb['sounds/MM_sounds.mp3'], Metamaps.Erb['sounds/MM_sounds.ogg']],
|
||||
src: [Metamaps.ServerData['sounds/MM_sounds.mp3'], Metamaps.ServerData['sounds/MM_sounds.ogg']],
|
||||
sprite: {
|
||||
joinmap: [0, 561],
|
||||
leavemap: [1000, 592],
|
||||
|
|
|
@ -3261,7 +3261,7 @@ var Canvas;
|
|||
ctx = base.getCtx(),
|
||||
scale = base.scaleOffsetX;
|
||||
//var pattern = new Image();
|
||||
//pattern.src = Metamaps.Erb['cubes.png']
|
||||
//pattern.src = Metamaps.ServerData['cubes.png']
|
||||
//var ptrn = ctx.createPattern(pattern, 'repeat');
|
||||
//ctx.fillStyle = ptrn;
|
||||
ctx.fillStyle = Metamaps.Settings.colors.background;
|
||||
|
|
Loading…
Reference in a new issue