1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

behavior of FEATURE_TOUR_DISPLAY

This commit is contained in:
Sylvain 2020-03-02 11:17:28 +01:00
parent 9ce9079ef9
commit 5186d6b22c
15 changed files with 30 additions and 31 deletions

View File

@ -310,7 +310,7 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('calendar') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('calendar') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -463,7 +463,7 @@ Application.Controllers.controller('AdminEventsController', ['$scope', '$state',
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('events') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('events') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -673,7 +673,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('invoices') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -427,7 +427,7 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('members') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('members') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -710,7 +710,7 @@ Application.Controllers.controller('EditPricingController', ['$scope', '$state',
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('pricing') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('pricing') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -199,7 +199,7 @@ Application.Controllers.controller('ProjectElementsController', ['$scope', '$sta
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('project-elements') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('project-elements') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -464,7 +464,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$rootScope'
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('settings') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('settings') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -388,7 +388,7 @@ Application.Controllers.controller('StatisticsController', ['$scope', '$state',
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('statistics') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('statistics') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -398,7 +398,7 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('trainings') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('trainings') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -290,7 +290,7 @@ Application.Controllers.controller('HomeController', ['$scope', '$stateParams',
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('welcome') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('welcome') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -259,7 +259,7 @@ Application.Controllers.controller('MachinesController', ['$scope', '$state', '_
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('machines') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('machines') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -171,7 +171,7 @@ Application.Controllers.controller('SpacesController', ['$scope', '$state', 'spa
}
});
// if the user has never seen the tour, show him now
if ($scope.currentUser.profile.tours.indexOf('spaces') < 0) {
if (Fablab.featureTourDisplay !== 'manual' && $scope.currentUser.profile.tours.indexOf('spaces') < 0) {
uitour.start();
}
// start this tour when an user press F1 - this is contextual help

View File

@ -1,6 +1,6 @@
'use strict';
Application.Services.factory('Member', ['$resource', function ($resource) {
Application.Services.factory('Member', ['$resource', '$q', function ($resource, $q) {
return $resource('/api/members/:id',
{ id: '@id' }, {
update: {
@ -35,22 +35,14 @@ Application.Services.factory('Member', ['$resource', function ($resource) {
method: 'PATCH',
url: '/api/members/:id/complete_tour',
params: { id: '@id' },
interceptor: function ($q) {
return {
request: function (config) {
if (Fablab.featureTourDisplay === 'session') {
throw new Error('session');
}
return config;
},
requestError: function (rejection) {
// do something on error
if (rejection.message === 'session') {
return { toto: 1 };
}
return rejection;
interceptor: {
response: function (response) {
if (Fablab.featureTourDisplay === 'session') {
Fablab.sessionTours.push(response.data.tours[0]);
return { tours: Fablab.sessionTours };
}
};
return response;
}
}
}
}

View File

@ -192,10 +192,14 @@ class API::MembersController < API::ApiController
def complete_tour
authorize @member
tours = "#{@member.profile.tours} #{params[:tour]}"
@member.profile.update_attributes(tours: tours.strip)
if Rails.application.secrets.feature_tour_display == 'session'
render json: { tours: [params[:tour]] }
else
tours = "#{@member.profile.tours} #{params[:tour]}"
@member.profile.update_attributes(tours: tours.strip)
render json: { tours: @member.profile.tours }
render json: { tours: @member.profile.tours.split }
end
end
private

View File

@ -62,6 +62,9 @@
Fablab.recaptchaSiteKey = "<%= RecaptchaService.site_key %>";
<% end %>
Fablab.userConfirmationNeededToSignIn = ('<%= Rails.application.secrets.user_confirmation_needed_to_sign_in %>' === 'true');
// feature tour (used when feature_tour_display = session)
Fablab.sessionTours = [];
</script>
<%= stylesheet_link_tag 'application', media: 'all' %>