mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
moved emberjs to gui folder
This commit is contained in:
parent
6a18d18f91
commit
dc49dbbeff
999 changed files with 677 additions and 651 deletions
22
gui/app/pods/auth/forgot/controller.js
Normal file
22
gui/app/pods/auth/forgot/controller.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
userService: Ember.inject.service('user'),
|
||||
|
||||
actions: {
|
||||
forgot: function (email) {
|
||||
return this.get('userService').forgotPassword(email);
|
||||
}
|
||||
}
|
||||
});
|
36
gui/app/pods/auth/forgot/route.js
Normal file
36
gui/app/pods/auth/forgot/route.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import constants from '../../../utils/constants';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
appMeta: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
if (this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('sayThanks', false);
|
||||
},
|
||||
|
||||
activate() {
|
||||
$('body').addClass('background-color-off-white');
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
8
gui/app/pods/auth/forgot/template.hbs
Normal file
8
gui/app/pods/auth/forgot/template.hbs
Normal file
|
@ -0,0 +1,8 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="/assets/img/logo-color.png" title="Documize" alt="Documize" class="responsive-img" />
|
||||
</div>
|
||||
<div class="login-form">
|
||||
{{forgot-password forgot=(action 'forgot')}}
|
||||
</div>
|
||||
</div>
|
14
gui/app/pods/auth/keycloak/controller.js
Normal file
14
gui/app/pods/auth/keycloak/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({});
|
60
gui/app/pods/auth/keycloak/route.js
Normal file
60
gui/app/pods/auth/keycloak/route.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import constants from '../../../utils/constants';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
session: Ember.inject.service(),
|
||||
appMeta: Ember.inject.service(),
|
||||
kcAuth: Ember.inject.service(),
|
||||
localStorage: Ember.inject.service(),
|
||||
queryParams: {
|
||||
mode: {
|
||||
refreshModel: true
|
||||
}
|
||||
},
|
||||
message: '',
|
||||
|
||||
beforeModel(transition) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.set('mode', is.not.undefined(transition.queryParams.mode) ? transition.queryParams.mode : 'reject');
|
||||
|
||||
if (this.get('mode') === 'reject' || this.get('appMeta.authProvider') !== constants.AuthProvider.Keycloak) {
|
||||
resolve();
|
||||
}
|
||||
|
||||
this.get('kcAuth').fetchProfile().then((profile) => {
|
||||
let data = this.get('kcAuth').mapProfile(profile);
|
||||
|
||||
this.get("session").authenticate('authenticator:keycloak', data).then(() => {
|
||||
this.transitionTo('folders');
|
||||
}, (reject) => {
|
||||
this.set('message', reject.Error);
|
||||
this.set('mode', 'reject');
|
||||
resolve();
|
||||
});
|
||||
|
||||
}, (reject) => {
|
||||
this.set('mode', 'reject');
|
||||
this.set('message', reject);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
model() {
|
||||
return {
|
||||
mode: this.get('mode'),
|
||||
message: this.get('message')
|
||||
}
|
||||
}
|
||||
});
|
13
gui/app/pods/auth/keycloak/template.hbs
Normal file
13
gui/app/pods/auth/keycloak/template.hbs
Normal file
|
@ -0,0 +1,13 @@
|
|||
{{#if (is-equal model.mode 'login')}}
|
||||
<div class="sso-box">
|
||||
<p>Authenticating with Keycloak...</p>
|
||||
<img src="/assets/img/busy-gray.gif" />
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if (is-equal model.mode 'reject')}}
|
||||
<div class="sso-box">
|
||||
<p>Keycloak authentication failure</p>
|
||||
<p>{{model.message}}</p>
|
||||
</div>
|
||||
{{/if}}
|
44
gui/app/pods/auth/login/controller.js
Normal file
44
gui/app/pods/auth/login/controller.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthProvider from '../../../mixins/auth';
|
||||
|
||||
export default Ember.Controller.extend(AuthProvider, {
|
||||
appMeta: Ember.inject.service('app-meta'),
|
||||
session: Ember.inject.service('session'),
|
||||
invalidCredentials: false,
|
||||
|
||||
reset() {
|
||||
this.setProperties({
|
||||
email: '',
|
||||
password: ''
|
||||
});
|
||||
|
||||
let dbhash = document.head.querySelector("[property=dbhash]").content;
|
||||
if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") {
|
||||
this.transitionToRoute('setup');
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
login() {
|
||||
let creds = this.getProperties('email', 'password');
|
||||
|
||||
this.get('session').authenticate('authenticator:documize', creds).then((response) => {
|
||||
this.transitionToRoute('folders');
|
||||
return response;
|
||||
}).catch(() => {
|
||||
this.set('invalidCredentials', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
67
gui/app/pods/auth/login/route.js
Normal file
67
gui/app/pods/auth/login/route.js
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import constants from '../../../utils/constants';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
appMeta: Ember.inject.service(),
|
||||
kcAuth: Ember.inject.service(),
|
||||
localStorage: Ember.inject.service(),
|
||||
showLogin: false,
|
||||
|
||||
beforeModel(transition) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
let authProvider = this.get('appMeta.authProvider');
|
||||
|
||||
switch (authProvider) {
|
||||
case constants.AuthProvider.Keycloak:
|
||||
this.set('showLogin', false);
|
||||
|
||||
this.get('kcAuth').login().then(() => {
|
||||
this.transitionTo('auth.keycloak', { queryParams: { mode: 'login' }});
|
||||
resolve();
|
||||
}, (reject) => {
|
||||
transition.abort();
|
||||
console.log (reject); // eslint-disable-line no-console
|
||||
this.transitionTo('auth.keycloak', { queryParams: { mode: 'reject' }});
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
this.set('showLogin', true);
|
||||
resolve();
|
||||
break;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
model() {
|
||||
return {
|
||||
showLogin: this.get('showLogin')
|
||||
};
|
||||
},
|
||||
|
||||
setupController: function (controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.reset();
|
||||
this.browser.setTitleAsPhrase("Login");
|
||||
},
|
||||
|
||||
activate() {
|
||||
$('body').addClass('background-color-off-white');
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
27
gui/app/pods/auth/login/template.hbs
Normal file
27
gui/app/pods/auth/login/template.hbs
Normal file
|
@ -0,0 +1,27 @@
|
|||
{{#if model.showLogin}}
|
||||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="/assets/img/logo-color.png" title="Documize" alt="Documize" class="responsive-img" />
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<form id="login-form" {{action 'login' on="submit"}}>
|
||||
<div class="input-control">
|
||||
<label>Email</label>
|
||||
{{focus-input type="email" value=email id="authEmail"}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Password</label>
|
||||
{{input type="password" value=password id="authPassword"}}
|
||||
</div>
|
||||
<div class="clearfix" />
|
||||
<div class="margin-top-10 margin-bottom-20">
|
||||
<button type="submit" class="regular-button button-blue">Sign in</button>
|
||||
<span class="{{unless invalidCredentials "hide"}} color-red margin-left-20">Invalid credentials</span>
|
||||
</div>
|
||||
{{#if isAuthProviderDocumize}}
|
||||
{{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}}
|
||||
{{/if}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
14
gui/app/pods/auth/logout/controller.js
Normal file
14
gui/app/pods/auth/logout/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({});
|
32
gui/app/pods/auth/logout/route.js
Normal file
32
gui/app/pods/auth/logout/route.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import config from 'documize/config/environment';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
session: Ember.inject.service(),
|
||||
appMeta: Ember.inject.service(),
|
||||
|
||||
activate: function () {
|
||||
this.get('session').invalidate().then(() => {
|
||||
if (config.environment === 'test') {
|
||||
this.transitionTo('auth.login');
|
||||
} else {
|
||||
if (this.get("appMeta.allowAnonymousAccess")) {
|
||||
this.transitionTo('folders');
|
||||
} else {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
4
gui/app/pods/auth/logout/template.hbs
Normal file
4
gui/app/pods/auth/logout/template.hbs
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div class="sso-box">
|
||||
<p>Logging out...</p>
|
||||
<img src="/assets/img/busy-gray.gif" />
|
||||
</div>
|
27
gui/app/pods/auth/reset/controller.js
Normal file
27
gui/app/pods/auth/reset/controller.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
userService: Ember.inject.service('user'),
|
||||
password: "",
|
||||
passwordConfirm: "",
|
||||
mustMatch: false,
|
||||
|
||||
actions: {
|
||||
reset(password) {
|
||||
return this.get('userService').resetPassword(this.model, password).then(() => { /* jshint ignore:line */
|
||||
this.transitionToRoute('auth.login');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
26
gui/app/pods/auth/reset/route.js
Normal file
26
gui/app/pods/auth/reset/route.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model: function (params) {
|
||||
return params.token;
|
||||
},
|
||||
|
||||
activate() {
|
||||
$('body').addClass('background-color-off-white');
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
6
gui/app/pods/auth/reset/template.hbs
Normal file
6
gui/app/pods/auth/reset/template.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="/assets/img/logo-color.png" title="Documize" alt="Documize" class="responsive-img" />
|
||||
</div>
|
||||
{{password-reset reset=(action 'reset')}}
|
||||
</div>
|
15
gui/app/pods/auth/route.js
Normal file
15
gui/app/pods/auth/route.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
});
|
14
gui/app/pods/auth/share/controller.js
Normal file
14
gui/app/pods/auth/share/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({});
|
43
gui/app/pods/auth/share/route.js
Normal file
43
gui/app/pods/auth/share/route.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
session: Ember.inject.service(),
|
||||
localStorage: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
this.get('localStorage').clearAll();
|
||||
},
|
||||
|
||||
model: function (params) {
|
||||
this.set('folderId', params.id);
|
||||
this.set('slug', params.slug);
|
||||
this.set('serial', params.serial);
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('serial', this.serial);
|
||||
controller.set('slug', this.slug);
|
||||
controller.set('folderId', this.folderId);
|
||||
},
|
||||
|
||||
activate() {
|
||||
$('body').addClass('background-color-off-white');
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
7
gui/app/pods/auth/share/template.hbs
Normal file
7
gui/app/pods/auth/share/template.hbs
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="onboarding-container">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
{{onboard/share-folder serial=serial folderId=folderId slug=slug}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
14
gui/app/pods/auth/sso/controller.js
Normal file
14
gui/app/pods/auth/sso/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({});
|
30
gui/app/pods/auth/sso/route.js
Normal file
30
gui/app/pods/auth/sso/route.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
session: Ember.inject.service(),
|
||||
localStorage: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
this.get('localStorage').clearAll();
|
||||
},
|
||||
|
||||
model({ token }) {
|
||||
this.get("session").authenticate('authenticator:documize', decodeURIComponent(token))
|
||||
.then(() => {
|
||||
this.transitionTo('folders');
|
||||
}, () => {
|
||||
this.transitionTo('auth.login');
|
||||
});
|
||||
},
|
||||
});
|
4
gui/app/pods/auth/sso/template.hbs
Normal file
4
gui/app/pods/auth/sso/template.hbs
Normal file
|
@ -0,0 +1,4 @@
|
|||
<div class="sso-box">
|
||||
<p>Signing in...</p>
|
||||
<img src="/assets/img/busy-gray.gif" />
|
||||
</div>
|
1
gui/app/pods/auth/template.hbs
Normal file
1
gui/app/pods/auth/template.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
{{outlet}}
|
49
gui/app/pods/customize/auth/controller.js
Normal file
49
gui/app/pods/customize/auth/controller.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from "../../../mixins/notifier";
|
||||
// import constants from '../../../utils/constants';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
global: Ember.inject.service(),
|
||||
appMeta: Ember.inject.service(),
|
||||
session: Ember.inject.service(),
|
||||
|
||||
actions: {
|
||||
onSave(data) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
if(!this.get('session.isGlobalAdmin')) {
|
||||
resolve();
|
||||
} else {
|
||||
this.get('global').saveAuthConfig(data).then(() => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onSync() {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('global').syncExternalUsers().then((response) => {
|
||||
resolve(response);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onChange(data) {
|
||||
this.get('session').logout();
|
||||
this.set('appMeta.authProvider', data.authProvider);
|
||||
this.set('appMeta.authConfig', data.authConfig);
|
||||
window.location.href= '/';
|
||||
}
|
||||
}
|
||||
});
|
52
gui/app/pods/customize/auth/route.js
Normal file
52
gui/app/pods/customize/auth/route.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
import constants from '../../../utils/constants';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
appMeta: Ember.inject.service(),
|
||||
session: Ember.inject.service(),
|
||||
global: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.get("session.isGlobalAdmin")) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
let data = {
|
||||
authProvider: this.get('appMeta.authProvider'),
|
||||
authConfig: null,
|
||||
};
|
||||
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('global').getAuthConfig().then((config) => {
|
||||
switch (data.authProvider) {
|
||||
case constants.AuthProvider.Keycloak:
|
||||
data.authConfig = config;
|
||||
break;
|
||||
case constants.AuthProvider.Documize:
|
||||
data.authConfig = '';
|
||||
break;
|
||||
}
|
||||
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Authentication | Documize";
|
||||
}
|
||||
});
|
2
gui/app/pods/customize/auth/template.hbs
Normal file
2
gui/app/pods/customize/auth/template.hbs
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{customize/auth-settings authProvider=model.authProvider authConfig=model.authConfig
|
||||
onSave=(action 'onSave') onSync=(action 'onSync') onChange=(action 'onChange')}}
|
14
gui/app/pods/customize/controller.js
Normal file
14
gui/app/pods/customize/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({});
|
41
gui/app/pods/customize/folders/controller.js
Normal file
41
gui/app/pods/customize/folders/controller.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
folders: [],
|
||||
|
||||
label: function () {
|
||||
switch (this.get('folders').length) {
|
||||
case 1:
|
||||
return "space";
|
||||
default:
|
||||
return "spaces";
|
||||
}
|
||||
}.property('folders'),
|
||||
|
||||
actions: {
|
||||
changeOwner: function (folderId, userId) {
|
||||
this.get('folderService').getFolder(folderId).then((folder) => {
|
||||
folder.set('userId', userId);
|
||||
|
||||
this.get('folderService').save(folder).then(() => {
|
||||
this.showNotification("Changed");
|
||||
});
|
||||
|
||||
this.send('onChangeOwner');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
62
gui/app/pods/customize/folders/route.js
Normal file
62
gui/app/pods/customize/folders/route.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.session.isAdmin) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
return this.get('folderService').getAll();
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
let nonPrivateFolders = model.rejectBy('folderType', 2);
|
||||
if (is.empty(nonPrivateFolders) || is.null(model) || is.undefined(model)) {
|
||||
nonPrivateFolders = [];
|
||||
}
|
||||
controller.set('folders', nonPrivateFolders);
|
||||
|
||||
this.get('folderService').getProtectedFolderInfo().then((people) => {
|
||||
people.forEach((person) => {
|
||||
person.set('isEveryone', person.get('userId') === '');
|
||||
person.set('isOwner', false);
|
||||
});
|
||||
|
||||
nonPrivateFolders.forEach(function (folder) {
|
||||
let shared = people.filterBy('folderId', folder.get('id'));
|
||||
let person = shared.findBy('userId', folder.get('userId'));
|
||||
if (is.not.undefined(person)) {
|
||||
person.set('isOwner', true);
|
||||
}
|
||||
|
||||
folder.set('sharedWith', shared);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Spaces | Documize";
|
||||
},
|
||||
|
||||
actions: {
|
||||
onChangeOwner() {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
});
|
50
gui/app/pods/customize/folders/template.hbs
Normal file
50
gui/app/pods/customize/folders/template.hbs
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{#if folders}}
|
||||
<div class="global-folder-settings">
|
||||
<div class="form-header">
|
||||
<div class="title">{{folders.length}} shared {{label}}</div>
|
||||
<div class="tip">View and change shared space ownership</div>
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<table class="basic-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="bordered">Space</th>
|
||||
<th class="bordered">Participants</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each folders as |folder|}}
|
||||
<tr>
|
||||
<td class="bordered">
|
||||
{{#link-to 'folder' folder.id folder.slug class="alt"}}{{folder.name}}{{/link-to}}
|
||||
</td>
|
||||
<td class="bordered">
|
||||
{{#each folder.sharedWith as |person|}}
|
||||
{{#if person.isEveryone}}
|
||||
Everyone
|
||||
{{else}}
|
||||
|
||||
{{#if person.isOwner}}
|
||||
<span class="bold">{{person.firstname}} {{person.lastname}} (owner)</span>
|
||||
{{else}}
|
||||
{{person.firstname}} {{person.lastname}}
|
||||
<a class="action-link" {{action "changeOwner" folder.id person.userId}}>make owner</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<br/>
|
||||
{{/each}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="global-folder-settings">
|
||||
<div class="form-header">
|
||||
<div class="title">{{folders.length}} shared {{label}}</div>
|
||||
<div class="tip">There are no spaces to maintain</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
25
gui/app/pods/customize/general/controller.js
Normal file
25
gui/app/pods/customize/general/controller.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from "../../../mixins/notifier";
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
orgService: Ember.inject.service('organization'),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
return this.get('orgService').save(this.model.general).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
38
gui/app/pods/customize/general/route.js
Normal file
38
gui/app/pods/customize/general/route.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import RSVP from 'rsvp';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
orgService: Ember.inject.service('organization'),
|
||||
appMeta: Ember.inject.service(),
|
||||
session: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.get("session.isAdmin")) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
let orgId = this.get("appMeta.orgId");
|
||||
|
||||
return RSVP.hash({
|
||||
general: this.get('orgService').getOrg(orgId)
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Settings | Documize";
|
||||
}
|
||||
});
|
1
gui/app/pods/customize/general/template.hbs
Normal file
1
gui/app/pods/customize/general/template.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
{{customize/general-settings model=model save=(action 'save')}}
|
35
gui/app/pods/customize/global/controller.js
Normal file
35
gui/app/pods/customize/global/controller.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from "../../../mixins/notifier";
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
global: Ember.inject.service(),
|
||||
|
||||
actions: {
|
||||
saveSMTP() {
|
||||
if(this.get('session.isGlobalAdmin')) {
|
||||
return this.get('global').saveSMTPConfig(this.model.smtp).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
saveLicense() {
|
||||
if(this.get('session.isGlobalAdmin')) {
|
||||
return this.get('global').saveLicense(this.model.license).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
37
gui/app/pods/customize/global/route.js
Normal file
37
gui/app/pods/customize/global/route.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import RSVP from 'rsvp';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
appMeta: Ember.inject.service(),
|
||||
session: Ember.inject.service(),
|
||||
global: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.get("session.isGlobalAdmin")) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
return RSVP.hash({
|
||||
smtp: this.get('global').getSMTPConfig(),
|
||||
license: this.get('global').getLicense()
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Settings | Documize";
|
||||
}
|
||||
});
|
1
gui/app/pods/customize/global/template.hbs
Normal file
1
gui/app/pods/customize/global/template.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
{{customize/global-settings model=model saveSMTP=(action 'saveSMTP') saveLicense=(action 'saveLicense')}}
|
21
gui/app/pods/customize/route.js
Normal file
21
gui/app/pods/customize/route.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel: function (transition) {
|
||||
if (is.equal(transition.targetName, 'customize.index')) {
|
||||
this.transitionTo('customize.general');
|
||||
}
|
||||
},
|
||||
});
|
28
gui/app/pods/customize/template.hbs
Normal file
28
gui/app/pods/customize/template.hbs
Normal file
|
@ -0,0 +1,28 @@
|
|||
{{layout/zone-navigation}}
|
||||
{{#layout/zone-container}}
|
||||
{{#layout/zone-sidebar}}
|
||||
<div class="sidebar-toolbar">
|
||||
</div>
|
||||
<div class="sidebar-common">
|
||||
{{layout/sidebar-intro title='Settings' message='Documize application settings'}}
|
||||
</div>
|
||||
<div class="sidebar-wrapper">
|
||||
<div class="sidebar-menu">
|
||||
<ul class="options">
|
||||
{{#link-to 'customize.general' activeClass='selected' class="option" tagName="li"}}General{{/link-to}}
|
||||
{{#link-to 'customize.folders' activeClass='selected' class="option" tagName="li"}}Spaces{{/link-to}}
|
||||
{{#link-to 'customize.users' activeClass='selected' class="option" tagName="li"}}Users{{/link-to}}
|
||||
{{#if session.isGlobalAdmin}}
|
||||
{{#link-to 'customize.global' activeClass='selected' class="option" tagName="li"}}Global{{/link-to}}
|
||||
{{#link-to 'customize.auth' activeClass='selected' class="option" tagName="li"}}Authentication{{/link-to}}
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{/layout/zone-sidebar}}
|
||||
{{#layout/zone-content}}
|
||||
<div class="page-customize">
|
||||
{{outlet}}
|
||||
</div>
|
||||
{{/layout/zone-content}}
|
||||
{{/layout/zone-container}}
|
62
gui/app/pods/customize/users/controller.js
Normal file
62
gui/app/pods/customize/users/controller.js
Normal file
|
@ -0,0 +1,62 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
userService: Ember.inject.service('user'),
|
||||
newUser: { firstname: "", lastname: "", email: "", active: true },
|
||||
|
||||
actions: {
|
||||
add(user) {
|
||||
Ember.set(this, 'newUser', user);
|
||||
|
||||
return this.get('userService')
|
||||
.add(this.get('newUser'))
|
||||
.then((user) => {
|
||||
this.showNotification('Added');
|
||||
this.get('model').pushObject(user);
|
||||
})
|
||||
.catch(function (error) {
|
||||
let msg = error.status === 409 ? 'Unable to add duplicate user' : 'Unable to add user';
|
||||
this.showNotification(msg);
|
||||
});
|
||||
},
|
||||
|
||||
onDelete(userId) {
|
||||
let self = this;
|
||||
this.get('userService').remove(userId).then(function () {
|
||||
self.showNotification('Deleted');
|
||||
|
||||
self.get('userService').getComplete().then(function (users) {
|
||||
self.set('model', users);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onSave(user) {
|
||||
let self = this;
|
||||
this.get('userService').save(user).then(function () {
|
||||
self.showNotification('Saved');
|
||||
|
||||
self.get('userService').getComplete().then(function (users) {
|
||||
self.set('model', users);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onPassword(user, password) {
|
||||
this.get('userService').updatePassword(user.id, password);
|
||||
this.showNotification('Password changed');
|
||||
}
|
||||
}
|
||||
});
|
46
gui/app/pods/customize/users/route.js
Normal file
46
gui/app/pods/customize/users/route.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
import constants from '../../../utils/constants';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
userService: Ember.inject.service('user'),
|
||||
global: Ember.inject.service('global'),
|
||||
appMeta: Ember.inject.service(),
|
||||
|
||||
beforeModel: function () {
|
||||
if (!this.session.isAdmin) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
if (this.get('appMeta.authProvider') == constants.AuthProvider.Keycloak) {
|
||||
this.get('global').syncExternalUsers().then(() => {
|
||||
this.get('userService').getComplete().then((users) =>{
|
||||
resolve(users);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.get('userService').getComplete().then((users) =>{
|
||||
resolve(users);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
activate: function () {
|
||||
document.title = "Users | Documize";
|
||||
}
|
||||
});
|
5
gui/app/pods/customize/users/template.hbs
Normal file
5
gui/app/pods/customize/users/template.hbs
Normal file
|
@ -0,0 +1,5 @@
|
|||
{{customize/user-settings add=(action 'add')}}
|
||||
|
||||
<div class="clearfix" />
|
||||
|
||||
{{customize/user-admin users=model onDelete=(action "onDelete") onSave=(action "onSave") onPassword=(action "onPassword")}}
|
38
gui/app/pods/document/block/controller.js
Normal file
38
gui/app/pods/document/block/controller.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sectionService: Ember.inject.service('section'),
|
||||
|
||||
actions: {
|
||||
onCancel( /*page*/ ) {
|
||||
this.transitionToRoute('document');
|
||||
},
|
||||
|
||||
onAction(page, meta) {
|
||||
let self = this;
|
||||
|
||||
let b = this.get('model.block');
|
||||
b.set('title', page.get('title'));
|
||||
b.set('body', page.get('body'));
|
||||
b.set('excerpt', page.get('excerpt'));
|
||||
b.set('rawBody', meta.get('rawBody'));
|
||||
b.set('config', meta.get('config'));
|
||||
b.set('externalSource', meta.get('externalSource'));
|
||||
|
||||
this.get('sectionService').updateBlock(b).then(function () {
|
||||
self.transitionToRoute('document');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
37
gui/app/pods/document/block/route.js
Normal file
37
gui/app/pods/document/block/route.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
sectionService: Ember.inject.service('section'),
|
||||
|
||||
model(params) {
|
||||
let self = this;
|
||||
|
||||
return Ember.RSVP.hash({
|
||||
folder: self.modelFor('document').folder,
|
||||
document: self.modelFor('document').document,
|
||||
block: self.get('sectionService').getBlock(params.block_id),
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
$('body').addClass('background-color-off-white');
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
18
gui/app/pods/document/block/template.hbs
Normal file
18
gui/app/pods/document/block/template.hbs
Normal file
|
@ -0,0 +1,18 @@
|
|||
<div class="zone-section-editor">
|
||||
<div class="page-container">
|
||||
<div id="page-content-wrapper">
|
||||
<div id="zone-document-content" class="zone-document-content">
|
||||
<div class="back-to-space">
|
||||
{{#link-to 'document.index' model.folder.id model.folder.slug model.document.id model.document.slug}}
|
||||
<i class="material-icons">arrow_back</i> {{model.document.name}}
|
||||
{{/link-to}}
|
||||
</div>
|
||||
{{document/document-heading document=model.document isEditor=false}}
|
||||
{{document/block-editor document=model.document folder=model.folder block=model.block onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
16
gui/app/pods/document/controller.js
Normal file
16
gui/app/pods/document/controller.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
});
|
24
gui/app/pods/document/history/controller.js
Normal file
24
gui/app/pods/document/history/controller.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
|
||||
actions: {
|
||||
onFetchDiff(pageId, revisionId) {
|
||||
this.get('documentService').getPageRevisionDiff(this.get('model.document.id'), pageId, revisionId).then((revision) => {
|
||||
this.set('model.diff', revision);
|
||||
});
|
||||
},
|
||||
|
||||
onRollback(pageId, revisionId) {
|
||||
this.get('documentService').rollbackPage(this.get('model.document.id'), pageId, revisionId).then(() => {
|
||||
this.transitionToRoute('document.index',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
23
gui/app/pods/document/history/route.js
Normal file
23
gui/app/pods/document/history/route.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
model() {
|
||||
return Ember.RSVP.hash({
|
||||
folders: this.modelFor('document').folders,
|
||||
folder: this.modelFor('document').folder,
|
||||
document: this.modelFor('document').document,
|
||||
pages: this.modelFor('document').pages,
|
||||
diff: "",
|
||||
revisions: this.get('documentService').getDocumentRevisions(this.modelFor('document').document.get('id'))
|
||||
});
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('hasRevisions', model.revisions.length > 0);
|
||||
}
|
||||
});
|
23
gui/app/pods/document/history/template.hbs
Normal file
23
gui/app/pods/document/history/template.hbs
Normal file
|
@ -0,0 +1,23 @@
|
|||
<div class="zone-document-history">
|
||||
<div class="page-container">
|
||||
<div id="page-content-wrapper">
|
||||
<div id="zone-document-content" class="zone-document-content">
|
||||
<div class="back-to-space">
|
||||
{{#link-to 'document.index' model.folder.id model.folder.slug model.document.id model.document.slug}}
|
||||
<i class="material-icons">arrow_back</i> {{model.document.name}}
|
||||
{{/link-to}}
|
||||
</div>
|
||||
{{document/document-heading document=model.document isEditor=false}}
|
||||
{{#if hasRevisions}}
|
||||
{{document/document-history document=model.document folder=model.folder pages=model.pages
|
||||
revisions=model.revisions diff=model.diff onFetchDiff=(action 'onFetchDiff') onRollback=(action 'onRollback')}}
|
||||
{{else}}
|
||||
No revisions made
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
231
gui/app/pods/document/index/controller.js
Normal file
231
gui/app/pods/document/index/controller.js
Normal file
|
@ -0,0 +1,231 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
templateService: Ember.inject.service('template'),
|
||||
sectionService: Ember.inject.service('section'),
|
||||
linkService: Ember.inject.service('link'),
|
||||
folder: {},
|
||||
pages: [],
|
||||
toggled: false,
|
||||
queryParams: ['pageId', 'tab'],
|
||||
pageId: '',
|
||||
tab: 'index',
|
||||
|
||||
actions: {
|
||||
toggleSidebar() {
|
||||
this.set('toggled', !this.get('toggled'));
|
||||
},
|
||||
|
||||
onSaveDocument(doc) {
|
||||
this.get('documentService').save(doc);
|
||||
this.showNotification('Saved');
|
||||
},
|
||||
|
||||
onCopyPage(pageId, targetDocumentId) {
|
||||
let documentId = this.get('model.document.id');
|
||||
this.get('documentService').copyPage(documentId, pageId, targetDocumentId).then(() => {
|
||||
this.showNotification("Copied");
|
||||
|
||||
// refresh data if copied to same document
|
||||
if (documentId === targetDocumentId) {
|
||||
this.set('pageId', '');
|
||||
this.get('target.router').refresh();
|
||||
|
||||
this.get('linkService').getDocumentLinks(this.get('model.document.id')).then((links) => {
|
||||
this.set('model.links', links);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onMovePage(pageId, targetDocumentId) {
|
||||
let documentId = this.get('model.document.id');
|
||||
|
||||
this.get('documentService').copyPage(documentId, pageId, targetDocumentId).then(() => {
|
||||
this.showNotification("Moved");
|
||||
this.send('onPageDeleted', { id: pageId, children: false });
|
||||
});
|
||||
},
|
||||
|
||||
onSavePage(page, meta) {
|
||||
let documentId = this.get('model.document.id');
|
||||
let model = {
|
||||
page: page.toJSON({ includeId: true }),
|
||||
meta: meta.toJSON({ includeId: true })
|
||||
};
|
||||
|
||||
this.get('documentService').updatePage(documentId, page.get('id'), model).then((up) => {
|
||||
page = up;
|
||||
this.set('pageId', page.get('id'));
|
||||
this.get('linkService').getDocumentLinks(this.get('model.document.id')).then((links) => {
|
||||
this.set('model.links', links);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onPageDeleted(deletePage) {
|
||||
let documentId = this.get('model.document.id');
|
||||
let pages = this.get('model.pages');
|
||||
let deleteId = deletePage.id;
|
||||
let deleteChildren = deletePage.children;
|
||||
let page = _.findWhere(pages, {
|
||||
id: deleteId
|
||||
});
|
||||
let pageIndex = _.indexOf(pages, page, false);
|
||||
let pendingChanges = [];
|
||||
|
||||
// select affected pages
|
||||
for (var i = pageIndex + 1; i < pages.get('length'); i++) {
|
||||
if (pages[i].get('level') <= page.get('level')) {
|
||||
break;
|
||||
}
|
||||
|
||||
pendingChanges.push({
|
||||
pageId: pages[i].get('id'),
|
||||
level: pages[i].get('level') - 1
|
||||
});
|
||||
}
|
||||
|
||||
this.set('pageId', '');
|
||||
|
||||
if (deleteChildren) {
|
||||
// nuke of page tree
|
||||
pendingChanges.push({
|
||||
pageId: deleteId
|
||||
});
|
||||
|
||||
this.get('documentService').deletePages(documentId, deleteId, pendingChanges).then(() => {
|
||||
// update our models so we don't have to reload from db
|
||||
for (var i = 0; i < pendingChanges.length; i++) {
|
||||
let pageId = pendingChanges[i].pageId;
|
||||
this.set('model.pages', _.reject(pages, function (p) { //jshint ignore: line
|
||||
return p.get('id') === pageId;
|
||||
}));
|
||||
}
|
||||
|
||||
this.set('model.pages', _.sortBy(pages, "sequence"));
|
||||
this.get('target.router').refresh();
|
||||
});
|
||||
} else {
|
||||
// page delete followed by re-leveling child pages
|
||||
this.get('documentService').deletePage(documentId, deleteId).then(() => {
|
||||
this.set('model.pages', _.reject(pages, function (p) {
|
||||
return p.get('id') === deleteId;
|
||||
}));
|
||||
|
||||
this.send('onPageLevelChange', pendingChanges);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
onInsertSection(data) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('documentService').addPage(this.get('model.document.id'), data).then((newPage) => {
|
||||
let data = this.get('store').normalize('page', newPage);
|
||||
this.get('store').push(data);
|
||||
this.set('pageId', newPage.id);
|
||||
|
||||
this.get('documentService').getPages(this.get('model.document.id')).then((pages) => {
|
||||
this.set('model.pages', pages);
|
||||
|
||||
if (newPage.pageType === 'tab') {
|
||||
this.transitionToRoute('document.section',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
newPage.id);
|
||||
} else {
|
||||
resolve(newPage.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onDeleteBlock(blockId) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('sectionService').deleteBlock(blockId).then(() => {
|
||||
this.send("showNotification", "Deleted");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onSavePageAsBlock(block) {
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('sectionService').addBlock(block).then(() => {
|
||||
this.showNotification("Published");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onDocumentDelete() {
|
||||
this.get('documentService').deleteDocument(this.get('model.document.id')).then(() => {
|
||||
this.send("showNotification", "Deleted");
|
||||
this.transitionToRoute('folder', this.get('model.folder.id'), this.get('model.folder.slug'));
|
||||
});
|
||||
},
|
||||
|
||||
onSaveTemplate(name, desc) {
|
||||
this.get('templateService').saveAsTemplate(this.get('model.document.id'), name, desc).then(function () {});
|
||||
},
|
||||
|
||||
onPageSequenceChange(changes) {
|
||||
this.get('documentService').changePageSequence(this.get('model.document.id'), changes).then(() => {
|
||||
_.each(changes, (change) => {
|
||||
let pageContent = _.findWhere(this.get('model.pages'), {
|
||||
id: change.pageId
|
||||
});
|
||||
|
||||
if (is.not.undefined(pageContent)) {
|
||||
pageContent.set('sequence', change.sequence);
|
||||
}
|
||||
});
|
||||
|
||||
this.set('model.pages', this.get('model.pages').sortBy('sequence'));
|
||||
this.get('target.router').refresh();
|
||||
});
|
||||
},
|
||||
|
||||
onPageLevelChange(changes) {
|
||||
this.get('documentService').changePageLevel(this.get('model.document.id'), changes).then(() => {
|
||||
_.each(changes, (change) => {
|
||||
let pageContent = _.findWhere(this.get('model.pages'), {
|
||||
id: change.pageId
|
||||
});
|
||||
|
||||
if (is.not.undefined(pageContent)) {
|
||||
pageContent.set('level', change.level);
|
||||
}
|
||||
});
|
||||
|
||||
let pages = this.get('model.pages');
|
||||
pages = pages.sortBy('sequence');
|
||||
this.set('model.pages', []);
|
||||
this.set('model.pages', pages);
|
||||
this.get('target.router').refresh();
|
||||
});
|
||||
},
|
||||
|
||||
onGotoPage(id) {
|
||||
if (this.get('pageId') !== id && id !== '') {
|
||||
this.set('pageId', id);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
36
gui/app/pods/document/index/route.js
Normal file
36
gui/app/pods/document/index/route.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
linkService: Ember.inject.service('link'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
userService: Ember.inject.service('user'),
|
||||
|
||||
model() {
|
||||
let document = this.modelFor('document').document;
|
||||
this.browser.setTitle(document.get('name'));
|
||||
this.browser.setMetaDescription(document.get('excerpt'));
|
||||
|
||||
return Ember.RSVP.hash({
|
||||
folders: this.modelFor('document').folders,
|
||||
folder: this.modelFor('document').folder,
|
||||
document: this.modelFor('document').document,
|
||||
pages: this.get('documentService').getPages(this.modelFor('document').document.get('id')),
|
||||
links: this.modelFor('document').links,
|
||||
sections: this.modelFor('document').sections,
|
||||
isEditor: this.get('folderService').get('canEditCurrentFolder')
|
||||
});
|
||||
}
|
||||
});
|
26
gui/app/pods/document/index/template.hbs
Normal file
26
gui/app/pods/document/index/template.hbs
Normal file
|
@ -0,0 +1,26 @@
|
|||
{{#layout/zone-container}}
|
||||
{{#layout/zone-sidebar}}
|
||||
{{document/sidebar-zone folders=model.folders folder=model.folder document=model.document
|
||||
pages=model.pages sections=model.section links=model.links isEditor=model.isEditor tab=tab
|
||||
onDocumentDelete=(action 'onDocumentDelete') onSaveTemplate=(action 'onSaveTemplate')
|
||||
onPageSequenceChange=(action 'onPageSequenceChange') onPageLevelChange=(action 'onPageLevelChange') onGotoPage=(action 'onGotoPage')}}
|
||||
{{/layout/zone-sidebar}}
|
||||
{{#layout/zone-content}}
|
||||
<div id="zone-document-content" class="zone-document-content">
|
||||
<div class="back-to-space">
|
||||
{{#link-to 'folder' model.folder.id model.folder.slug}}
|
||||
<div class="regular-button button-gray">
|
||||
<i class="material-icons">arrow_back</i>
|
||||
<div class="name">{{model.folder.name}}</div>
|
||||
</div>
|
||||
{{/link-to}}
|
||||
</div>
|
||||
{{document/document-heading document=model.document isEditor=model.isEditor onSaveDocument=(action 'onSaveDocument')}}
|
||||
{{document/document-view document=model.document links=model.links pages=model.pages
|
||||
folder=model.folder folders=model.folders sections=model.sections isEditor=model.isEditor pageId=pageId
|
||||
onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
|
||||
onSavePageAsBlock=(action 'onSavePageAsBlock') onDeleteBlock=(action 'onDeleteBlock') onGotoPage=(action 'onGotoPage')
|
||||
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted')}}
|
||||
</div>
|
||||
{{/layout/zone-content}}
|
||||
{{/layout/zone-container}}
|
66
gui/app/pods/document/route.js
Normal file
66
gui/app/pods/document/route.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
sectionService: Ember.inject.service('section'),
|
||||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
linkService: Ember.inject.service('link'),
|
||||
|
||||
beforeModel(transition) {
|
||||
this.set('pageId', is.not.undefined(transition.queryParams.page) ? transition.queryParams.page : "");
|
||||
this.set('folderId', this.paramsFor('document').folder_id);
|
||||
this.set('documentId', this.paramsFor('document').document_id);
|
||||
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('documentService').getDocument(this.get('documentId')).then((document) => {
|
||||
this.set('document', document);
|
||||
|
||||
this.get('folderService').getAll().then((folders) => {
|
||||
this.set('folders', folders);
|
||||
|
||||
this.get('folderService').getFolder(this.get('folderId')).then((folder) => {
|
||||
this.set('folder', folder);
|
||||
|
||||
this.get('folderService').setCurrentFolder(folder).then(() => {
|
||||
this.set('isEditor', this.get('folderService').get('canEditCurrentFolder'));
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
model() {
|
||||
return Ember.RSVP.hash({
|
||||
folders: this.get('folders'),
|
||||
folder: this.get('folder'),
|
||||
document: this.get('document'),
|
||||
page: this.get('pageId'),
|
||||
isEditor: this.get('isEditor'),
|
||||
links: this.get('linkService').getDocumentLinks(this.get('documentId')),
|
||||
sections: this.get('sectionService').getAll()
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
error(error /*, transition*/ ) {
|
||||
if (error) {
|
||||
this.transitionTo('/not-found');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
49
gui/app/pods/document/section/controller.js
Normal file
49
gui/app/pods/document/section/controller.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
|
||||
actions: {
|
||||
onCancel() {
|
||||
this.transitionToRoute('document.index',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
{ queryParams: { pageId: this.get('model.page.id') }});
|
||||
},
|
||||
|
||||
onAction(page, meta) {
|
||||
this.showNotification("Saved");
|
||||
|
||||
let model = {
|
||||
page: page.toJSON({ includeId: true }),
|
||||
meta: meta.toJSON({ includeId: true })
|
||||
};
|
||||
|
||||
this.get('documentService').updatePage(page.get('documentId'), page.get('id'), model).then((page) => {
|
||||
let data = this.get('store').normalize('page', page);
|
||||
this.get('store').push(data);
|
||||
|
||||
this.transitionToRoute('document.index',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
{ queryParams: { pageId: page.get('id')}});
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
40
gui/app/pods/document/section/route.js
Normal file
40
gui/app/pods/document/section/route.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
userService: Ember.inject.service('user'),
|
||||
|
||||
model(params) {
|
||||
return Ember.RSVP.hash({
|
||||
folders: this.modelFor('document').folders,
|
||||
folder: this.modelFor('document').folder,
|
||||
document: this.modelFor('document').document,
|
||||
isEditor: this.get('folderService').get('canEditCurrentFolder'),
|
||||
links: this.modelFor('document').links,
|
||||
sections: this.modelFor('document').sections,
|
||||
page: this.get('documentService').getPage(this.modelFor('document').document.get('id'), params.page_id),
|
||||
meta: this.get('documentService').getPageMeta(this.modelFor('document').document.get('id'), params.page_id)
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
$('body').addClass('background-color-off-white');
|
||||
},
|
||||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
15
gui/app/pods/document/section/template.hbs
Normal file
15
gui/app/pods/document/section/template.hbs
Normal file
|
@ -0,0 +1,15 @@
|
|||
<div class="zone-section-editor">
|
||||
<div class="page-container">
|
||||
<div id="page-content-wrapper">
|
||||
<div id="zone-document-content" class="zone-document-content">
|
||||
<div class="back-to-space">
|
||||
{{#link-to 'document.index' model.folder.id model.folder.slug model.document.id model.document.slug}}
|
||||
<i class="material-icons">arrow_back</i> {{model.document.name}}
|
||||
{{/link-to}}
|
||||
</div>
|
||||
{{document/document-heading document=model.document isEditor=false}}
|
||||
{{document/document-editor document=model.document folder=model.folder page=model.page meta=model.meta onCancel=(action 'onCancel') onAction=(action 'onAction')}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
2
gui/app/pods/document/template.hbs
Normal file
2
gui/app/pods/document/template.hbs
Normal file
|
@ -0,0 +1,2 @@
|
|||
{{layout/zone-navigation}}
|
||||
{{outlet}}
|
86
gui/app/pods/folder/controller.js
Normal file
86
gui/app/pods/folder/controller.js
Normal file
|
@ -0,0 +1,86 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
localStorage: Ember.inject.service('localStorage'),
|
||||
hasSelectedDocuments: false,
|
||||
selectedDocuments: [],
|
||||
queryParams: ['tab'],
|
||||
tab: 'index',
|
||||
|
||||
actions: {
|
||||
onDocumentsChecked(documents) {
|
||||
this.set('selectedDocuments', documents);
|
||||
this.set('hasSelectedDocuments', documents.length > 0);
|
||||
},
|
||||
|
||||
onMoveDocument(folder) {
|
||||
let self = this;
|
||||
let documents = this.get('selectedDocuments');
|
||||
|
||||
documents.forEach(function (documentId) {
|
||||
self.get('documentService').getDocument(documentId).then(function (doc) {
|
||||
doc.set('folderId', folder);
|
||||
doc.set('selected', !doc.get('selected'));
|
||||
self.get('documentService').save(doc).then(function () {
|
||||
self.get('target.router').refresh();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.set('selectedDocuments', []);
|
||||
this.set('hasSelectedDocuments', false);
|
||||
this.send("showNotification", "Moved");
|
||||
},
|
||||
|
||||
onDeleteDocument() {
|
||||
let documents = this.get('selectedDocuments');
|
||||
let self = this;
|
||||
|
||||
documents.forEach(function (document) {
|
||||
self.get('documentService').deleteDocument(document).then(function () {
|
||||
self.get('target.router').refresh();
|
||||
});
|
||||
});
|
||||
|
||||
this.set('selectedDocuments', []);
|
||||
this.set('hasSelectedDocuments', false);
|
||||
this.send("showNotification", "Deleted");
|
||||
},
|
||||
|
||||
onFolderAdd(folder) {
|
||||
let self = this;
|
||||
this.showNotification("Added");
|
||||
|
||||
this.get('folderService').add({ name: folder }).then(function (newFolder) {
|
||||
self.get('folderService').setCurrentFolder(newFolder);
|
||||
self.transitionToRoute('folder', newFolder.get('id'), newFolder.get('slug'));
|
||||
});
|
||||
},
|
||||
|
||||
onDeleteSpace() {
|
||||
this.get('folderService').delete(this.get('model.folder.id')).then(() => { /* jshint ignore:line */
|
||||
this.showNotification("Deleted");
|
||||
this.get('localStorage').clearSessionItem('folder');
|
||||
this.transitionToRoute('application');
|
||||
});
|
||||
},
|
||||
|
||||
onImport() {
|
||||
this.get('target.router').refresh();
|
||||
}
|
||||
}
|
||||
});
|
61
gui/app/pods/folder/route.js
Normal file
61
gui/app/pods/folder/route.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
session: Ember.inject.service(''),
|
||||
folder: {},
|
||||
|
||||
beforeModel() {
|
||||
this.set('folderId', this.paramsFor('folder').folder_id)
|
||||
|
||||
return new Ember.RSVP.Promise((resolve) => {
|
||||
this.get('folderService').getFolder(this.get('folderId')).then((folder) => {
|
||||
this.set('folder', folder);
|
||||
|
||||
this.get('folderService').setCurrentFolder(folder).then(() => {
|
||||
this.set('isEditor', this.get('folderService').get('canEditCurrentFolder'));
|
||||
this.set('isFolderOwner', this.get('session.user.id') === folder.get('userId'));
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
model(params) {
|
||||
return Ember.RSVP.hash({
|
||||
folder: this.get('folder'),
|
||||
isEditor: this.get('isEditor'),
|
||||
isFolderOwner: this.get('isFolderOwner'),
|
||||
folders: this.get('folderService').getAll(),
|
||||
documents: this.get('documentService').getAllByFolder(params.folder_id)
|
||||
});
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
this.browser.setTitle(model.folder.get('name'));
|
||||
},
|
||||
|
||||
actions: {
|
||||
error(error /*, transition*/ ) {
|
||||
if (error) {
|
||||
this.transitionTo('/not-found');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
14
gui/app/pods/folder/template.hbs
Normal file
14
gui/app/pods/folder/template.hbs
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{layout/zone-navigation}}
|
||||
{{#layout/zone-container}}
|
||||
{{#layout/zone-sidebar}}
|
||||
{{folder/sidebar-zone folders=model.folders folder=model.folder isFolderOwner=model.isFolderOwner isEditor=model.isEditor tab=tab
|
||||
onFolderAdd=(action 'onFolderAdd')}}
|
||||
{{/layout/zone-sidebar}}
|
||||
{{#layout/zone-content}}
|
||||
{{folder/folder-heading folder=model.folder isFolderOwner=model.isFolderOwner isEditor=model.isEditor}}
|
||||
{{folder/folder-toolbar folders=model.folders folder=model.folder hasSelectedDocuments=hasSelectedDocuments
|
||||
onDeleteDocument=(action 'onDeleteDocument') onMoveDocument=(action 'onMoveDocument')}}
|
||||
{{folder/documents-list documents=model.documents folders=model.folders folder=model.folder isFolderOwner=model.isFolderOwner isEditor=model.isEditor
|
||||
onDocumentsChecked=(action 'onDocumentsChecked') onDeleteSpace=(action 'onDeleteSpace') onImport=(action 'onImport')}}
|
||||
{{/layout/zone-content}}
|
||||
{{/layout/zone-container}}
|
29
gui/app/pods/folders/controller.js
Normal file
29
gui/app/pods/folders/controller.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
actions: {
|
||||
onFolderAdd(folder) {
|
||||
let self = this;
|
||||
this.showNotification("Added");
|
||||
|
||||
this.get('folderService').add({ name: folder }).then(function (newFolder) {
|
||||
self.get('folderService').setCurrentFolder(newFolder);
|
||||
self.transitionToRoute('folder', newFolder.get('id'), newFolder.get('slug'));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
21
gui/app/pods/folders/route.js
Normal file
21
gui/app/pods/folders/route.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
folderService: Ember.inject.service('folder'),
|
||||
|
||||
model() {
|
||||
return this.get('folderService').getAll();
|
||||
}
|
||||
});
|
9
gui/app/pods/folders/template.hbs
Normal file
9
gui/app/pods/folders/template.hbs
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{layout/zone-navigation}}
|
||||
{{#layout/zone-container}}
|
||||
{{#layout/zone-sidebar}}
|
||||
{{folder/sidebar-zone folders=model noFolder=true isFolderOwner=false isEditor=false
|
||||
onFolderAdd=(action 'onFolderAdd')}}
|
||||
{{/layout/zone-sidebar}}
|
||||
{{#layout/zone-content}}
|
||||
{{/layout/zone-content}}
|
||||
{{/layout/zone-container}}
|
14
gui/app/pods/not-found/controller.js
Normal file
14
gui/app/pods/not-found/controller.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({});
|
19
gui/app/pods/not-found/route.js
Normal file
19
gui/app/pods/not-found/route.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel() {
|
||||
this.transitionTo('folders');
|
||||
}
|
||||
});
|
2
gui/app/pods/not-found/template.hbs
Normal file
2
gui/app/pods/not-found/template.hbs
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h1>Not found</h1>
|
||||
{{outlet}}
|
37
gui/app/pods/profile/controller.js
Normal file
37
gui/app/pods/profile/controller.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
const {
|
||||
isPresent
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
userService: Ember.inject.service('user'),
|
||||
session: Ember.inject.service(),
|
||||
|
||||
actions: {
|
||||
save(passwords) {
|
||||
let password = passwords.password;
|
||||
let confirmation = passwords.confirmation;
|
||||
|
||||
return this.get('userService').save(this.model).then(() => {
|
||||
if (isPresent(password) && isPresent(confirmation)) {
|
||||
this.get('userService').updatePassword(this.get('model.id'), password);
|
||||
}
|
||||
this.model.generateInitials();
|
||||
this.get('session').set('user', this.model);
|
||||
this.transitionToRoute('folders');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
38
gui/app/pods/profile/route.js
Normal file
38
gui/app/pods/profile/route.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
userService: Ember.inject.service('user'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
session: Ember.inject.service(),
|
||||
|
||||
beforeModel: function () {
|
||||
if (!this.get("session.authenticated")) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model: function () {
|
||||
return this.get('userService').getUser(this.get("session.session.authenticated.user.id"));
|
||||
},
|
||||
|
||||
afterModel: function (model) {
|
||||
this.browser.setTitleWithoutSuffix(model.get('fullname'));
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set("folder", this.get('folderService.currentFolder'));
|
||||
}
|
||||
});
|
18
gui/app/pods/profile/template.hbs
Normal file
18
gui/app/pods/profile/template.hbs
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{layout/zone-navigation}}
|
||||
{{#layout/zone-container}}
|
||||
{{#layout/zone-sidebar}}
|
||||
<div class="sidebar-toolbar">
|
||||
</div>
|
||||
<div class="sidebar-common">
|
||||
{{layout/sidebar-intro title="Profile" message="Your user profile"}}
|
||||
</div>
|
||||
<div class="sidebar-wrapper">
|
||||
<div class="sidebar-menu">
|
||||
<div class="avatar-large">{{session.user.initials}}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/layout/zone-sidebar}}
|
||||
{{#layout/zone-content}}
|
||||
{{user-profile model=model save=(action 'save')}}
|
||||
{{/layout/zone-content}}
|
||||
{{/layout/zone-container}}
|
31
gui/app/pods/search/controller.js
Normal file
31
gui/app/pods/search/controller.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
searchService: Ember.inject.service('search'),
|
||||
queryParams: ['filter'],
|
||||
filter: "",
|
||||
results: [],
|
||||
|
||||
onKeywordChange: function () {
|
||||
Ember.run.debounce(this, this.fetch, 750);
|
||||
}.observes('filter'),
|
||||
|
||||
fetch() {
|
||||
let self = this;
|
||||
|
||||
this.get('searchService').find(this.get('filter')).then(function (response) {
|
||||
self.set('results', response);
|
||||
});
|
||||
}
|
||||
});
|
15
gui/app/pods/search/route.js
Normal file
15
gui/app/pods/search/route.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin);
|
22
gui/app/pods/search/template.hbs
Normal file
22
gui/app/pods/search/template.hbs
Normal file
|
@ -0,0 +1,22 @@
|
|||
{{layout/zone-navigation}}
|
||||
{{#layout/zone-container}}
|
||||
{{#layout/zone-sidebar}}
|
||||
<div class="sidebar-toolbar">
|
||||
</div>
|
||||
<div class="sidebar-common">
|
||||
{{layout/sidebar-intro title="Search" message='#tag, keyword, "some phrase", this AND that, this OR that'}}
|
||||
</div>
|
||||
<div class="sidebar-wrapper">
|
||||
<div class="page-search">
|
||||
<div class="input-control">
|
||||
{{focus-input type="text" value=filter placeholder='search'}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/layout/zone-sidebar}}
|
||||
{{#layout/zone-content}}
|
||||
<div class="page-search">
|
||||
{{search/search-results results=results}}
|
||||
</div>
|
||||
{{/layout/zone-content}}
|
||||
{{/layout/zone-container}}
|
34
gui/app/pods/setup/controller.js
Normal file
34
gui/app/pods/setup/controller.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import NotifierMixin from "../../mixins/notifier";
|
||||
import Encoding from "../../utils/encoding";
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
|
||||
ajax: Ember.inject.service(),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
return this.get('ajax').request("/setup", {
|
||||
method: 'POST',
|
||||
data: this.model,
|
||||
dataType: "text",
|
||||
}).then(() => {
|
||||
var credentials = Encoding.Base64.encode(":" + this.model.email + ":" + this.model.password);
|
||||
window.location.href = "/auth/sso/" + encodeURIComponent(credentials);
|
||||
}).catch((error) => { // eslint-disable-line no-unused-vars
|
||||
// TODO notify user of the error within the GUI
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
41
gui/app/pods/setup/route.js
Normal file
41
gui/app/pods/setup/route.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
beforeModel() {
|
||||
let pwd = document.head.querySelector("[property=dbhash]").content;
|
||||
if (pwd.length === 0 || pwd === "{{.DBhash}}") {
|
||||
this.transitionTo('auth.login'); // don't allow access to this page if we are not in setup mode, kick them out altogether
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
let pwd = document.head.querySelector("[property=dbhash]").content;
|
||||
|
||||
return {
|
||||
dbname: document.head.querySelector("[property=dbname]").content,
|
||||
dbhash: pwd,
|
||||
title: "",
|
||||
message: "This Documize instance contains all our team documentation",
|
||||
allowAnonymousAccess: false,
|
||||
firstname: "",
|
||||
lastname: "",
|
||||
email: "",
|
||||
password: pwd
|
||||
};
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Setup Documize database '" + document.head.querySelector("[property=dbname]").content + "'";
|
||||
}
|
||||
});
|
13
gui/app/pods/setup/template.hbs
Normal file
13
gui/app/pods/setup/template.hbs
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div class="page-setup container-fluid padding-100">
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-md-3 col-sm-3">
|
||||
<div>
|
||||
<img src="/assets/img/setup/logo.png" alt="Documize" class="no-select no-outline margin-top-20" />
|
||||
</div>
|
||||
<div class="margin-top-150">
|
||||
<img src="/assets/img/setup/cogs.png" width="157" height="187" alt="Setup new database" class="no-select no-outline" />
|
||||
</div>
|
||||
</div>
|
||||
{{documize-setup model=model save=(action 'save')}}
|
||||
</div>
|
||||
</div>
|
15
gui/app/pods/widgets/route.js
Normal file
15
gui/app/pods/widgets/route.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin);
|
3
gui/app/pods/widgets/template.hbs
Normal file
3
gui/app/pods/widgets/template.hbs
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div class="margin-top-50 margin-left-50">
|
||||
{{widget-sample}}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue