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

Merge branch 'master' into pre-release-tidy

This commit is contained in:
Elliott Stoneham 2016-06-16 15:43:05 +01:00
commit 6b10f30238
15 changed files with 130 additions and 128 deletions

1
.gitignore vendored
View file

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

View file

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

View file

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html>
<head>
{{content-for 'head'}}
<meta charset="utf-8">
@ -14,43 +13,9 @@
<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="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/documize.css"> {{content-for 'head-footer'}}
<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/{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>
<link rel="stylesheet" href="assets/documize.css">
{{content-for 'head-footer'}}
</head>
<body>
{{content-for 'body'}}
<script src="assets/vendor.js"></script>
@ -62,5 +27,4 @@
<script src="codemirror/addon/runmode/colorize.js"></script>
{{content-for 'body-footer'}}
</body>
</html>

View file

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

View file

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

View file

@ -30,10 +30,18 @@ module.exports = function(environment) {
},
APP: {
// 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') {
ENV.APP.LOG_TRANSITIONS = true;
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
@ -42,7 +50,7 @@ module.exports = function(environment) {
};
ENV.apiHost = "https://localhost:5001";
// ENV.apiHost = "https://demo1.dev:5001";
ENV.apiHost = "https://demo1.dev:5001";
}
if (environment === 'test') {
@ -76,23 +84,5 @@ module.exports = function(environment) {
ENV.apiNamespace = "api";
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;
};

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-resolver": "^2.0.3",
"loader.js": "^4.0.1"
},
"ember-addon": {
"paths": [
"lib/intercom"
]
}
}

View file

@ -21,12 +21,9 @@ const Audit = Ember.Service.extend({
return id;
// Intercom('trackEvent', id); //jshint ignore: line
// Intercom('update'); //jshint ignore: line
},
stop() {
// Intercom('shutdown'); //jshint ignore: line
},
start() {
@ -37,31 +34,6 @@ const Audit = Ember.Service.extend({
}
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)
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..."
cd app
ember b -o dist-prod/ --environment=production
ember b -o dist-prod/ --environment=production intercom=$intercomKey
echo "Copying Ember assets..."
cd ..

View file

@ -687,11 +687,11 @@ func InviteToFolder(w http.ResponseWriter, r *http.Request) {
if len(user.RefID) > 0 {
// 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())
writeGeneralSQLError(w, method, err)
writeGeneralSQLError(w, method, err2)
return
}

View file

@ -30,7 +30,7 @@ const (
// AppVersion does what it says
// 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
AppVersion = "12.5"
AppVersion = "12.6"
)
var port, certFile, keyFile, forcePort2SSL string

View file

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