Commit 3e365c07 authored by EL HASSANE GARGEM's avatar EL HASSANE GARGEM
Browse files

front side of onboarding

parent ee3d2eec
......@@ -200,7 +200,9 @@ var partVM = new Vue({
this.intro.setOptions({steps: steps_intro});
this.intro.start();
this.intro.onexit(function () {
exitonboarding();
exitonboarding({
onboarding_edit : "False",
});
});
this.intro.oncomplete(function () {
......
......@@ -147,7 +147,7 @@ class DocumentImages(LoginRequiredMixin, DocumentMixin, DetailView):
context['process_form'] = DocumentProcessForm(self.object, self.request.user)
context['import_form'] = ImportForm(self.object, self.request.user)
context['export_form'] = ExportForm(self.object, self.request.user)
context['onboarding'] = self.request.user.onboarding
context['onboarding_images'] = self.request.user.onboarding_images
return context
......@@ -250,7 +250,7 @@ class EditPart(LoginRequiredMixin, DetailView):
context['object'] = self.object.document
context['document'] = self.object.document
context['part'] = self.object
context['onboarding'] = self.request.user.onboarding
context['onboarding_edit'] = self.request.user.onboarding_edit
return context
def dispatch(self, *args, **kwargs):
......@@ -287,7 +287,7 @@ class ModelsList(LoginRequiredMixin, ListView):
if self.document:
context['document'] = self.document
context['object'] = self.document # legacy
context['onboarding'] = self.request.user.onboarding # legacy
context['onboarding_models'] = self.request.user.onboarding_models
return context
......
......@@ -20,11 +20,23 @@ class User(AbstractUser):
)
fields = models.ManyToManyField('ResearchField', blank=True)
onboarding = models.BooleanField(
onboarding_images = models.BooleanField(
_('first connection'),
default=True
)
onboarding_edit = models.BooleanField(
default=True
)
onboarding_models = models.BooleanField(
default=True
)
onboarding_trans = models.BooleanField(
default=True
)
class Meta:
permissions = (('can_invite', 'Can invite users'),)
......
function exitonboarding() {
function exitonboarding(onboarding) {
$.ajax({type: 'PUT', url:'/api/users/onboarding/',
contentType: "application/json; charset=utf-8",
data:JSON.stringify({
onboarding : "False",
})
data:JSON.stringify(onboarding)
}).done($.proxy(function(data){
}, this)).fail(function(data) {
......
......@@ -116,7 +116,7 @@
<script type="text/javascript">
'use strict';
const DOCUMENT_ID = {{ document.pk }};
const onboarding = "{{ onboarding }}";
const onboarding_images = "{{ onboarding_images }}";
$(document).ready(function() {
// join the ws room
msgSocket.addEventListener('open', function(ev) {
......@@ -138,11 +138,13 @@ $(document).ready(function() {
{% endcompress %}
<script type="text/javascript">
if (onboarding == "True")
if (onboarding_images == "True")
{
document_images_intro.start();
document_images_intro.onexit(function() {
exitonboarding();
exitonboarding({
onboarding_images : "False",
});
});
document_images_intro.oncomplete(function() {
......
......@@ -621,7 +621,7 @@
const TEXT_DIRECTION = '{{document.main_script.text_direction}}';
const DOCUMENT_ID = '{{document.id}}';
var PART_ID = {{part.id}}; // can be changed with next & previous pages
const onboarding = "{{ onboarding }}";
const onboarding_edit = "{{ onboarding_edit }}";
var models_url = "{% url 'document-models' document_pk=document.pk %}";
</script>
......
......@@ -87,16 +87,20 @@ $(document).ready(function() {
</script>
<script src="{% static 'js/models.js' %}"></script>
<script type="text/javascript">
const onboarding = "{{ onboarding }}";
if (onboarding == "True") {
const onboarding_models = "{{ onboarding_models }}";
if (onboarding_models == "True") {
models_intro.start();
models_intro.onexit(function () {
exitonboarding();
exitonboarding({
onboarding_models : "False",
});
});
models_intro.oncomplete(function () {
exitonboarding();
exitonboarding({
onboarding_models : "False",
});
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment