diff --git a/app/assets/javascripts/app.js b/app/assets/javascripts/app.js index 7cf00c581..8a2a48eee 100644 --- a/app/assets/javascripts/app.js +++ b/app/assets/javascripts/app.js @@ -20,9 +20,10 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout 'ui.select', 'ui.calendar', 'angularMoment', 'Devise', 'DeviseModal', 'angular-growl', 'xeditable', 'checklist-model', 'unsavedChanges', 'angular-loading-bar', 'ngTouch', 'angular-google-analytics', 'angularUtils.directives.dirDisqus', 'summernote', 'elasticsearch', 'angular-medium-editor', 'naif.base64', - 'minicolors', 'pascalprecht.translate', 'ngFitText', 'ngAside', 'ngCapsLock', 'vcRecaptcha', 'ui.codemirror']) - .config(['$httpProvider', 'AuthProvider', 'growlProvider', 'unsavedWarningsConfigProvider', 'AnalyticsProvider', 'uibDatepickerPopupConfig', '$provide', '$translateProvider', - function ($httpProvider, AuthProvider, growlProvider, unsavedWarningsConfigProvider, AnalyticsProvider, uibDatepickerPopupConfig, $provide, $translateProvider) { + 'minicolors', 'pascalprecht.translate', 'ngFitText', 'ngAside', 'ngCapsLock', 'vcRecaptcha', 'ui.codemirror', + 'bm.uiTour']) + .config(['$httpProvider', 'AuthProvider', 'growlProvider', 'unsavedWarningsConfigProvider', 'AnalyticsProvider', 'uibDatepickerPopupConfig', '$provide', '$translateProvider', 'TourConfigProvider', + function ($httpProvider, AuthProvider, growlProvider, unsavedWarningsConfigProvider, AnalyticsProvider, uibDatepickerPopupConfig, $provide, $translateProvider, TourConfigProvider) { // Google analytics // first we check the user acceptance const cookiesConsent = document.cookie.replace(/(?:(?:^|.*;\s*)fab-manager-cookies-consent\s*=\s*([^;]*).*$)|^.*$/, '$1'); @@ -63,6 +64,8 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout $translateProvider.useMessageFormatInterpolation(); // Set the langage of the instance (from ruby configuration) $translateProvider.preferredLanguage(Fablab.locale); + // End the tour when the user clicks the forward or back buttons of the browser + TourConfigProvider.enableNavigationInterceptors(); }]).run(['$rootScope', '$log', 'AuthService', 'Auth', 'amMoment', '$state', 'editableOptions', 'Analytics', function ($rootScope, $log, AuthService, Auth, amMoment, $state, editableOptions, Analytics) { // Angular-moment (date-time manipulations library) diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index ceba90d3a..ae13c0356 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -72,6 +72,11 @@ //= require codemirror/mode/css/css //= require codemirror/mode/sass/sass //= require angular-ui-codemirror/src/ui-codemirror +//= require angular-hotkeys/build/hotkeys +//= require hone/dist/hone +//= require tether/dist/js/tether +//= require angular-bind-html-compile/angular-bind-html-compile +//= require angular-ui-tour/dist/angular-ui-tour //= require_tree ./controllers //= require_tree ./services //= require_tree ./directives diff --git a/app/assets/javascripts/controllers/home.js b/app/assets/javascripts/controllers/home.js index 68dbd5412..ead6ce2f5 100644 --- a/app/assets/javascripts/controllers/home.js +++ b/app/assets/javascripts/controllers/home.js @@ -1,7 +1,7 @@ 'use strict'; -Application.Controllers.controller('HomeController', ['$scope', '$stateParams', 'homeContentPromise', - function ($scope, $stateParams, homeContentPromise) { +Application.Controllers.controller('HomeController', ['$scope', '$stateParams', 'homeContentPromise', 'uiTourService', + function ($scope, $stateParams, homeContentPromise, uiTourService) { /* PUBLIC SCOPE */ // Home page HTML content @@ -21,6 +21,10 @@ Application.Controllers.controller('HomeController', ['$scope', '$stateParams', // We set the home page content, with the directives replacing the placeholders $scope.homeContent = insertDirectives(homeContentPromise.setting.value); + + // setup the tour + const uitour = uiTourService.getTour(); + uitour.start(); }; const insertDirectives = function (html) { diff --git a/app/assets/stylesheets/modules/tour.scss b/app/assets/stylesheets/modules/tour.scss new file mode 100644 index 000000000..5725bc3b7 --- /dev/null +++ b/app/assets/stylesheets/modules/tour.scss @@ -0,0 +1,4 @@ +.ui-tour-backdrop { + background-color: rgba(0, 0, 0, 0.5); + fill: rgba(0, 0, 0, 0.5); +} diff --git a/app/assets/templates/shared/header.html.erb b/app/assets/templates/shared/header.html.erb index 768668a4f..2eff258f4 100644 --- a/app/assets/templates/shared/header.html.erb +++ b/app/assets/templates/shared/header.html.erb @@ -1,5 +1,5 @@ -