1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-09 07:25:23 +02:00

intercom refactored to Ember in-repo addon, changed document list styling, bumped version

This commit is contained in:
Harvey Kandola 2016-06-15 09:48:40 -07:00
parent 20815494f0
commit 2263e06b85
15 changed files with 130 additions and 128 deletions

1
.gitignore vendored
View file

@ -63,3 +63,4 @@ debug
*.crt *.crt
Dockerfile Dockerfile
container.sh container.sh
make.sh

View file

@ -16,6 +16,7 @@ export default Ember.Component.extend({
didReceiveAttrs() { didReceiveAttrs() {
this.set('selectedDocuments', []); this.set('selectedDocuments', []);
this.audit.record('viewed-space');
}, },
actions: { actions: {

View file

@ -1,6 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
{{content-for 'head'}} {{content-for 'head'}}
<meta charset="utf-8"> <meta charset="utf-8">
@ -14,43 +13,9 @@
<link rel="shortcut icon" href="/favicon.ico?v=1.1" /> <link rel="shortcut icon" href="/favicon.ico?v=1.1" />
<link rel="icon" type="image/png" href="/favicon-32x32.png?v=1.1" sizes="32x32" /> <link rel="icon" type="image/png" href="/favicon-32x32.png?v=1.1" sizes="32x32" />
<link rel="stylesheet" href="assets/vendor.css"> <link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/documize.css"> {{content-for 'head-footer'}} <link rel="stylesheet" href="assets/documize.css">
<script type="text/javascript"> {{content-for 'head-footer'}}
(function() {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic('reattach_activator');
ic('update', intercomSettings);
} else {
var d = document;
var i = function() {
i.c(arguments)
};
i.q = [];
i.c = function(args) {
i.q.push(args)
};
w.Intercom = i;
function l() {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/{app_id}';
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (w.attachEvent) {
w.attachEvent('onload', l);
} else {
w.addEventListener('load', l, false);
}
}
})()
</script>
</head> </head>
<body> <body>
{{content-for 'body'}} {{content-for 'body'}}
<script src="assets/vendor.js"></script> <script src="assets/vendor.js"></script>
@ -62,5 +27,4 @@
<script src="codemirror/addon/runmode/colorize.js"></script> <script src="codemirror/addon/runmode/colorize.js"></script>
{{content-for 'body-footer'}} {{content-for 'body-footer'}}
</body> </body>
</html> </html>

View file

@ -17,6 +17,7 @@ export default Ember.Service.extend({
sessionService: Ember.inject.service('session'), sessionService: Ember.inject.service('session'),
ready: false, ready: false,
enabled: config.APP.auditEnabled, enabled: config.APP.auditEnabled,
appId: config.APP.intercomKey,
init() { init() {
this.start(); this.start();
@ -42,16 +43,14 @@ export default Ember.Service.extend({
start() { start() {
let session = this.get('sessionService'); let session = this.get('sessionService');
if (!this.get('enabled') || !session.authenticated || this.get('ready')) { if (this.get('appId') === "" || !this.get('enabled') || !session.authenticated || this.get('ready')) {
return; return;
} }
this.set('ready', true); this.set('ready', true);
let appId = config.environment === 'production' ? 'c6cocn4z' : 'itgvb1vo';
window.intercomSettings = { window.intercomSettings = {
app_id: appId, app_id: this.get('appId'),
name: session.user.firstname + " " + session.user.lastname, name: session.user.firstname + " " + session.user.lastname,
email: session.user.email, email: session.user.email,
user_id: session.user.id, user_id: session.user.id,

View file

@ -48,15 +48,15 @@
} }
.documents-list { .documents-list {
// @extend .cards-list; margin: 35px 0;
margin-top: 35px;
> .document { > .document {
margin: 10px 10px; margin: 0;
padding: 10px 20px; padding: 20px 20px 25px 20px;
width: 100%; width: 100%;
position: relative; position: relative;
border: 1px solid transparent; border-bottom: 1px solid $color-gray2;
transition: .3s;
&:hover { &:hover {
> .link { > .link {
@ -65,7 +65,8 @@
} }
> .snippet { > .snippet {
color: $color-off-black; // color: $color-off-black;
color: $color-gray;
} }
} }
@ -77,7 +78,7 @@
> .checkbox { > .checkbox {
position: absolute; position: absolute;
display: none; display: none;
top: 2px; top: 5px;
right: 12px; right: 12px;
cursor: pointer; cursor: pointer;
@ -136,8 +137,7 @@
> .selected-card { > .selected-card {
background-color: $color-card-active !important; background-color: $color-card-active !important;
border: 1px solid $color-link !important; border-bottom: 1px solid $color-link !important;
transition: 0.2s all ease;
> .checkbox { > .checkbox {
display: block; display: block;

View file

@ -30,10 +30,18 @@ module.exports = function(environment) {
}, },
APP: { APP: {
// Allows to disable audit service in tests // Allows to disable audit service in tests
auditEnabled: true auditEnabled: true,
intercomKey: ""
} }
}; };
process.argv.forEach(function(element){
if (element.startsWith("intercom=")) {
element = element.replace("intercom=", "");
ENV.APP.intercomKey = element;
}
});
if (environment === 'development') { if (environment === 'development') {
ENV.APP.LOG_TRANSITIONS = true; ENV.APP.LOG_TRANSITIONS = true;
ENV.APP.LOG_TRANSITIONS_INTERNAL = true; ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
@ -42,7 +50,7 @@ module.exports = function(environment) {
}; };
ENV.apiHost = "https://localhost:5001"; ENV.apiHost = "https://localhost:5001";
// ENV.apiHost = "https://demo1.dev:5001"; ENV.apiHost = "https://demo1.dev:5001";
} }
if (environment === 'test') { if (environment === 'test') {
@ -76,23 +84,5 @@ module.exports = function(environment) {
ENV.apiNamespace = "api"; ENV.apiNamespace = "api";
ENV.contentSecurityPolicy = null; ENV.contentSecurityPolicy = null;
// ENV.contentSecurityPolicy = {
// 'img-src': "'self' data: self https://js.intercomcdn.com",
// 'font-src': "'self' data: fonts.gstatic.com",
// 'style-src': "'self' 'unsafe-inline' fonts.googleapis.com",
// 'script-src': "'self' https://widget.intercom.io https://js.intercomcdn.com " + ENV.apiHost,
// 'connect-src': "'self' " + ENV.apiHost + " https://api-ping.intercom.io https://nexus-websocket-a.intercom.io https://nexus-websocket-b.intercom.io wss://nexus-websocket-a.intercom.io wss://nexus-websocket-b.intercom.io https://api-iam.intercom.io",
// 'default-src': "none"
// };
// ENV.contentSecurityPolicy = {
// 'img-src': "'self' data: self",
// 'font-src': "'self' *",
// 'style-src': "'self' *",
// 'script-src': "'self' *",
// 'connect-src': "'self' *",
// 'default-src': "*"
// };
return ENV; return ENV;
}; };

4
app/lib/.jshintrc Normal file
View file

@ -0,0 +1,4 @@
{
"node": true,
"browser": false
}

56
app/lib/intercom/index.js Normal file
View file

@ -0,0 +1,56 @@
/*jshint node:true*/
module.exports = {
name: 'intercom',
contentFor: function(type, config) {
// Not using Intercom for app activity logging?
if (!config.APP.auditEnabled) {
return '';
}
var appId = config.APP.intercomKey;
if ('head-footer' === type && appId.length > 0) {
return `
<script type="text/javascript">
(function() {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic('reattach_activator');
ic('update', intercomSettings);
} else {
var d = document;
var i = function() {
i.c(arguments)
};
i.q = [];
i.c = function(args) {
i.q.push(args)
};
w.Intercom = i;
function l() {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/${appId}';
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (w.attachEvent) {
w.attachEvent('onload', l);
} else {
w.addEventListener('load', l, false);
}
}
})()
</script>
`;
}
},
isDevelopingAddon: function() {
return true;
}
};

View file

@ -0,0 +1,6 @@
{
"name": "intercom",
"keywords": [
"ember-addon"
]
}

View file

@ -40,5 +40,10 @@
"ember-load-initializers": "^0.5.1", "ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3", "ember-resolver": "^2.0.3",
"loader.js": "^4.0.1" "loader.js": "^4.0.1"
},
"ember-addon": {
"paths": [
"lib/intercom"
]
} }
} }

View file

@ -21,12 +21,9 @@ const Audit = Ember.Service.extend({
return id; return id;
// Intercom('trackEvent', id); //jshint ignore: line
// Intercom('update'); //jshint ignore: line
}, },
stop() { stop() {
// Intercom('shutdown'); //jshint ignore: line
}, },
start() { start() {
@ -37,31 +34,6 @@ const Audit = Ember.Service.extend({
} }
this.set('ready', true); this.set('ready', true);
// let appId = config.environment === 'production' ? 'c6cocn4z' : 'itgvb1vo';
// window.intercomSettings = {
// app_id: appId,
// name: session.user.firstname + " " + session.user.lastname,
// email: session.user.email,
// user_id: session.user.id,
// "administrator": session.user.admin,
// company:
// {
// id: session.get('appMeta.orgId'),
// name: session.get('appMeta.title').string,
// "domain": netUtil.getSubdomain(),
// "version": session.get('appMeta.version')
// }
// };
//
// if (!session.get('isMobile')) {
// window.intercomSettings.widget = {
// activator: "#IntercomDefaultWidget"
// };
// }
//
// window.Intercom('boot', window.intercomSettings);
}, },
}); });

View file

@ -3,9 +3,13 @@
NOW=$(date) NOW=$(date)
echo "Build process started $NOW" echo "Build process started $NOW"
# First parameter to this script is the Intercom.io key for audit logging.
# This is optional and we use Intercom to record user activity and provider in-app support via messaging.
intercomKey="$1"
echo "Building Ember assets..." echo "Building Ember assets..."
cd app cd app
ember b -o dist-prod/ --environment=production ember b -o dist-prod/ --environment=production intercom=$intercomKey
echo "Copying Ember assets..." echo "Copying Ember assets..."
cd .. cd ..

View file

@ -687,11 +687,11 @@ func InviteToFolder(w http.ResponseWriter, r *http.Request) {
if len(user.RefID) > 0 { if len(user.RefID) > 0 {
// Ensure they have access to this organization // Ensure they have access to this organization
accounts, err := p.GetUserAccounts(user.RefID) accounts, err2 := p.GetUserAccounts(user.RefID)
if err != nil { if err2 != nil {
log.IfErr(tx.Rollback()) log.IfErr(tx.Rollback())
writeGeneralSQLError(w, method, err) writeGeneralSQLError(w, method, err2)
return return
} }

View file

@ -30,7 +30,7 @@ const (
// AppVersion does what it says // AppVersion does what it says
// Versioning scheme major.minor where "minor" is optional // Versioning scheme major.minor where "minor" is optional
// e.g. 1, 2, 3, 4.1, 4.2, 5, 6, 7, 7.1, 8, 9, 10, ..... 127, 127.1, 128 // e.g. 1, 2, 3, 4.1, 4.2, 5, 6, 7, 7.1, 8, 9, 10, ..... 127, 127.1, 128
AppVersion = "12.5" AppVersion = "12.6"
) )
var port, certFile, keyFile, forcePort2SSL string var port, certFile, keyFile, forcePort2SSL string

View file

@ -117,10 +117,10 @@ func RefreshSections(w http.ResponseWriter, r *http.Request) {
for _, pm := range meta { for _, pm := range meta {
// Grab the page because we need content type and // Grab the page because we need content type and
page, err := p.GetPage(pm.PageID) page, err2 := p.GetPage(pm.PageID)
if err != nil { if err2 != nil {
writeGeneralSQLError(w, method, err) writeGeneralSQLError(w, method, err2)
log.IfErr(tx.Rollback()) log.IfErr(tx.Rollback())
return return
} }