Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules/
.idea
.idea
private/credentials.json
private/token.json
*.pem
1 change: 1 addition & 0 deletions .meteor/.finished-upgraders
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ notices-for-facebook-graph-api-2
1.4.1-add-shell-server-package
1.4.3-split-account-service-packages
1.5-add-dynamic-import-package
1.7-split-underscore-from-meteor-base
Empty file modified .meteor/.gitignore
100644 → 100755
Empty file.
Empty file modified .meteor/.id
100644 → 100755
Empty file.
17 changes: 9 additions & 8 deletions .meteor/packages
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor-base@1.3.0 # Packages every Meteor app needs to have
meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.0.5 # Packages for a great mobile UX
mongo@1.4.2 # The database Meteor supports right now
mongo@1.5.0 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.1.3 # Meteor's client-side reactive programming library
tracker@1.2.0 # Meteor's client-side reactive programming library

standard-minifier-css@1.4.0 # CSS minifier run for production mode
standard-minifier-js@2.3.1 # JS minifier run for production mode
es5-shim@4.7.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.10.6 # Enable ECMAScript2015+ syntax in app code
standard-minifier-css@1.4.1 # CSS minifier run for production mode
standard-minifier-js@2.3.4 # JS minifier run for production mode
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers
ecmascript@0.11.1 # Enable ECMAScript2015+ syntax in app code
shell-server@0.3.1 # Server-side component of the `meteor shell` command

autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
session
session@1.1.7
underscore
Empty file modified .meteor/platforms
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion .meteor/release
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@
METEOR@1.6.1.1
METEOR@1.7.0.4
49 changes: 24 additions & 25 deletions .meteor/versions
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
allow-deny@1.1.0
autopublish@1.0.7
autoupdate@1.4.0
babel-compiler@7.0.8
babel-runtime@1.2.2
babel-compiler@7.1.1
babel-runtime@1.2.4
base64@1.0.11
binary-heap@1.0.10
blaze@2.3.2
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.4.0
caching-compiler@1.1.11
boilerplate-generator@1.5.0
caching-compiler@1.1.12
caching-html-compiler@1.1.2
callback-hook@1.1.0
check@1.3.1
ddp@1.4.0
ddp-client@2.3.2
ddp-common@1.4.0
ddp-server@2.1.2
ddp-server@2.2.0
deps@1.0.12
diff-sequence@1.1.0
dynamic-import@0.3.0
ecmascript@0.10.8
ecmascript-runtime@0.5.0
ecmascript-runtime-client@0.6.2
ecmascript-runtime-server@0.5.0
dynamic-import@0.4.0
ecmascript@0.11.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.7.1
ecmascript-runtime-server@0.7.0
ejson@1.1.0
es5-shim@4.7.3
es5-shim@4.8.0
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
Expand All @@ -37,44 +37,43 @@ jquery@1.11.11
launch-screen@1.1.1
livedata@1.0.18
logging@1.1.20
meteor@1.8.6
meteor-base@1.3.0
meteor@1.9.0
meteor-base@1.4.0
minifier-css@1.3.1
minifier-js@2.3.4
minifier-js@2.3.5
minimongo@1.4.4
mobile-experience@1.0.5
mobile-status-bar@1.0.14
modules@0.11.6
modules-runtime@0.9.2
mongo@1.4.7
modern-browsers@0.1.2
modules@0.12.2
modules-runtime@0.10.0
mongo@1.5.0
mongo-dev-server@1.1.0
mongo-id@1.0.7
npm-mongo@2.2.34
npm-mongo@3.0.11
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.10.2
promise@0.11.1
random@1.1.0
reactive-dict@1.2.0
reactive-var@1.0.11
reload@1.2.0
retry@1.1.0
routepolicy@1.0.13
server-render@0.3.0
session@1.1.7
shell-server@0.3.1
shim-common@0.1.0
socket-stream-client@0.1.0
socket-stream-client@0.2.1
spacebars@1.0.15
spacebars-compiler@1.1.3
standard-minifier-css@1.4.1
standard-minifier-js@2.3.3
standard-minifier-js@2.3.4
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tracker@1.1.3
tracker@1.2.0
ui@1.0.13
underscore@1.0.10
url@1.2.0
webapp@1.5.0
webapp@1.6.0
webapp-hashing@1.0.9
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
71 changes: 71 additions & 0 deletions app-deploy/mup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module.exports = {
servers: {
one: {
// TODO: set host address, username, and authentication method
host: '52.16.238.92',
username: 'ubuntu',
pem: 'happiness-tool.pem'
// password: 'server-password'
// or neither for authenticate from ssh-agent
}
},
proxy: {
domains: 'happiness.newthings.co',
ssl: {
// Enable let's encrypt to create free certificates.
// The email is used by Let's Encrypt to notify you when the
// certificates are close to expiring.
letsEncryptEmail: 'laurens.muller@newthings.co'
}
},
app: {
// TODO: change app name and path
name: 'newthingsco-happiness-tool',
path: '../',

servers: {
one: {},
},

buildOptions: {
serverOnly: true,
},

env: {
// TODO: Change to your app's url
// If you are using ssl, it needs to start with https://
ROOT_URL: 'https://happiness.newthings.co',
MONGO_URL: 'mongodb://mongodb/meteor',
MONGO_OPLOG_URL: 'mongodb://mongodb/local',
},

docker: {
// change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
image: 'abernix/meteord:node-8.4.0-base',
},

// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true
},

mongo: {
version: '3.4.1',
servers: {
one: {}
}
},

// (Optional)
// Use the proxy to setup ssl or to route requests to the correct
// app when there are several apps

// proxy: {
// domains: 'mywebsite.com,www.mywebsite.com',

// ssl: {
// // Enable Let's Encrypt
// letsEncryptEmail: 'email@domain.com'
// }
// }
};
5 changes: 5 additions & 0 deletions app-deploy/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"public": {

}
}
Empty file modified client/main.css
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions client/main.html
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<head>
<title>Talented Monthly Happiness Map</title>
<title>NewThingsCo Monthly Happiness Map</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" />
</head>
<script src="main.js"></script>
</head>
Empty file modified client/main.js
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion imports/constants/index.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const LOCALSTORAGE_KEY = 'TALENTED-MONTHLY-NAME';
export const LOCALSTORAGE_KEY = 'newthingsco-happiness';
export const STATUS_SIZE_PX_MARGIN = 30;
5 changes: 4 additions & 1 deletion imports/data/status.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ Meteor.methods({
},
'statuses.removeAll'() {
Statuses.remove({});
},
'statuses.removeSingle'({ name }) {
Statuses.remove({ name });
}
});
});
17 changes: 10 additions & 7 deletions imports/ui/body.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@

<template name="title">
{{#if isAdmin}}
<h1>Talented Happiness Map - admin <button id="reset" class="reset">reset</button><button id="reset-all" class="reset">reset all</button></h1>
<h1>NewThings Happiness - admin <button id="reset" class="reset">reset</button>
<button id="reset-all" class="reset">reset all</button>
<button id="export-all" class="reset">Sheets export</button>
</h1>
{{else}}
<h1>Talented Happiness Map{{#if name}} - {{name}}{{/if}} <button id="reset" class="reset">reset</button></h1>
<h1>NewThings Happiness {{#if name}} - {{name}}{{/if}} <button id="reset" class="reset">reset</button></h1>
{{/if}}
</template>

Expand All @@ -27,10 +30,10 @@ <h1>Save Your Name</h1>
<div id="canvas" class="canvas">
<div class="arrow arrow-vertical"></div>
<div class="arrow arrow-horizontal"></div>
<span class="mood happy">HAPPY</span>
<span class="mood unhappy">UNHAPPY</span>
<span class="mood notbusy">NOT BUSY</span>
<span class="mood busy">BUSY</span>
<span class="mood happy">LEARNING</span>
<span class="mood unhappy">NOT LEARNING</span>
<span class="mood notbusy">HAPPY</span>
<span class="mood busy">UNHAPPY</span>
{{#each statuses}}
{{> status}}
{{/each}}
Expand All @@ -43,4 +46,4 @@ <h1>Save Your Name</h1>

<template name="admin">

</template>
</template>
44 changes: 36 additions & 8 deletions imports/ui/body.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session'
import { LOCALSTORAGE_KEY, STATUS_SIZE_PX_MARGIN } from '../constants';
import { Statuses} from "../data/status";
import './body.html';

const localStorage = window.localStorage;
const isAdmin = window.location.pathname.startsWith('/admin');
const showAll = window.location.pathname.startsWith('/all');

function getName () {
return Session.get(LOCALSTORAGE_KEY);
return localStorage.getItem(LOCALSTORAGE_KEY);
}

function setName (name) {
Session.set(LOCALSTORAGE_KEY, name);
name && localStorage.setItem(LOCALSTORAGE_KEY, name);
}

function removeName () {
Session.set(LOCALSTORAGE_KEY, null);
localStorage.setItem(LOCALSTORAGE_KEY, null);
}

function toggleOverlay () {
Expand All @@ -34,6 +37,10 @@ function removeAllStatuses () {
Meteor.call('statuses.removeAll');
}

function removeSingleStatus(name) {
Meteor.call('statuses.removeSingle', { name });
}

function calculatePercentage (which, from) {
return Math.round((which - STATUS_SIZE_PX_MARGIN) / from * 100 );
}
Expand All @@ -44,12 +51,20 @@ function handleClick (x, y, template) {
const mouseYOnCanvas = y - canvasRects.top;
const percentageOnCanvasX = calculatePercentage(mouseXOnCanvas, canvasRects.width);
const percentageOnCanvasY = calculatePercentage(mouseYOnCanvas, canvasRects.height);
insertOrUpdateStatus(percentageOnCanvasX, percentageOnCanvasY);
insertOrUpdateStatus(percentageOnCanvasX, 100 - percentageOnCanvasY);
}

Template.canvas.helpers({
statuses() {
return Statuses.find({});
const name = getName();
const acc = [];
Statuses.find({}).map(cur => {
if (showAll || isAdmin || name === cur.name) {
cur.y = 100 - cur.y;
acc.push(cur);
}
});
return acc
}
});

Expand All @@ -72,17 +87,30 @@ Template.title.helpers({
return getName()
},
isAdmin() {
return getName() === 'admin';
return isAdmin;
}
});

Template.title.events({
'click #reset': function () {
const name = getName();
removeSingleStatus(name);
removeName();
toggleOverlay();
},
'click #reset-all': function () {
removeAllStatuses();
},
'click #export-all': function() {
Meteor.call('sheetsExport', { fromClick: true }, (error, result) => {
if (error) {
console.error(error, result);
alert('Something went terribly wrong');
return;
}
console.log(result);
alert('Google sheet updated with last months data!')
});
}
});

Expand All @@ -102,4 +130,4 @@ Template.login.events({
setName(name);
toggleOverlay();
}
});
});
Loading