diff --git a/.eslintrc.js b/.eslintrc.js index 7bb3185..48c2cc5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,21 +1,29 @@ module.exports = { - "env": { - "browser": true, - "commonjs": true, - "node": true - }, "parserOptions": { "sourceType": "module", - "ecmaVersion": 6 + "ecmaVersion": 6, + "ecmaFeatures": { + "jsxnec": true, + }, }, "extends": "eslint:recommended", - "globals": { - "Promise": true - }, + "globals": [ + // browser + "window", "document", "URL", "XMLHttpRequest", + // browser / nodejs + "console", "setTimeout", "setInterval", "clearInterval", + // nodejs + "global", + // EcmaScript 6 + "Promise", "Map", "Set", "WeakMap", + // commonjs + "require", "module", "exports" + // + ].reduce((m, key)=>{m[key]=true;return m}, {}), "rules": { // 0 - off, 1 - warning, 2 - error "indent": ["error", 2, { "SwitchCase": 1 }], - "semi": [0, "never"], + "semi": [0, "always"], "comma-dangle": [2, "only-multiline"], "no-cond-assign": 2, "no-console": [2, { allow: ["warn", "info", "error", "assert"] }], @@ -40,6 +48,7 @@ module.exports = { // turned of as we want to be able to use this.hasOwnProperty() for instance "no-prototype-builtins": 0, "no-regex-spaces": 2, + "no-restricted-globals": [2, "Document", "Node"], "no-sparse-arrays": 0, "no-unexpected-multiline": 2, "no-unreachable": 2, @@ -47,7 +56,7 @@ module.exports = { "use-isnan": 2, "valid-jsdoc": 0, "valid-typeof": 2, - "strict": 0, // [2, "safe"], + "strict": [2, "safe"], // Best practices "accessor-pairs": 0, @@ -126,6 +135,6 @@ module.exports = { "no-undef-init": 2, "no-undefined": 0, "no-unused-vars": 2, - "no-use-before-define": [2, { "functions": false }] + "no-use-before-define": [2, { "functions": false, "classes": false }] } }; \ No newline at end of file diff --git a/.gitignore b/.gitignore index b172832..8b587d6 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ config/production.json config/test.json config/dev.json ecosystem.json +sync.js # Conversion data ost-data @@ -45,4 +46,4 @@ ost-data dist dist/doc uploads -tmp \ No newline at end of file +tmp diff --git a/client/publisher/ResourceClient.js b/client/publisher/ResourceClient.js index 596054f..6ebc6de 100644 --- a/client/publisher/ResourceClient.js +++ b/client/publisher/ResourceClient.js @@ -82,27 +82,41 @@ class ResourceClient { listEntities(filters, options, cb) { let filtersRequest = encodeURIComponent(JSON.stringify(filters)) let optionsRequest = encodeURIComponent(JSON.stringify(options)) - request('GET', '/api/entities?filters=' + filtersRequest + '&options=' + optionsRequest, null, cb) + this.request('GET', '/api/entities?filters=' + filtersRequest + '&options=' + optionsRequest, null, cb) } searchEntities(query, language, filters, options, cb) { let filtersRequest = encodeURIComponent(JSON.stringify(filters)) let optionsRequest = encodeURIComponent(JSON.stringify(options)) - request('GET', '/api/entities/search?query=' + query + '&language=' + language + '&filters=' + filtersRequest + '&options=' + optionsRequest, null, cb) + this.request('GET', '/api/entities/search?query=' + query + '&language=' + language + '&filters=' + filtersRequest + '&options=' + optionsRequest, null, cb) } /* - Read all document resources + Fetch all document resources + */ + getDocumentCollaborators(documentId, cb) { + this.request('GET', '/api/collaborators/document/' + documentId, null, cb) + } + + /* + Fetch all document resources */ getDocumentResources(documentId, cb) { - request('GET', '/api/entities/document/' + documentId, null, cb) + this.request('GET', '/api/entities/document/' + documentId, null, cb) } /* Get subjects data */ getSubjects(cb) { - request('GET', '/api/entities/tree/subject', null, cb) + this.request('GET', '/api/entities/tree/subject', null, cb) + } + + /* + Get collaborator data + */ + getCollaborator(userId, cb) { + this.request('GET', '/api/collaborators/' + userId, null, cb) } } diff --git a/client/publisher/app.css b/client/publisher/app.css index c0cf8e3..b8c5d33 100644 --- a/client/publisher/app.css +++ b/client/publisher/app.css @@ -1,5 +1,4 @@ /* Publisher Component styles */ -@import '../../node_modules/substance/dist/substance.next.css'; @import '../../node_modules/leaflet/dist/leaflet.css'; @import '../../node_modules/leaflet-control-geocoder/dist/Control.Geocoder.css'; @import './publisher.css'; diff --git a/client/publisher/app.js b/client/publisher/app.js index ac92a5a..a79e40e 100644 --- a/client/publisher/app.js +++ b/client/publisher/app.js @@ -1,5 +1,5 @@ import { substanceGlobals } from 'substance' -import { Archivist, ArchivistConfigurator } from 'archivist' +import { Archivist, ArchivistConfigurator } from 'archivist-js' import Package from './package' substanceGlobals.DEBUG_RENDERING = true; diff --git a/client/publisher/index.html b/client/publisher/index.html index 63333e0..9d10f4e 100644 --- a/client/publisher/index.html +++ b/client/publisher/index.html @@ -2,22 +2,18 @@