mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
export Application (shimming)
This commit is contained in:
parent
72d79e8e31
commit
ad2ca33c6f
@ -66,9 +66,9 @@ import 'tether/dist/js/tether';
|
|||||||
import 'angular-bind-html-compile/angular-bind-html-compile';
|
import 'angular-bind-html-compile/angular-bind-html-compile';
|
||||||
import 'angular-ui-tour/app/angular-ui-tour';
|
import 'angular-ui-tour/app/angular-ui-tour';
|
||||||
|
|
||||||
import '../src/javascript/app.js';
|
require('../src/javascript/app.js');
|
||||||
import '../src/javascript/router.js.erb';
|
require('../src/javascript/router.js.erb');
|
||||||
import '../src/javascript/plugins.js.erb';
|
require('../src/javascript/plugins.js.erb');
|
||||||
|
|
||||||
require.context('../src/javascript/controllers/', true, /.*/);
|
require.context('../src/javascript/controllers/', true, /.*/);
|
||||||
require.context('../src/javascript/services/', true, /.*/);
|
require.context('../src/javascript/services/', true, /.*/);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// eslint-disable-next-line no-use-before-define
|
// eslint-disable-next-line no-use-before-define
|
||||||
var Application = Application || {};
|
const Application = Application || {};
|
||||||
|
|
||||||
Application.Constants = angular.module('application.constants', []);
|
Application.Constants = angular.module('application.constants', []);
|
||||||
Application.Services = angular.module('application.services', []);
|
Application.Services = angular.module('application.services', []);
|
||||||
@ -66,8 +66,8 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout
|
|||||||
$translateProvider.preferredLanguage(Fablab.locale);
|
$translateProvider.preferredLanguage(Fablab.locale);
|
||||||
// End the tour when the user clicks the forward or back buttons of the browser
|
// End the tour when the user clicks the forward or back buttons of the browser
|
||||||
TourConfigProvider.enableNavigationInterceptors();
|
TourConfigProvider.enableNavigationInterceptors();
|
||||||
}]).run(['$rootScope', '$log', 'AuthService', 'Auth', 'amMoment', '$state', 'editableOptions', 'Analytics',
|
}]).run(['$rootScope', '$log', 'Auth', 'amMoment', '$state', 'editableOptions', 'Analytics',
|
||||||
function ($rootScope, $log, AuthService, Auth, amMoment, $state, editableOptions, Analytics) {
|
function ($rootScope, $log, Auth, amMoment, $state, editableOptions, Analytics) {
|
||||||
// Angular-moment (date-time manipulations library)
|
// Angular-moment (date-time manipulations library)
|
||||||
amMoment.changeLocale(Fablab.moment_locale);
|
amMoment.changeLocale(Fablab.moment_locale);
|
||||||
|
|
||||||
@ -146,3 +146,5 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout
|
|||||||
angular.isUndefinedOrNull = function (val) {
|
angular.isUndefinedOrNull = function (val) {
|
||||||
return angular.isUndefined(val) || val === null;
|
return angular.isUndefined(val) || val === null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = { Application };
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Application.Services.factory('AuthService', ['Session', 'CSRF', function (Session, CSRF) {
|
Application.Services.factory('AuthService', ['Session', function (Session) {
|
||||||
let service = {};
|
const service = {};
|
||||||
|
|
||||||
service.isAuthenticated = function() {
|
service.isAuthenticated = function() {
|
||||||
return (Session.currentUser != null) && (Session.currentUser.id != null);
|
return (Session.currentUser != null) && (Session.currentUser.id != null);
|
||||||
|
@ -121,8 +121,7 @@
|
|||||||
<span class="text-sm">Powered by <a href="http://www.fab-manager.com" target="_blank">Fab-manager</a></span>
|
<span class="text-sm">Powered by <a href="http://www.fab-manager.com" target="_blank">Fab-manager</a></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= javascript_packs_with_chunks_tag 'locale' %>
|
|
||||||
<%= javascript_packs_with_chunks_tag 'application' %>
|
<%= javascript_packs_with_chunks_tag 'application' %>
|
||||||
|
<%= javascript_packs_with_chunks_tag 'locale' %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,6 +5,8 @@ const sass = require('./loaders/sass');
|
|||||||
const sassErb = require('./loaders/sass_erb');
|
const sassErb = require('./loaders/sass_erb');
|
||||||
const html = require('./loaders/html');
|
const html = require('./loaders/html');
|
||||||
const fonts = require('./loaders/fonts');
|
const fonts = require('./loaders/fonts');
|
||||||
|
const exposeApp = require('./loaders/expose_app');
|
||||||
|
const imports = require('./loaders/imports');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
|
||||||
environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
|
environment.plugins.prepend('Provide', new webpack.ProvidePlugin({
|
||||||
@ -22,6 +24,9 @@ environment.loaders.append('html', html);
|
|||||||
environment.loaders.append('sass', sass);
|
environment.loaders.append('sass', sass);
|
||||||
environment.loaders.append('fonts', fonts);
|
environment.loaders.append('fonts', fonts);
|
||||||
|
|
||||||
|
environment.loaders.append('expose-app', exposeApp);
|
||||||
|
environment.loaders.append('imports', imports);
|
||||||
|
|
||||||
environment.splitChunks();
|
environment.splitChunks();
|
||||||
|
|
||||||
module.exports = environment;
|
module.exports = environment;
|
||||||
|
7
config/webpack/loaders/expose_app.js
Normal file
7
config/webpack/loaders/expose_app.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = {
|
||||||
|
test: require.resolve('../../../app/frontend/src/javascript/app.js'),
|
||||||
|
loader: 'expose-loader',
|
||||||
|
options: {
|
||||||
|
exposes: 'app'
|
||||||
|
}
|
||||||
|
};
|
13
config/webpack/loaders/imports.js
Normal file
13
config/webpack/loaders/imports.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
test: /\.js(\?.erb)?$/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'imports-loader',
|
||||||
|
options: {
|
||||||
|
imports: [
|
||||||
|
'default app Application'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
@ -10,12 +10,7 @@ default: &default
|
|||||||
|
|
||||||
# Additional paths webpack should lookup modules
|
# Additional paths webpack should lookup modules
|
||||||
# ['app/assets', 'engine/foo/app/assets']
|
# ['app/assets', 'engine/foo/app/assets']
|
||||||
additional_paths: [
|
additional_paths: []
|
||||||
'angular-i18n',
|
|
||||||
'moment/locale',
|
|
||||||
'summernote/lang',
|
|
||||||
'fullcalendar/dist/lang'
|
|
||||||
]
|
|
||||||
|
|
||||||
# Reload manifest.json on all requests so we reload latest compiled packs
|
# Reload manifest.json on all requests so we reload latest compiled packs
|
||||||
cache_manifest: false
|
cache_manifest: false
|
||||||
|
@ -24,8 +24,10 @@
|
|||||||
"eslint-plugin-node": "~11.0.0",
|
"eslint-plugin-node": "~11.0.0",
|
||||||
"eslint-plugin-promise": "~4.2.1",
|
"eslint-plugin-promise": "~4.2.1",
|
||||||
"eslint-plugin-standard": "~4.0.1",
|
"eslint-plugin-standard": "~4.0.1",
|
||||||
|
"expose-loader": "^1.0.0",
|
||||||
"file-loader": "^6.1.0",
|
"file-loader": "^6.1.0",
|
||||||
"html-loader": "^1.3.0",
|
"html-loader": "^1.3.0",
|
||||||
|
"imports-loader": "^1.1.0",
|
||||||
"rails-erb-loader": "^5.5.2",
|
"rails-erb-loader": "^5.5.2",
|
||||||
"resolve-url-loader": "^3.1.1",
|
"resolve-url-loader": "^3.1.1",
|
||||||
"webpack": "^4.44.1",
|
"webpack": "^4.44.1",
|
||||||
|
23
yarn.lock
23
yarn.lock
@ -3488,6 +3488,14 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
homedir-polyfill "^1.0.1"
|
homedir-polyfill "^1.0.1"
|
||||||
|
|
||||||
|
expose-loader@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/expose-loader/-/expose-loader-1.0.0.tgz#1676dde8fce6662584e17f8531e24d2afe8dae11"
|
||||||
|
integrity sha512-xgt47+pEQrlCyCoO09cMKWf5qiurK6qMtvjUPm8+Uso5WwkNHeD47P0Zb3R9Kvk5zUcJWLax95xaaXDJCmoNjw==
|
||||||
|
dependencies:
|
||||||
|
loader-utils "^2.0.0"
|
||||||
|
schema-utils "^2.6.6"
|
||||||
|
|
||||||
express@^4.17.1:
|
express@^4.17.1:
|
||||||
version "4.17.1"
|
version "4.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
|
resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
|
||||||
@ -4405,6 +4413,16 @@ import-local@^2.0.0:
|
|||||||
pkg-dir "^3.0.0"
|
pkg-dir "^3.0.0"
|
||||||
resolve-cwd "^2.0.0"
|
resolve-cwd "^2.0.0"
|
||||||
|
|
||||||
|
imports-loader@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/imports-loader/-/imports-loader-1.1.0.tgz#1c3a388d0c5cd7f9eb08f3646d4aae3b70e57933"
|
||||||
|
integrity sha512-HcPM6rULdQ6EBLVq+5O+CF9xb7qiUjsRm6V28bTG/c3IU5sQkVZzUDwYY0r4jHvSAmVFdO9WA/vLAURR5WQSeQ==
|
||||||
|
dependencies:
|
||||||
|
loader-utils "^2.0.0"
|
||||||
|
schema-utils "^2.7.0"
|
||||||
|
source-map "^0.6.1"
|
||||||
|
strip-comments "^2.0.1"
|
||||||
|
|
||||||
imurmurhash@^0.1.4:
|
imurmurhash@^0.1.4:
|
||||||
version "0.1.4"
|
version "0.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
||||||
@ -8166,6 +8184,11 @@ strip-bom@^3.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
|
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
|
||||||
integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=
|
integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=
|
||||||
|
|
||||||
|
strip-comments@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-comments/-/strip-comments-2.0.1.tgz#4ad11c3fbcac177a67a40ac224ca339ca1c1ba9b"
|
||||||
|
integrity sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==
|
||||||
|
|
||||||
strip-eof@^1.0.0:
|
strip-eof@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
|
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user