diff options
50 files changed, 2333 insertions, 633 deletions
@@ -2,6 +2,8 @@ Create, edit and view notes +The concept of snoozing a note. DeQuincy via Manly P Hall: after weeping in the British museum over the fact that one cannot possibly read all the books contained in the libraries, DeQuincy said, "as I cannot read all these books, I will read only the best". Sometimes you take notes that end up not being useful to you, you can snooze these notes, surface them later, reflect on them a second time and then decide, is this something I want to keep around, is it something that has knowledge I need or is it something I should let go of and move on to something else? + ## Internal Apps ### Accounts * [User](https://git.luxagraf.net/luxagraf/writer/src/branch/master/apps/accounts/models.py) diff --git a/apps/notes/admin.py b/apps/notes/admin.py index 3958d55..44915f2 100644 --- a/apps/notes/admin.py +++ b/apps/notes/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from .models import Note, Notebook +from .models import Note, Notebook, LuxTag @admin.register(Note) @@ -8,6 +8,11 @@ class NoteAdmin(admin.ModelAdmin): pass +@admin.register(LuxTag) +class TagAdmin(admin.ModelAdmin): + pass + + @admin.register(Notebook) class NotebookAdmin(admin.ModelAdmin): pass diff --git a/apps/notes/forms.py b/apps/notes/forms.py index 5ef9f84..4dc79d2 100644 --- a/apps/notes/forms.py +++ b/apps/notes/forms.py @@ -1,10 +1,19 @@ from django import forms from django.utils.translation import ugettext_lazy as _ +from django.core.exceptions import NON_FIELD_ERRORS + +from utils.widgets import RelatedFieldWidgetCanAdd from .models import Note, Notebook -class NoteForm(forms.ModelForm): +class BaseNoteForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + self.user = kwargs.pop("user", None) + super(BaseNoteForm, self).__init__(*args, **kwargs) + + +class NoteForm(BaseNoteForm): class Meta: model = Note fields = ['title', 'body_text', 'body_html', 'body_qjson', 'notebook', 'url', 'tags'] @@ -13,14 +22,28 @@ class NoteForm(forms.ModelForm): } def __init__(self, *args, **kwargs): - self.user = kwargs.pop("user", None) + user = kwargs.pop("user", None) super(NoteForm, self).__init__(*args, **kwargs) + self.fields['notebook'].widget = RelatedFieldWidgetCanAdd(Notebook, related_url="notebooks:list") + self.fields['notebook'].queryset = Notebook.objects.filter(owner__username=user) -class NotebookForm(NoteForm): +class NotebookForm(BaseNoteForm): class Meta: model = Notebook - fields = ['name', 'color_rgb'] + fields = ['owner', 'name', 'color_rgb'] + widgets = {'owner': forms.HiddenInput()} labels = { "name": _("Notebook Name"), + "color_rgb": _("Notebook Color"), + } + error_messages = { + NON_FIELD_ERRORS: { + 'unique_together': "You already have a notebook by that name, please choose a different name", + } } + + def __init__(self, *args, **kwargs): + user = kwargs.pop("user", None) + super(NotebookForm, self).__init__(*args, **kwargs) + self.fields['owner'].initial = user diff --git a/apps/notes/migrations/0002_auto_20181204_0620.py b/apps/notes/migrations/0002_auto_20181204_0620.py new file mode 100644 index 0000000..e7cb38d --- /dev/null +++ b/apps/notes/migrations/0002_auto_20181204_0620.py @@ -0,0 +1,42 @@ +# Generated by Django 2.1.2 on 2018-12-04 12:20 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('notes', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Tag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=40)), + ('slug', models.SlugField(blank=True)), + ('color_hex', models.CharField(max_length=6)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='parent_tag', to='notes.Tag')), + ], + ), + migrations.AlterModelOptions( + name='note', + options={'ordering': ('-date_created', '-date_updated')}, + ), + migrations.AddField( + model_name='note', + name='tagstwo', + field=models.ManyToManyField(blank=True, to='notes.Tag'), + ), + migrations.AlterUniqueTogether( + name='tag', + unique_together={('owner', 'name')}, + ), + ] diff --git a/apps/notes/migrations/0003_auto_20181204_0641.py b/apps/notes/migrations/0003_auto_20181204_0641.py new file mode 100644 index 0000000..9423058 --- /dev/null +++ b/apps/notes/migrations/0003_auto_20181204_0641.py @@ -0,0 +1,59 @@ +# Generated by Django 2.1.2 on 2018-12-04 12:41 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('contenttypes', '0002_remove_content_type_name'), + ('notes', '0002_auto_20181204_0620'), + ] + + operations = [ + migrations.CreateModel( + name='LuxTag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100, unique=True, verbose_name='Name')), + ('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')), + ('color_hex', models.CharField(max_length=6)), + ], + options={ + 'verbose_name': 'Tag', + 'verbose_name_plural': 'Tags', + }, + ), + migrations.CreateModel( + name='TaggedNotes', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('object_id', models.IntegerField(db_index=True, verbose_name='Object id')), + ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_taggednotes_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')), + ('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes_taggednotes_items', to='notes.LuxTag')), + ], + options={ + 'abstract': False, + }, + ), + migrations.AlterUniqueTogether( + name='tag', + unique_together=set(), + ), + migrations.RemoveField( + model_name='tag', + name='owner', + ), + migrations.RemoveField( + model_name='tag', + name='parent', + ), + migrations.RemoveField( + model_name='note', + name='tagstwo', + ), + migrations.DeleteModel( + name='Tag', + ), + ] diff --git a/apps/notes/migrations/0004_auto_20181204_0653.py b/apps/notes/migrations/0004_auto_20181204_0653.py new file mode 100644 index 0000000..fc6d911 --- /dev/null +++ b/apps/notes/migrations/0004_auto_20181204_0653.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.2 on 2018-12-04 12:53 + +from django.db import migrations +import taggit.managers + + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0003_auto_20181204_0641'), + ] + + operations = [ + migrations.AlterField( + model_name='note', + name='tags', + field=taggit.managers.TaggableManager(blank=True, help_text='Tags', through='notes.TaggedNotes', to='notes.LuxTag', verbose_name='Tags'), + ), + ] diff --git a/apps/notes/migrations/0005_luxtag_owner.py b/apps/notes/migrations/0005_luxtag_owner.py new file mode 100644 index 0000000..168bd0b --- /dev/null +++ b/apps/notes/migrations/0005_luxtag_owner.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2018-12-04 13:06 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('notes', '0004_auto_20181204_0653'), + ] + + operations = [ + migrations.AddField( + model_name='luxtag', + name='owner', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + preserve_default=False, + ), + ] diff --git a/apps/notes/migrations/0006_auto_20181204_0957.py b/apps/notes/migrations/0006_auto_20181204_0957.py new file mode 100644 index 0000000..bf4293c --- /dev/null +++ b/apps/notes/migrations/0006_auto_20181204_0957.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2018-12-04 15:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0005_luxtag_owner'), + ] + + operations = [ + migrations.RemoveField( + model_name='notebook', + name='url', + ), + migrations.AddField( + model_name='notebook', + name='color_hex', + field=models.CharField(blank=True, max_length=6, null=True), + ), + ] diff --git a/apps/notes/migrations/0007_auto_20181204_1050.py b/apps/notes/migrations/0007_auto_20181204_1050.py new file mode 100644 index 0000000..a4bdc30 --- /dev/null +++ b/apps/notes/migrations/0007_auto_20181204_1050.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2018-12-04 16:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0006_auto_20181204_0957'), + ] + + operations = [ + migrations.RemoveField( + model_name='notebook', + name='color_hex', + ), + migrations.AddField( + model_name='notebook', + name='color_rgb', + field=models.CharField(blank=True, max_length=20, null=True), + ), + ] diff --git a/apps/notes/migrations/0008_auto_20181204_1311.py b/apps/notes/migrations/0008_auto_20181204_1311.py new file mode 100644 index 0000000..02bf272 --- /dev/null +++ b/apps/notes/migrations/0008_auto_20181204_1311.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.2 on 2018-12-04 19:11 + +from django.conf import settings +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('notes', '0007_auto_20181204_1050'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='notebook', + unique_together={('owner', 'name')}, + ), + ] diff --git a/apps/notes/migrations/0009_remove_luxtag_owner.py b/apps/notes/migrations/0009_remove_luxtag_owner.py new file mode 100644 index 0000000..18896f3 --- /dev/null +++ b/apps/notes/migrations/0009_remove_luxtag_owner.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.2 on 2018-12-05 03:15 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0008_auto_20181204_1311'), + ] + + operations = [ + migrations.RemoveField( + model_name='luxtag', + name='owner', + ), + ] diff --git a/apps/notes/migrations/0010_auto_20181204_2117.py b/apps/notes/migrations/0010_auto_20181204_2117.py new file mode 100644 index 0000000..69da825 --- /dev/null +++ b/apps/notes/migrations/0010_auto_20181204_2117.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2018-12-05 03:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0009_remove_luxtag_owner'), + ] + + operations = [ + migrations.RemoveField( + model_name='luxtag', + name='color_hex', + ), + migrations.AddField( + model_name='luxtag', + name='color_rgb', + field=models.CharField(blank=True, max_length=20, null=True), + ), + ] diff --git a/apps/notes/migrations/0011_auto_20181221_1029.py b/apps/notes/migrations/0011_auto_20181221_1029.py new file mode 100644 index 0000000..7b88a62 --- /dev/null +++ b/apps/notes/migrations/0011_auto_20181221_1029.py @@ -0,0 +1,39 @@ +# Generated by Django 2.1.2 on 2018-12-21 16:29 + +from django.conf import settings +import django.contrib.postgres.fields.jsonb +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('notes', '0010_auto_20181204_2117'), + ] + + operations = [ + migrations.CreateModel( + name='Annotation', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('unique_id', models.UUIDField(default=uuid.uuid4, editable=False)), + ('date_created', models.DateTimeField(auto_now_add=True)), + ('date_updated', models.DateTimeField(auto_now=True)), + ('highlight_text', models.TextField(null=True)), + ('body_text', models.TextField(null=True)), + ('body_html', models.TextField(blank=True, null=True)), + ('body_qjson', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)), + ('is_public', models.BooleanField(default=False)), + ('note', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='notes.Note')), + ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.AddField( + model_name='luxtag', + name='owner', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/apps/notes/migrations/0012_auto_20181221_1038.py b/apps/notes/migrations/0012_auto_20181221_1038.py new file mode 100644 index 0000000..f02cbeb --- /dev/null +++ b/apps/notes/migrations/0012_auto_20181221_1038.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2018-12-21 16:38 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +from django.contrib import auth +User = auth.get_user_model() + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0011_auto_20181221_1029'), + ] + + operations = [ + migrations.AlterField( + model_name='luxtag', + name='owner', + field=models.ForeignKey(default=User.objects.get(username='luxagraf').id, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + preserve_default=False, + ), + ] diff --git a/apps/notes/migrations/0013_remove_luxtag_owner.py b/apps/notes/migrations/0013_remove_luxtag_owner.py new file mode 100644 index 0000000..a96b105 --- /dev/null +++ b/apps/notes/migrations/0013_remove_luxtag_owner.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1.2 on 2018-12-21 17:20 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('notes', '0012_auto_20181221_1038'), + ] + + operations = [ + migrations.RemoveField( + model_name='luxtag', + name='owner', + ), + ] diff --git a/apps/notes/models.py b/apps/notes/models.py index 95c1c96..9dc4f13 100644 --- a/apps/notes/models.py +++ b/apps/notes/models.py @@ -25,6 +25,10 @@ class LuxTag(TagBase): verbose_name = _("Tag") verbose_name_plural = _("Tags") + @cached_property + def get_absolute_url(self): + return reverse("notes:tags", kwargs={"slug": self.slug}) + class TaggedNotes(GenericTaggedItemBase): tag = models.ForeignKey(LuxTag, related_name="%(app_label)s_%(class)s_items", on_delete=models.CASCADE) @@ -55,6 +59,15 @@ class Notebook(models.Model): def get_absolute_url(self): return reverse("notebooks:detail", kwargs={"slug": self.slug}) + @cached_property + def color_rgba(self, opacity=".5"): + try: + color = self.color_rgb.split('(')[1].split(')')[0] + rgba = "rgba(%s,%s)" % (color, opacity) + except AttributeError: + rgba = self.color_rgb + return rgba + class Note(models.Model): unique_id = models.UUIDField(default=uuid.uuid4, editable=False) @@ -88,3 +101,19 @@ class Note(models.Model): if self._state.adding: self.slug = unique_slug_generator(self) super(Note, self).save() + + +class Annotation(models.Model): + unique_id = models.UUIDField(default=uuid.uuid4, editable=False) + owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False) + highlight_text = models.TextField(null=True) + body_text = models.TextField(null=True) + body_html = models.TextField(null=True, blank=True) + body_qjson = JSONField(null=True, blank=True) + note = models.ForeignKey(Note, null=True, blank=True, on_delete=models.SET_NULL) + is_public = models.BooleanField(default=False) + + def __str__(self): + return self.body_text[:30] diff --git a/apps/notes/notes_urls.py b/apps/notes/notes_urls.py index f2573ce..55fb32b 100644 --- a/apps/notes/notes_urls.py +++ b/apps/notes/notes_urls.py @@ -11,7 +11,7 @@ app_name = "notes" urlpatterns = [ path(r'create/', NoteCreateView.as_view(), name='create',), - path(r'<slug>/<pk>', NoteDetailView.as_view(), name='detail',), path(r't/<slug>', NoteTagView.as_view(), name='tags',), + path(r'<slug>/<pk>', NoteDetailView.as_view(), name='detail',), path(r'', NoteListView.as_view(), name='list',), ] diff --git a/apps/notes/serializers.py b/apps/notes/serializers.py index f811edd..6bb08de 100644 --- a/apps/notes/serializers.py +++ b/apps/notes/serializers.py @@ -27,7 +27,7 @@ class NoteSerializer(TaggitSerializer, serializers.ModelSerializer): class Meta: model = Note - fields = ('title', 'body_text', 'body_qjson', 'body_html', 'url', 'notebook', 'tags') + fields = ('id', 'title', 'body_text', 'body_qjson', 'body_html', 'url', 'notebook', 'tags') class NotebookSerializer(serializers.HyperlinkedModelSerializer): @@ -38,7 +38,7 @@ class NotebookSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Notebook - fields = ('name', 'color_rgb', 'json_absolute_url', 'owner') + fields = ('id', 'name', 'color_rgb', 'json_absolute_url', 'owner') class NoteTagSerializer(serializers.HyperlinkedModelSerializer): diff --git a/apps/notes/tests/test_models.py b/apps/notes/tests/test_models.py index 05f2618..0c53a25 100644 --- a/apps/notes/tests/test_models.py +++ b/apps/notes/tests/test_models.py @@ -3,7 +3,7 @@ from django.urls import reverse from django.contrib import auth from mixer.backend.django import mixer -from notes.models import Note, Notebook +from notes.models import Note, Notebook User = auth.get_user_model() diff --git a/apps/notes/views.py b/apps/notes/views.py index 5d55720..6751340 100644 --- a/apps/notes/views.py +++ b/apps/notes/views.py @@ -1,6 +1,11 @@ from django.views.generic import CreateView, ListView, UpdateView, DeleteView from django.views.generic.detail import DetailView -from django.views.generic.base import View, RedirectView +from django.views.generic.edit import FormView, ModelFormMixin +from django.http import JsonResponse +from django.core import serializers +from django.forms import modelformset_factory +from django.db.models import Count +from django.views.generic.base import RedirectView from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404, render, redirect @@ -14,10 +19,25 @@ from rest_framework import permissions from .serializers import NoteSerializer, NotebookSerializer, NoteTagSerializer from .models import Note, Notebook, LuxTag from .forms import NoteForm, NotebookForm +from utils.views import AjaxableResponseMixin + +################## +# Base Views +################## + + +@method_decorator(login_required, name='dispatch') +class BaseListView(ListView): + pass + + +@method_decorator(login_required, name='dispatch') +class BaseDetailView(DetailView): + pass @method_decorator(login_required, name='dispatch') -class LoggedInViewWithUser(View): +class LoggedInViewWithUser(FormView): def get_form_kwargs(self, **kwargs): kwargs = super().get_form_kwargs(**kwargs) @@ -25,12 +45,23 @@ class LoggedInViewWithUser(View): return kwargs -class NoteListView(LoggedInViewWithUser, ListView): +################## +# Note Views +################## + + +class NoteListView(BaseListView): model = Note def get_queryset(self): if not self.request.user.is_anonymous: - return Note.objects.filter(owner=self.request.user) + return Note.objects.prefetch_related('tags').filter(owner=self.request.user).select_related('notebook') + + def get_context_data(self, **kwargs): + context = super(NoteListView, self).get_context_data(**kwargs) + context['notebook_list'] = Notebook.objects.filter(owner=self.request.user).exclude(name="Trash").annotate(note_count=Count('note')) + context['tag_list'] = LuxTag.objects.filter(note__owner=self.request.user).annotate(note_count=Count('note')) + return context def get_template_names(self): # print("IP Address for debug-toolbar: " + self.request.META['REMOTE_ADDR']) @@ -40,36 +71,10 @@ class NoteListView(LoggedInViewWithUser, ListView): return ['sell.html'] -class NoteTagView(LoggedInViewWithUser, ListView): - model = Note - template_name = 'notes/notes_list.html' - - def get_queryset(self): - ''' - This can generate a crazy amount of joins if there's a lot of tags - have to keep an eye on it. Would be better to do: - from django.db.models import Q - from functools import reduce - from operator import and_, or_ - #query = reduce(and_, (Q(tags__slug=t) for t in self.tag_list)) - # Note.objects.filter(query, owner=self.request.user) - But that doesn't work for some reason. - ''' - if not self.request.user.is_anonymous: - self.tag_list = [x.strip() for x in self.kwargs['slug'].split("+")] - qs = Note.objects.filter(owner=self.request.user) - for tag in self.tag_list: - qs = qs.filter(tags__slug=tag) - return qs - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - context['notes_list'] = Note.objects.filter(owner=self.request.user) - context['tags'] = self.tag_list - return context - - -class NoteDetailView(UpdateView, LoggedInViewWithUser): +class NoteDetailView(LoggedInViewWithUser, AjaxableResponseMixin, UpdateView): + ''' + POST only works as AJAX + ''' model = Note form_class = NoteForm template_name = 'notes/notes_detail.html' @@ -80,11 +85,20 @@ class NoteDetailView(UpdateView, LoggedInViewWithUser): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['notes_list'] = Note.objects.filter(owner=self.request.user) + context['notebook_form'] = NotebookForm return context + def form_valid(self, form): + self.object = form.save() + tags = serializers.serialize("json", self.object.tags.all()) + data = { + 'tags': tags, + 'notebook': {'name': self.object.notebook.name, 'color': self.object.notebook.color_rgb} + } + return JsonResponse(data, safe=True) + -class NoteCreateView(CreateView, LoggedInViewWithUser): +class NoteCreateView(LoggedInViewWithUser, CreateView): model = Note form_class = NoteForm template_name = 'notes/notes_create.html' @@ -99,27 +113,76 @@ class NoteCreateView(CreateView, LoggedInViewWithUser): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['notes_list'] = Note.objects.filter(owner=self.request.user).select_related() + context['notebook_form'] = NotebookForm + # context['notes_list'] = Note.objects.filter(owner=self.request.user).select_related() + return context + + +class NoteTagView(BaseListView): + model = Note + template_name = 'notes/notes_list.html' + + def get_queryset(self): + ''' + This can generate a crazy amount of joins if there's a lot of tags + have to keep an eye on it. Would be better to do: + from django.db.models import Q + from functools import reduce + from operator import and_, or_ + #query = reduce(and_, (Q(tags__slug=t) for t in self.tag_list)) + # Note.objects.filter(query, owner=self.request.user) + But that doesn't work for some reason. + ''' + if not self.request.user.is_anonymous: + try: + tags = self.kwargs['slug'].split("+") + except ValueError: + tags = self.kwargs['slug'] + self.tag_list = [x.strip() for x in tags] + qs = Note.objects.prefetch_related('tags').filter(owner=self.request.user).select_related('notebook') + for tag in self.tag_list: + qs = qs.filter(tags__slug=tag) + return qs + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + #context['notes_list'] = Note.objects.filter(owner=self.request.user) + context['tags'] = LuxTag.objects.filter(slug__in=self.tag_list) return context -class NotebookListView(CreateView, LoggedInViewWithUser): +################## +# Notebook Views +################## + + +class NotebookListView(LoggedInViewWithUser, CreateView): model = Notebook form_class = NotebookForm - template_name = 'notes/notebook_create.html' + template_name = 'notes/notebook_list.html' def get_queryset(self): if not self.request.user.is_anonymous: return Notebook.objects.filter(owner=self.request.user) + def form_valid(self, form): + form.instance.owner = self.request.user + self.object = form.save() + return super(NotebookListView, self).form_valid(form) + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['notebook_list'] = Notebook.objects.filter(owner=self.request.user) - context['notes_list'] = Note.objects.filter(owner=self.request.user).select_related() + NotebookFormSet = modelformset_factory(Notebook, form=NotebookForm, extra=0) + context['notebook_form_list'] = NotebookFormSet(queryset=Notebook.objects.filter(owner=self.request.user).exclude(name="Trash").select_related().annotate(note_count=Count('note'))) + #context['notebook_list'] = Notebook.objects.filter(owner=self.request.user).exclude(name="Trash").select_related().annotate(note_count=Count('note')) + #context['notes_list'] = Note.objects.filter(owner=self.request.user).select_related() return context + def get_success_url(self): + return reverse_lazy('notebooks:detail', kwargs={'slug': self.object.slug}) + -class NotebookDetailView(DetailView, LoggedInViewWithUser): +class NotebookDetailView(BaseDetailView): model = Notebook def get_object(self): @@ -129,11 +192,16 @@ class NotebookDetailView(DetailView, LoggedInViewWithUser): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['notes_list'] = Note.objects.filter(owner=self.request.user).select_related() + #context['notes_list'] = Note.objects.filter(owner=self.request.user).select_related() context['form'] = self.form return context +################## +# API Views +################## + + class IsOwnerOrDeny(permissions.BasePermission): """ Custom permission to only allow owners to post to their endpoint diff --git a/apps/utils/views.py b/apps/utils/views.py index 595e102..ec3a902 100644 --- a/apps/utils/views.py +++ b/apps/utils/views.py @@ -1,6 +1,6 @@ from itertools import chain import json -from django.http import Http404, HttpResponse +from django.http import Http404, HttpResponse, JsonResponse from django.apps import apps from django.views.generic import ListView from django.views.generic.base import View, RedirectView @@ -42,6 +42,31 @@ class LoggedInViewWithUser(View): return kwargs + +class AjaxableResponseMixin: + """ + Mixin to add AJAX support to a form. + Must be used with an object-based FormView (e.g. CreateView) + """ + def form_invalid(self, form): + response = super().form_invalid(form) + if self.request.is_ajax(): + return JsonResponse(form.errors, status=400) + else: + return response + + def form_valid(self, form): + # We make sure to call the parent's form_valid() method because + # it might do some processing (in the case of CreateView, it will + # call form.save() for example). + response = super().form_valid(form) + if self.request.is_ajax(): + data = { + 'pk': self.object.pk, + } + return JsonResponse(data) + else: + return response ''' class TagAutocomplete(autocomplete.Select2QuerySetView): def get_queryset(self): diff --git a/apps/utils/widgets.py b/apps/utils/widgets.py index f4a7a4a..2745932 100644 --- a/apps/utils/widgets.py +++ b/apps/utils/widgets.py @@ -2,8 +2,9 @@ import os from django import forms from django.contrib import admin from django.contrib.admin.widgets import AdminFileWidget -from django.contrib.gis.admin import OSMGeoAdmin from django.utils.safestring import mark_safe +from django.forms import widgets +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.template.loader import render_to_string from django.template import Context @@ -130,15 +131,21 @@ class LGEntryFormSmall(forms.ModelForm): } -class OLAdminBase(OSMGeoAdmin): - default_lon = -9285175 - default_lat = 4025046 - default_zoom = 15 - units = True - scrollable = False - map_width = 700 - map_height = 425 - map_template = 'gis/admin/osm.html' - openlayers_url = '/static/admin/js/OpenLayers.js' - - +class RelatedFieldWidgetCanAdd(widgets.Select): + """ + Modifies standard django Select widget to add link after to add new instance + of related model (doesn't check permissions, that's for the form instance) + """ + def __init__(self, related_model, related_url=None, *args, **kw): + super(RelatedFieldWidgetCanAdd, self).__init__(*args, **kw) + if not related_url: + rel_to = related_model + info = (rel_to._meta.app_label, rel_to._meta.object_name.lower()) + related_url = 'admin:%s_%s_add' % info + self.related_url = related_url + + def render(self, name, value, *args, **kwargs): + self.related_url = reverse(self.related_url) + output = [super(RelatedFieldWidgetCanAdd, self).render(name, value, *args, **kwargs)] + output.append('<a class="circle plus small-circle modal-open" href="%s" id="add_id_%s" data-modal-hed-class="%s" data-modal-hed="Add a New %s">New</a>' % (self.related_url, name, name, name.capitalize())) + return mark_safe(u''.join(output)) diff --git a/config/base_urls.py b/config/base_urls.py index 775f07d..efbe233 100644 --- a/config/base_urls.py +++ b/config/base_urls.py @@ -45,7 +45,6 @@ urlpatterns += [ #path(r'<path>/<slug>/', PageDetailView.as_view(), name="pages"), path(r'api-auth/', include('rest_framework.urls', namespace='rest_framework')) ] -''' if settings.DEBUG: import debug_toolbar urlpatterns = [ @@ -55,4 +54,3 @@ if settings.DEBUG: # url(r'^__debug__/', include(debug_toolbar.urls)), ] + urlpatterns -''' diff --git a/config/settings.py b/config/settings.py index 8e2ba3c..c7bef91 100644 --- a/config/settings.py +++ b/config/settings.py @@ -65,7 +65,7 @@ THIRD_PARTY_APPS = [ 'taggit_serializer', 'django_extensions', 'rest_framework', - #'debug_toolbar' + 'debug_toolbar' ] LOCAL_APPS = [ 'utils', @@ -82,7 +82,7 @@ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', - #'debug_toolbar.middleware.DebugToolbarMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', diff --git a/design/sass/_forms.scss b/design/sass/_forms.scss index cce0e0f..d8a6a03 100644 --- a/design/sass/_forms.scss +++ b/design/sass/_forms.scss @@ -148,6 +148,10 @@ table { } .btn-inline { display: inline; + width: auto; +} +.note-save { + float: right; } .form-narrow { margin: 0 auto; @@ -171,7 +175,14 @@ select { background: white; border-radius: 4px; } -#id_tags { +.note-detail #id_tags { @include fontsize(13); padding: 8px; } +#fs-notebook{ + label { + top: -1.5rem; + left: .25rem; + } + margin: 3rem 0 1.5rem; +} diff --git a/design/sass/_global.scss b/design/sass/_global.scss index 9ef2e99..b858866 100644 --- a/design/sass/_global.scss +++ b/design/sass/_global.scss @@ -90,7 +90,7 @@ blockquote:before { @include fontsize(68); content: '\201C'; position: absolute; - top: -1rem; + top: -1.35rem; left: 50%; transform: translate(-50%, -50%); width: 3rem; @@ -152,7 +152,7 @@ h3 { } } .wrapper { - @include constrain(1440px); + @include constrain(1280px); //margin-top: 5rem; } //************** Universals ************************ @@ -189,6 +189,12 @@ h3 { .right-padding-0 { padding-right: 0 !important; } +.top-margin-0 { + margin-top: 0 !important; +} +.bottom-margin-0 { + margin-bottom: 0 !important; +} .center { text-align: center; margin-right: auto; @@ -201,9 +207,15 @@ h3 { .vertical li { display: block; } +.block { + display: block; +} +.inline-block { + display: inline-block; +} .single-col { display: block; - @include constrain_narrow; + @include constrain(66%); } .wide{ display: block; @@ -212,6 +224,12 @@ h3 { .small > * { @include fontsize(14); } +.hed-small { + @include fontsize(22); + @include fancy_sans; + margin-bottom: .5rem; + margin-top: 2rem; +} //************** other global classes ************************ .sans { @include generic_sans; diff --git a/design/sass/_modal.scss b/design/sass/_modal.scss index 57a7e51..dd21816 100644 --- a/design/sass/_modal.scss +++ b/design/sass/_modal.scss @@ -1,112 +1,103 @@ -/** - * Component: Overlay - */ -/* BACKDROP */ -.novi-backdrop { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 7000; - position: fixed; - overflow-x: hidden; - overflow-y: auto; - background: rgba(0, 0, 0, 0.75); - opacity: 0; - animation-name: fadeIn; - animation-duration: .4s; - animation-fill-mode: forwards; +#overlay{ + font-family:Lato; + position:fixed; + width:100vw; + height:100vh; + overflow:hidden; + top:0; + left:0; + right:0; + bottom:0; + animation:overlay .3s forwards ease; + background-color:rgba(0,0,0,.8); + transform:scale(1); + transform-origin:center center; + z-index: 2000; + display: block; + > div { + position:absolute; + top:50%; + left:50%; + transform:translate(-50%,-50%); + } + header{ + @include fancy_sans; + @include fontsize(18); + padding: 1rem 1rem 1rem 0; + margin-left: 0; + } } -/* OVERLAY */ -.novi-overlay { - text-align: center; - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; +.top { + z-index: 10000; } -.novi-overlay:before { - content: ''; - display: inline-block; - height: 10%; - vertical-align: middle; -} -.novi-overlay__container { - width: 100%; - position: relative; - display: inline-block; - vertical-align: middle; - margin: 0 auto; - text-align: left; - z-index: 8000; - padding: 0 15px; -} -.novi-overlay__content { - position: relative; - background: #FFF; - padding: 40px; - width: auto; - margin: 15px auto; - width: 100%; - max-width: 700px; - animation-name: fadeZoomIn; - animation-duration: .4s; - opacity: 0; - animation-fill-mode: forwards; - animation-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1); - border-radius: 8px; -} -.novi-overlay__content--video { - padding: 0; - height: 360px; -} -.novi-overlay__content--video .novi-overlay-close { - top: -25px; - right: 0; -} -/* CLOSE BUTTON */ -.novi-overlay-close { - padding: 0; - background: none; - position: absolute; - top: 15px; - right: 15px; - display: block; - width: 15px; - height: 15px; - z-index: 1; - border: 0; - background-size: 100%; - background-repeat: no-repeat; - background-position: 100% 0; - background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDIxLjkgMjEuOSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjEuOSAyMS45IiB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4Ij4KICA8cGF0aCBkPSJNMTQuMSwxMS4zYy0wLjItMC4yLTAuMi0wLjUsMC0wLjdsNy41LTcuNWMwLjItMC4yLDAuMy0wLjUsMC4zLTAuN3MtMC4xLTAuNS0wLjMtMC43bC0xLjQtMS40QzIwLDAuMSwxOS43LDAsMTkuNSwwICBjLTAuMywwLTAuNSwwLjEtMC43LDAuM2wtNy41LDcuNWMtMC4yLDAuMi0wLjUsMC4yLTAuNywwTDMuMSwwLjNDMi45LDAuMSwyLjYsMCwyLjQsMFMxLjksMC4xLDEuNywwLjNMMC4zLDEuN0MwLjEsMS45LDAsMi4yLDAsMi40ICBzMC4xLDAuNSwwLjMsMC43bDcuNSw3LjVjMC4yLDAuMiwwLjIsMC41LDAsMC43bC03LjUsNy41QzAuMSwxOSwwLDE5LjMsMCwxOS41czAuMSwwLjUsMC4zLDAuN2wxLjQsMS40YzAuMiwwLjIsMC41LDAuMywwLjcsMC4zICBzMC41LTAuMSwwLjctMC4zbDcuNS03LjVjMC4yLTAuMiwwLjUtMC4yLDAuNywwbDcuNSw3LjVjMC4yLDAuMiwwLjUsMC4zLDAuNywwLjNzMC41LTAuMSwwLjctMC4zbDEuNC0xLjRjMC4yLTAuMiwwLjMtMC41LDAuMy0wLjcgIHMtMC4xLTAuNS0wLjMtMC43TDE0LjEsMTEuM3oiIGZpbGw9IiMwMDAwMDAiLz4KPC9zdmc+Cg==); +@keyframes modal{ + from{ + -webkit-transform: scale(0.5); + -moz-transform: scale(0.5); + -ms-transform: scale(0.5); + transform: scale(0.5); + opacity: 0; + -webkit-transition: all 0.4s; + -moz-transition: all 0.4s; + transition: all 0.4s; + }; + to{ + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + transform: scale(1); + opacity: 1; + } } -.novi-overlay-close:hover, -.novi-overlay-close:focus, -.novi-overlay-close:active { - outline: none; - cursor: pointer; +@keyframes overlay{ + from{ + background-color:rgba(0,0,0,0); + }; + to{ + background-color:rgba(0,0,0,.8); + } } -/* HELPER CLASSES */ -.no-scroll { - overflow: hidden; +#overlay-wrapper { + max-width: 52%; + width: 90%; } -@keyframes fadeZoomIn { - from { - opacity: 0; - transform: scale(0.5) translateY(300px); - } - to { - opacity: 1; - transform: scale(1) translateY(0); - } +#modal { + min-height: 330px; + padding: 0 1rem 1rem 1rem; + background-color: white; + border-radius: 4px; + overflow:hidden; + animation:modal .2s forwards ease; + -webkit-box-shadow: 0px 2px 16px 2px rgba(0,0,0,0.5); + -moz-box-shadow: 0px 2px 16px 2px rgba(0,0,0,0.5); + box-shadow: 0px 2px 16px 2px rgba(0,0,0,0.5); + + + & > div { + color: #424242; + background-color: white; + } + // specific fixes for notebook create form + #nb-create-form { width: 99%;} + .flex-wrapper { + display: block; + margin-top: .5rem; + #color-picker { + margin-top: 3rem; + margin-left: .25rem; + } + .nb-name { width: 100%;} + } + input[type="submit"] { + float: right; + } + } -@keyframes fadeIn { - from { - opacity: 0; - } - to { - opacity: 1; - } +#hed-wrapper { + display: flex; + align-items: center; + justify-content: space-between; + & > * { + width: auto; + } } diff --git a/design/sass/_notes.scss b/design/sass/_notes.scss index cde15a5..4ab42b4 100644 --- a/design/sass/_notes.scss +++ b/design/sass/_notes.scss @@ -85,7 +85,7 @@ main { font-weight: normal; overflow: hidden; white-space: nowrap; - color: $body_font_color; + color: darken($body_font_color, 10); } .notebook { padding-right: 8px; @@ -176,18 +176,20 @@ main { input { width: 200%; } + a { margin-right: .25rem;} } } .notebook { display: block; } .note-container { - max-width: 60%; + max-width: 70%; position: relative; flex:1; order: 2; background: #fff; z-index: 4; + margin: 0 auto; } #note-body { @include fancy-sans; @@ -211,14 +213,16 @@ main { font-size:inherit; } } -#user-menu, #notebooks-menu { +#user-menu, #notebooks-menu, #notebook-drop-menu, #tags-drop-menu { display: none; } .active { display: block !important; } .notebook-colored { - border-left: 3px solid #fff; + -webkit-background-clip: padding-box; /* for Safari */ + background-clip: padding-box; /* for IE9+, Firefox 4+, Opera, Chrome */ + border-left: 3px solid rgba(255, 255, 255, .5); } .notebook-title { @include fontsize(24); @@ -249,6 +253,115 @@ main { cursor: pointer; } } +#nb-create-form { + .color-picker-fieldset { + width: 30px; + height: 30px; + label { + top: -25px; + width: 140px; + left: -5px; + } + } + .nb-name { + margin: 1rem 2rem 1rem 0; + width: 90%; +} +} +.small-circle { + width: 18px; + height: 18px; + margin-left: 6px; +} +.small-circle.plus:before { + width: 2px; + margin: 5px auto; +} +.small-circle.plus:after{ + margin: auto 5px; + width: 8px; +} + + +.url-field { + input { + @include fontsize(16); + color: $body_font_color; + } +} +.note-hed-wrapper { + margin-bottom: 1.5rem; +} +.note-hed { + @include fontsize(22); + margin-bottom: 0; +} +.note-subhed { + @include fontsize(16); + margin-top: 0; +} + +.nb-list { + display: flex; + flex-wrap: wrap; + align-items: center; + margin-top: 0; +} +.nb-list-item { + list-style-type: none; + padding: 2rem; + margin: 1rem; + flex-grow: 1; + border: 1px #e7e2ee solid; + border-radius: 4px; + min-width: 160px; +} +.color-picker-inner { + width: 100%; + height: 100%; +} + +.dropmenu-search { + margin: 0; + padding: 0; + .dropmenu-search-wrapper { + border-top: 1px solid #e9e9e9; + border-bottom: 1px solid #e9e9e9; + padding: 5px; + } + input { + @include fontsize(16); + padding: 4px; + width: auto; + border: none; + } + .dropmenu-list { + padding: 3px; + margin-top: 0; + max-height: 300px; + overflow-x: auto; + } + a { + display: block; + text-decoration: none; + padding: 4px 6px; + &:hover { + background: $link_color; + } + } +} + +.ql-snow .ql-editor blockquote { + border-left: none !important; + margin-bottom: 5px; + margin-top: 5px; + padding-left: none !important; + padding: 1rem .5rem; +} +.ql-container { + min-height: 300px; +} + /* Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com> diff --git a/design/sass/screenv1.scss b/design/sass/screenv1.scss index d54027e..f3df73e 100644 --- a/design/sass/screenv1.scss +++ b/design/sass/screenv1.scss @@ -1,10 +1,10 @@ @import "_fonts.scss"; @import "_mixins.scss"; @import "_queries.scss"; +@import "_awesomeplete.scss"; @import "_global.scss"; @import "_header.scss"; @import "_footer.scss"; @import "_forms.scss"; @import "_modal.scss"; -@import "_breadcrumbs.scss"; @import "_notes.scss"; diff --git a/design/templates/base.html b/design/templates/base.html index 50749cb..fc369ae 100644 --- a/design/templates/base.html +++ b/design/templates/base.html @@ -15,6 +15,7 @@ <link rel="icon" type="image/png" href=""> <!--<link rel="manifest" href="/webmanifest.json">--> <link rel="apple-touch-icon" sizes="256x256" href=""> + {% block jsinclude %}{%endblock%} <script async src="/media/js/main.min.js?{%now "u"%}"></script> </head> <body class="{% block bodyclass %}{% endblock %}"> @@ -22,7 +23,7 @@ <header> <nav class="left"> <ul>{% if not request.user.is_anonymous %} - <li><a class="circle plus" href="{%url 'notes:create' %}" title="Add a new note">New</a></li> + <li><a class="circle plus" href="{% url 'notes:create' %}" title="Add a new note">New</a></li> <li><a href="{%url 'notes:list' %}" title="View all your notes">Notes</a></li> <li><a id="notebook-menu-link" href="{%url 'notebooks:list' %}" title="view your notebooks">Notebooks</a> <div id="notebooks-menu" class="dropmenu"> @@ -41,7 +42,7 @@ <div class="logo"></div> <nav class="right {% if request.user.is_anonymous %}nologin{% endif %}"> <ul> - <li><a href="{% url 'forum:topic-list' %}" title="View the TKNote Forum">Forum</a></li> + <li><a href="{% url 'forum:topic-list' %}" title="View the TKNote Forum">Community</a></li> <li><a href="{% url 'pages' slug='tour' %}" title="">Tour</a></li> <li><a href="{% url 'pages' slug='howto' %}" title="">How to</a></li>{% if not request.user.is_anonymous %} <li><a id="account-menu" href="{% url 'settings' %}" title="">Account</a> @@ -91,7 +92,6 @@ </footer> {% block extra %} {%endblock%} -{% block jsinclude %}{%endblock%} <script> diff --git a/design/templates/notes/notebook_create.html b/design/templates/notes/notebook_create.html deleted file mode 100644 index 1386946..0000000 --- a/design/templates/notes/notebook_create.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends 'base.html' %} - -{% block extrastyles %} -<link rel="stylesheet" href="/media/quill.snow.css" /> -<script async src="/media/js/vanilla-picker.min.js"></script> -{% endblock %} -{% block content %} -<main> - <article class="note-container"> - <form id="new-notebook-form" action="{% url 'notebook-api-list' %}" method="post"> -{% csrf_token %} -{{ form.non_field_errors }} -{% for field in form %} -<fieldset class="{% if field.errors %}error {%endif%}{% if field.name == 'color_hex' %}hide {%endif%}" id="fs-{{field.name}}" > -{{field.label_tag}} -{{field}} -{% if field.errors %}{{field.errors}}{% endif %} -</fieldset> -{% endfor %} -<p id="color-picker"><a href="#">Pick color</a></p> -<p><input class="btn btn-inline" value="create" type="submit" /></p> -</form> - <ul>{% for object in notebook_list %} - <li> - <a href="{% url 'notebooks:detail' object.slug %}"><i class="icon-notebook"> </i>{{object.name}}</a> - </li> - {%endfor%}</ul> - </article> - <aside class="note-list-container"> - {% include "notes/partials/note_sidebar.html" with note_list=note_list %} - </aside> - <div class="balance-container"> - </div> -</main> -{% endblock %} - diff --git a/design/templates/notes/notebook_detail.html b/design/templates/notes/notebook_detail.html index a0b06a3..73c13ab 100644 --- a/design/templates/notes/notebook_detail.html +++ b/design/templates/notes/notebook_detail.html @@ -47,11 +47,11 @@ {% include "notes/partials/note_list.html" with object=object hidecolor=True hidenotebook=True %} {% endfor %}</ul> </article> - <aside class="note-list-container"> + {%comment%}<aside class="note-list-container"> {% include "notes/partials/note_sidebar.html" with note_list=note_list %} </aside> <div class="balance-container"> - </div> + </div>{%endcomment%} </main> {% endblock %} {% block jsdomready %} diff --git a/design/templates/notes/notebook_list.html b/design/templates/notes/notebook_list.html new file mode 100644 index 0000000..6f25f62 --- /dev/null +++ b/design/templates/notes/notebook_list.html @@ -0,0 +1,55 @@ +{% extends 'base.html' %} + +{% block extrastyles %} +<link rel="stylesheet" href="/media/quill.snow.css" /> +<script async src="/media/js/vanilla-picker.min.js"></script> +{% endblock %} +{% block content %} +<main> + <article class="note-container"> + <h2 class="hed-small top-margin-0">Add a Notebook</h2> + {% include 'notes/partials/notebook_form.html' with form=form %} + <h1 class="hed-small">Notebooks</h1> + + <ul class="nb-list">{% for form in notebook_form_list %} + <li class="nb-list-item"> + <form action="{% url 'notebook-api-detail' form.instance.id %}" method="PUT">{% for field in form %}{% if field.name == 'color_rgb' %} + <fieldset class="color-picker-fieldset" id="color-picker-{{forloop.parentloop.counter0}}" {% if form.instance.color_rgb %}style="background-color: {{form.instance.color_rgb}}; border: none;"{%endif%}> + <input type="text" name="color_rgb" value="{{form.instance.color_rgb}}" maxlength="20" id="id_color_rgb"> + {% if field.errors %}{{field.errors}}{% endif %} + </fieldset> + href="{% url 'notebooks:detail' form.instance.slug %}" + <h2>{{form.instance.name}}</h2> + {% else %} + <fieldset> + {% if field.field.widget.input_type != 'hidden' %}{{field.label_tag}}{% endif %} + {{field}} + {% if field.errors %}{{field.errors}}{% endif %} + </fieldset>{% endif %}{% endfor %} + <input id="i-{{forloop.counter0}}" type="submit" class="btn sm" value="Save" > + </form> + <div class="edit-btn-wrapper"><a class="btn btn-hollow btn-nb-edit" id="edit-toggle-btn-{{forloop.counter0}}">Edit</a></div> + <div class="edit-btn-wrapper"><a class="btn btn-hollow btn-nb-trash" id="trash-btn-{{forloop.counter0}}">Trash</a></div> + </li> + {%endfor%}</ul> + {% comment %} + <ul class="nb-list">{% for object in notebook_list %} + <li class="nb-list-item"> + <div class="color-picker-fieldset" id="color-picker-{{forloop.counter0}}" {% if object.color_rgb %}style="background-color: {{object.color_rgb}}; border: none;"{%endif%}> + </div> + <p><a href="{% url 'notebooks:detail' object.slug %}">{{object.name}}</a></p> + <p>{{object.note_count}} notes</p> + <div class="edit-btn-wrapper"><a class="btn btn-hollow btn-nb-edit" id="edit-toggle-btn">Edit</a></div> + <div class="edit-btn-wrapper"><a class="btn btn-hollow btn-nb-Trash" id="edit-toggle-btn">Trash</a></div> + </li> + {%endfor%}</ul> + {% endcomment %} + </article> + <!--<aside class="note-list-container"> + {% include "notes/partials/note_sidebar.html" with note_list=note_list %} + </aside> + <div class="balance-container"> + </div>--> +</main> +{% endblock %} + diff --git a/design/templates/notes/notes_create.html b/design/templates/notes/notes_create.html index 9ca4111..1b39632 100644 --- a/design/templates/notes/notes_create.html +++ b/design/templates/notes/notes_create.html @@ -22,10 +22,10 @@ </div> {% endif %} {% endfor %} -<p><input class="btn btn-inline" value="submit" type="submit" /></p> +<p><input class="btn btn-inline note-save" value="Save" type="submit" /></p> </form> </article> - <aside class="note-list-container"> + <!--<aside class="note-list-container"> <div class="svg-wrapper"><svg class="svg-icon-arrow"> <svg viewBox="0 0 16 13" id="shape-double-arrow" width="100%" height="100%"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"><g id="Showing-post-info" transform="translate(-297.000000, -105.000000)" stroke="currentColor"><g transform="translate(305.000000, 111.500000) scale(-1, 1) rotate(-180.000000) translate(-305.000000, -111.500000) translate(297.000000, 105.000000)"><path d="M2.20710678,6.5 L6.85355339,1.85355339 L7.20710678,1.5 L6.5,0.792893219 L6.14644661,1.14644661 L1.14644661,6.14644661 L1.05805826,6.23483496 L0.792893219,6.5 L1.14644661,6.85355339 L6.14644661,11.8535534 L6.5,12.2071068 L7.20710678,11.5 L6.85355339,11.1464466 L2.20710678,6.5 Z" id="Combined-Shape"></path><path d="M10.2071068,6.5 L14.8535534,1.85355339 L15.2071068,1.5 L14.5,0.792893219 L14.1464466,1.14644661 L9.14644661,6.14644661 L9.05805826,6.23483496 L8.79289322,6.5 L9.14644661,6.85355339 L14.1464466,11.8535534 L14.5,12.2071068 L15.2071068,11.5 L14.8535534,11.1464466 L10.2071068,6.5 Z" id="Combined-Shape"></path></g></g></g></svg> </svg></div> @@ -41,31 +41,21 @@ </div> </aside> <div class="balance-container"> - </div> + </div>--> </main> +<div class="overlay-content hide" id="js-overlay-notebook"> + {% include 'notes/partials/notebook_form.html' with form=notebook_form %} +</div> {% endblock %} {% block jsinclude %} -<script src="/media/js/highlight.pack.js"></script> -<script src="/media/js/quill.min.js"></script> +<script async src="/media/js/choices.min.js"></script> +<script async src="/media/js/vanilla-picker.min.js"></script> +<script async src="/media/js/highlight.pack.js"></script> +<script async src="/media/js/quill.min.js"></script> {% endblock %} <script> {% block jsdomready %} - var note_text = document.getElementById('id_body_text'); - note_text.innerHTML = "q"; - var plaintext = document.getElementById("fs-body_text"); - plaintext.classList.add('hide') - initQuill("#note-body"); - var form = document.getElementById('new-note-form'); - console.log(form); - form.onsubmit = function() { - var note_qjson = document.getElementById('id_body_qjson'); - note_qjson.innerHTML= JSON.stringify(window.quill.getContents()); - var note_html = document.getElementById('id_body_html'); - note_html.innerHTML = window.quill.root.innerHTML; - var note_text = document.getElementById('id_body_text'); - note_text.innerHTML = window.quill.getText(); - }; {% endblock %} </script> diff --git a/design/templates/notes/notes_detail.html b/design/templates/notes/notes_detail.html index b2ddbc3..26bff03 100644 --- a/design/templates/notes/notes_detail.html +++ b/design/templates/notes/notes_detail.html @@ -2,16 +2,18 @@ {% block extrastyles %} <link rel="stylesheet" href="/media/quill.snow.css" /> {% endblock %} +{% block bodyclass %}note-detail{% endblock %} {% block content %} <main> <article class="note-container"> <form action="" method="post" id="note-edit-form">{% csrf_token %} <header class="note-header"> <div class="note-header-left"> - <div class="flex-wrapper"> <div class="notebook"> - <a id="n-link" href="{% url 'notebooks:detail' object.slug %}"><span id="n-box" class="color-box" style="background-color: {{object.notebook.color_rgb}}"></span><span id="n-name">{{object.notebook}}</span></a> + {% if object.notebook %}<a id="n-link" href="{{object.notebook.get_absolute_url}}"><span id="n-box" class="color-box" style="background-color: {{object.notebook.color_rgb}}"></span><span id="n-name">{{object.notebook}}</span></a> + {%else %}<span id="n-link" href="{{object.notebook.get_absolute_url}}"><span id="n-box" class="color-box" style="background-color: {{object.notebook.color_rgb}}"></span><span id="n-name">{{object.notebook}}</span></span> + {%endif%} <div id="notebook-edit" class="hide"> <span class="error">{{ form.notebook.errors }}</span> {{form.notebook}} @@ -24,7 +26,7 @@ <span class="tag-wrapper" data-bg-color="#{{tag.color_color_rgb}};" >{{tag}}</span> </a>{%endfor%} </div> - <div id="tags-edit" class="hide"> + <div id="t-edit" class="hide"> <span class="error">{{ form.notebook.errors }}</span> {{form.tags}} </div> @@ -40,12 +42,16 @@ </div> </header> <div class="edit-btn-wrapper"><button class="hide btn btn-hollow" id="edit-toggle-btn">Edit</button></div> + <fieldset id="fs-url" class="url-field hide"> + {{form.url.label_tag}} + {{form.url}} + </fieldset> <h1 id="note-title" class="note-title">{{object.title}}</h1> <div id="q-container" class="inactive"><div id="note-body">{% if object.body_html %}{{object.body_html|safe}}{%else%}{{object.body_text}}{%endif%}</div></div> <input id="btn-js-hide" type="submit" class="btn sm" value="Save" > </form> </article> - <aside class="note-list-container"> + <!--<aside class="note-list-container"> <div class="svg-wrapper"><svg class="svg-icon-arrow"> <svg viewBox="0 0 16 13" id="shape-double-arrow" width="100%" height="100%"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"><g id="Showing-post-info" transform="translate(-297.000000, -105.000000)" stroke="currentColor"><g transform="translate(305.000000, 111.500000) scale(-1, 1) rotate(-180.000000) translate(-305.000000, -111.500000) translate(297.000000, 105.000000)"><path d="M2.20710678,6.5 L6.85355339,1.85355339 L7.20710678,1.5 L6.5,0.792893219 L6.14644661,1.14644661 L1.14644661,6.14644661 L1.05805826,6.23483496 L0.792893219,6.5 L1.14644661,6.85355339 L6.14644661,11.8535534 L6.5,12.2071068 L7.20710678,11.5 L6.85355339,11.1464466 L2.20710678,6.5 Z" id="Combined-Shape"></path><path d="M10.2071068,6.5 L14.8535534,1.85355339 L15.2071068,1.5 L14.5,0.792893219 L14.1464466,1.14644661 L9.14644661,6.14644661 L9.05805826,6.23483496 L8.79289322,6.5 L9.14644661,6.85355339 L14.1464466,11.8535534 L14.5,12.2071068 L15.2071068,11.5 L14.8535534,11.1464466 L10.2071068,6.5 Z" id="Combined-Shape"></path></g></g></g></svg> </svg></div> @@ -59,26 +65,18 @@ </li> {% endfor %}</ul> </div> - </aside> - <div class="balance-container"> - </div> + </aside>--> </main> +<div class="overlay-content hide" id="js-overlay-notebook"> + {% include 'notes/partials/notebook_form.html' with form=notebook_form %} +</div> {% endblock %} {% block jsinclude %} +<script async src="/media/js/vanilla-picker.min.js"></script> <script src="/media/js/highlight.pack.js"></script> <script src="/media/js/quill.min.js"></script> -<script> -document.addEventListener('readystatechange', event => { - if (event.target.readyState === "interactive") { - //initLoader(); - } - else if (event.target.readyState === "complete") { - initQuill("#note-body"); - } -}); -</script> {% endblock %} {% block jsdomready %} -window.url = "{% url 'notes-api-detail' object.pk %}"; + {%endblock%} diff --git a/design/templates/notes/notes_list.html b/design/templates/notes/notes_list.html index 393cf89..5ef067a 100644 --- a/design/templates/notes/notes_list.html +++ b/design/templates/notes/notes_list.html @@ -2,33 +2,65 @@ {% block content %} <main> - <article class="note-container"> - <h1>Notes {% if tags|length == 1%} tagged {% for tag in tags%}{{tag}}{%endfor%}{%endif%}</h1> - {% if tags|length >= 1%}<div>Tagged with: {% for tag in tags%}<a href="{{tag|slugify}}">{{tag}}</a>{%endfor%}</div>{%endif%} + <div class="note-container"> + <div class="note-hed-wrapper"> + <h1 class="note-hed">Notes</h1> + {% if tags|length >= 1%}<h2 class="note-subhed">Tagged with: {% for tag in tags%}<a href="{{tag.slug}}">{{tag.name}}</a>{%endfor%}</h2>{%endif%} + + <h6 class="bottom-margin-0 inline-block"><button id="notebook-drop-btn" class="btn btn-light btn-drop-menu">Notebooks</button></h6> + <div id="notebook-drop-menu" class="dropmenu dropmenu-search"> + <div class="dropmenu-search-wrapper"> + <input class="search" autocapitalize="off" autocorrect="off" type="text" autocomplete="off" tabindex="-1" spellcheck="false" placeholder="Search..." id="notebook-input" data-list="#notebook-list" > + <!--<svg class="fa d-icon d-icon-search svg-icon filter-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#search"></use></svg>--> + </div> + <ul class="list dropmenu-list list-style-none notebook-list" id="notebook-list">{% for object in notebook_list %} + <li ><a class="name" href="{{object.get_absolute_url}}">{{object.name}} - {{object.note_count}}</a></li> + {%endfor%}</ul> + </div> + + <h6 class="bottom-margin-0 inline-block"><button id="tags-drop-btn" class="btn btn-light btn-drop-menu">Tags</button></h6> + <div id="tags-drop-menu" class="dropmenu dropmenu-search"> + <div class="dropmenu-search-wrapper"> + <input class="search" autocapitalize="off" autocorrect="off" type="text" autocomplete="off" tabindex="-1" spellcheck="false" placeholder="Search..." id="tags-input" data-list="#tags-list" > + <!--<svg class="fa d-icon d-icon-search svg-icon filter-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#search"></use></svg>--> + </div> + <ul class="list dropmenu-list list-style-none notebook-list" id="tags-list">{% for object in tag_list %} + <li><a href="{{object.get_absolute_url}}">{{object.name}} - {{object.note_count}}</a></li> + {%endfor%}</ul> + </div> + </div> + {%comment%} <label for="choices-single-default">Default</label> +<select class="form-control" data-trigger name="choices-single-default" id="choices-single-default" placeholder="This is a search placeholder"> +<option placeholder>This is a placeholder</option> + {% for object in notebook_list %} + <option value="{{object.name}}" id="">{{object.name}}</option> + {% endfor %} +</select>{%endcomment%} + <ul class="list-note-preview">{% for object in object_list %} {% include "notes/partials/note_list.html" with object=object %} {% endfor %}</ul> - </article>{% if tags|length >= 1%} - <aside class="note-list-container"> + </div>{% if tags|length >= 1%} + {%comment%}<aside class="note-list-container"> <div class="svg-wrapper"><svg class="svg-icon-arrow"> <svg viewBox="0 0 16 13" id="shape-double-arrow" width="100%" height="100%"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="square"><g id="Showing-post-info" transform="translate(-297.000000, -105.000000)" stroke="currentColor"><g transform="translate(305.000000, 111.500000) scale(-1, 1) rotate(-180.000000) translate(-305.000000, -111.500000) translate(297.000000, 105.000000)"><path d="M2.20710678,6.5 L6.85355339,1.85355339 L7.20710678,1.5 L6.5,0.792893219 L6.14644661,1.14644661 L1.14644661,6.14644661 L1.05805826,6.23483496 L0.792893219,6.5 L1.14644661,6.85355339 L6.14644661,11.8535534 L6.5,12.2071068 L7.20710678,11.5 L6.85355339,11.1464466 L2.20710678,6.5 Z" id="Combined-Shape"></path><path d="M10.2071068,6.5 L14.8535534,1.85355339 L15.2071068,1.5 L14.5,0.792893219 L14.1464466,1.14644661 L9.14644661,6.14644661 L9.05805826,6.23483496 L8.79289322,6.5 L9.14644661,6.85355339 L14.1464466,11.8535534 L14.5,12.2071068 L15.2071068,11.5 L14.8535534,11.1464466 L10.2071068,6.5 Z" id="Combined-Shape"></path></g></g></g></svg> </svg></div> <div class=""> <ul class="list-note-preview">{% for obj in notes_list %} <li> - <a href="{% url 'notes:detail' obj.slug obj.pk %}"> + <a href="{{obj.get_absolute_url}}"> <h4>{{obj.title}}</h4> <div class="note-preview">{{obj.body_text|truncatewords:12}}</div> </a> </li> {% endfor %}</ul> </div> - </aside> + </aside>{%endcomment%} {%else%} - <div class="balance-container-left"> - </div> + <!--<div class="balance-container-left"> + </div>--> {%endif%} - <div class="balance-container"> - </div> + <!--<div class="balance-container"> + </div>--> </main> {% endblock %} diff --git a/design/templates/notes/notes_listold.html b/design/templates/notes/notes_listold.html deleted file mode 100644 index 8066369..0000000 --- a/design/templates/notes/notes_listold.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends 'base.html' %} -{% block content %} -<main> - <h1> Notes</h1> - <ul>{% for obj in object_list %} - <li><a href="{% url 'notes:note-detail' user.username obj.slug %}">{{obj}}</a></li> - {% endfor %}</ul> -</main> -{% endblock %} diff --git a/design/templates/notes/partials/note_list.html b/design/templates/notes/partials/note_list.html index 0c91b34..9ba4689 100644 --- a/design/templates/notes/partials/note_list.html +++ b/design/templates/notes/partials/note_list.html @@ -1,11 +1,11 @@ -<li {% if object.notebook and not hidecolor %}class="notebook-colored" style="border-left-color: {{object.notebook.color_rgb}};" {% endif %} > - <a href="{% url 'notes:detail' object.slug object.pk %}"> +<li {% if object.notebook and not hidecolor %}class="notebook-colored" style="border-left-color: {{object.notebook.color_rgba}};" {% endif %} > + <a href="{{object.get_absolute_url}}"> <h4>{{object.title}}</h4> <div class="note-preview">{{object.body_text|truncatewords:36}}</div> </a> <div class="flex-wrapper">{% if object.notebook and not hidenotebook %} <div class="notebook"> - <a href="{% url 'notebooks:detail' object.slug %}"><span class="color-box" style="background-color: {{object.notebook.color_rgb}}"></span>{{object.notebook}}</a> + <a href="{{object.notebook.get_absolute_url}}"><span class="color-box" style="background-color: {{object.notebook.color_rgb}}"></span>{{object.notebook}}</a> </div>{% endif %} <div class="tags">tags: {% for tag in object.tags.all %} <a href="{% url 'notes:tags' tag.slug %}"> diff --git a/design/templates/notes/partials/notebook_form.html b/design/templates/notes/partials/notebook_form.html new file mode 100644 index 0000000..fae6c40 --- /dev/null +++ b/design/templates/notes/partials/notebook_form.html @@ -0,0 +1,19 @@ +<form id="nb-create-form" action="{% url 'notebook-api-list' %}" method="POST">{% csrf_token %} + <div class="alert" id="non-field-errors">{{ form.non_field_errors }}</div> + <div class="flex-wrapper flex-inner"> + {% for field in form %}{% if field.name == 'color_rgb' %} + <fieldset class="fe-color-picker color-picker-fieldset block" id="color-picker" {% if form.instance.color_rgb %}style="background-color: {{form.instance.color_rgb}}; border: none;"{%endif%}> + {{field.label_tag}} + <input type="text" name="color_rgb" value="{{form.instance.color_rgb}}" maxlength="20" id="id_color_rgb"> + {% if field.errors %}{{field.errors}}{% endif %} + </fieldset>{% else %} + {%if field.name != 'owner' %}<fieldset class="nb-{{field.name}}"> + {{field.label_tag}} + {{field}} + {% if field.errors %}{{field.errors}}{% endif %} + </fieldset>{%else%}{{field}}{% endif %}{%endif%} + {% endfor %} + <h1 class="notebook-title" id="nb-title">{{object.name}}</h1> + </div> + <input id="notebook-form-submit" type="submit" class="btn sm" value="Save" > + </form> diff --git a/design/templates/pages/page.html b/design/templates/pages/page.html index 9eccaff..92dcc85 100644 --- a/design/templates/pages/page.html +++ b/design/templates/pages/page.html @@ -14,15 +14,4 @@ {% endif %} {%endblock%} {% block jsdomready %} -{% if login_form %} - // Select your overlay trigger - var trigger = document.querySelector('#overlay-trigger'); - trigger.addEventListener('click', function(e){ - e.preventDefault(); - novicell.overlay.create({ - 'selector': trigger.getAttribute('data-element'), - 'class': 'selector-overlay', - }); - }); -{% endif %} {%endblock%} diff --git a/scripts/package.json b/scripts/package.json index 890274e..1ec659e 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -4,14 +4,17 @@ "author": "luxagraf", "description": "Compile JS for Notes app", "main": "src/js/index.js", + "browserslist": "> 0.25%, not dead", "scripts": { "eslint": "eslint src/*.js --fix", "babel": "mkdir -p tmp && babel src/*.js -d tmp", "include": "cp src/lib/*.js tmp/", - "uglify:local": "mkdir -p ../media/js && uglifyjs tmp/*.js -m -c -o ../media/js/main.min.js", + "concat": "mkdir -p ../media/js && uglifyjs tmp/*.js -m -b -o tmp/main.js", + "browserify": "cd tmp && browserify main.js -o main.pack.js", + "uglify:local": "uglifyjs tmp/main.pack.js -m -o ../media/js/main.min.js", "uglify:deploy": "mkdir -p ../media/js && uglifyjs tmp/*.js -m -c drop_console=true -o ../media/js/main.min.js", "cleanup": "rm -rf tmp", - "build": "pnpm run babel && pnpm run include && pnpm run uglify:local && pnpm run cleanup", + "build": "pnpm run babel && pnpm run include && pnpm run concat && pnpm run browserify && pnpm run uglify:local && pnpm run cleanup", "deploy": "pnpm run babel && pnpm run include && pnpm run uglify && pnpm run cleanup", "watch": "watch 'pnpm run build' ." }, @@ -19,6 +22,16 @@ "@babel/cli": "^7.1.5", "@babel/core": "^7.1.6", "@babel/preset-env": "^7.1.6", + "@babel/standalone": "^7.2.5", + "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", + "babel-plugin-transform-runtime": "^6.23.0", + "babelify": "^10.0.0", + "browserify": "^16.2.3", + "core-js": "^2.6.1", "eslint": "^5.9.0" + }, + "dependencies": { + "babel-polyfill": "^6.26.0", + "babel-runtime": "^6.26.0" } } diff --git a/scripts/shrinkwrap.yaml b/scripts/shrinkwrap.yaml index 8907a9d..7cf56fd 100644 --- a/scripts/shrinkwrap.yaml +++ b/scripts/shrinkwrap.yaml @@ -1,7 +1,16 @@ +dependencies: + babel-polyfill: 6.26.0 + babel-runtime: 6.26.0 devDependencies: '@babel/cli': 7.1.5 '@babel/core': 7.1.6 '@babel/preset-env': 7.1.6 + '@babel/standalone': 7.2.5 + babel-plugin-transform-es2015-modules-commonjs: 6.26.2 + babel-plugin-transform-runtime: 6.23.0 + babelify: 10.0.0 + browserify: 16.2.3 + core-js: 2.6.1 eslint: 5.9.0 packages: /@babel/cli/7.1.5: @@ -592,6 +601,10 @@ packages: '@babel/core': ^7.0.0-0 resolution: integrity: sha512-YIBfpJNQMBkb6MCkjz/A9J76SNCSuGVamOVBgoUkLzpJD/z8ghHi9I42LQ4pulVX68N/MmImz6ZTixt7Azgexw== + /@babel/standalone/7.2.5: + dev: true + resolution: + integrity: sha512-U00wHmbh0eCUCAsCN1cz/WS2aB/UXjQrALsUmVIcugiK3HiI4PEh93PeGsaJttBmj0+Zfp1SpUNxPl6s8KPHUQ== /@babel/template/7.1.2: dependencies: '@babel/code-frame': 7.0.0 @@ -622,6 +635,23 @@ packages: dev: true resolution: integrity: sha512-DMiUzlY9DSjVsOylJssxLHSgj6tWM9PRFJOGW/RaOglVOK9nzTxoOMfTfRQXGUCUQ/HmlG2efwC+XqUEJ5ay4w== + /JSONStream/1.3.5: + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + dev: true + hasBin: true + resolution: + integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== + /acorn-dynamic-import/4.0.0/acorn@6.0.4: + dependencies: + acorn: 6.0.4 + dev: true + id: registry.npmjs.org/acorn-dynamic-import/4.0.0 + peerDependencies: + acorn: ^6.0.0 + resolution: + integrity: sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw== /acorn-jsx/5.0.1/acorn@6.0.4: dependencies: acorn: 6.0.4 @@ -631,6 +661,21 @@ packages: acorn: ^6.0.0 resolution: integrity: sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== + /acorn-node/1.6.2: + dependencies: + acorn: 6.0.4 + acorn-dynamic-import: /acorn-dynamic-import/4.0.0/acorn@6.0.4 + acorn-walk: 6.1.1 + xtend: 4.0.1 + dev: true + resolution: + integrity: sha512-rIhNEZuNI8ibQcL7ANm/mGyPukIaZsRNX9psFNQURyJW0nu6k8wjSDld20z6v2mDBWqX13pIEnk9gGZJHIlEXg== + /acorn-walk/6.1.1: + dev: true + engines: + node: '>=0.4.0' + resolution: + integrity: sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== /acorn/6.0.4: dev: true engines: @@ -653,6 +698,12 @@ packages: node: '>=4' resolution: integrity: sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw== + /ansi-regex/2.1.1: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-w7M6te42DYbg5ijwRorn7yfWVN8= /ansi-regex/3.0.0: dev: true engines: @@ -665,6 +716,12 @@ packages: node: '>=6' resolution: integrity: sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w== + /ansi-styles/2.2.1: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= /ansi-styles/3.2.1: dependencies: color-convert: 1.9.3 @@ -708,6 +765,18 @@ packages: optional: true resolution: integrity: sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + /array-filter/0.0.1: + dev: true + resolution: + integrity: sha1-fajPLiZijtcygDWB/SH2fKzS7uw= + /array-map/0.0.0: + dev: true + resolution: + integrity: sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= + /array-reduce/0.0.0: + dev: true + resolution: + integrity: sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= /array-unique/0.3.2: dev: true engines: @@ -715,6 +784,20 @@ packages: optional: true resolution: integrity: sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + /asn1.js/4.10.1: + dependencies: + bn.js: 4.11.8 + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + dev: true + resolution: + integrity: sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw== + /assert/1.4.1: + dependencies: + util: 0.10.3 + dev: true + resolution: + integrity: sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE= /assign-symbols/1.0.0: dev: true engines: @@ -741,6 +824,102 @@ packages: optional: true resolution: integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== + /babel-code-frame/6.26.0: + dependencies: + chalk: 1.1.3 + esutils: 2.0.2 + js-tokens: 3.0.2 + dev: true + resolution: + integrity: sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + /babel-messages/6.23.0: + dependencies: + babel-runtime: 6.26.0 + dev: true + resolution: + integrity: sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + /babel-plugin-transform-es2015-modules-commonjs/6.26.2: + dependencies: + babel-plugin-transform-strict-mode: 6.24.1 + babel-runtime: 6.26.0 + babel-template: 6.26.0 + babel-types: 6.26.0 + dev: true + resolution: + integrity: sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q== + /babel-plugin-transform-runtime/6.23.0: + dependencies: + babel-runtime: 6.26.0 + dev: true + resolution: + integrity: sha1-iEkNRGUC6puOfvsP4J7E2ZR5se4= + /babel-plugin-transform-strict-mode/6.24.1: + dependencies: + babel-runtime: 6.26.0 + babel-types: 6.26.0 + dev: true + resolution: + integrity: sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g= + /babel-polyfill/6.26.0: + dependencies: + babel-runtime: 6.26.0 + core-js: 2.6.1 + regenerator-runtime: 0.10.5 + dev: false + resolution: + integrity: sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= + /babel-runtime/6.26.0: + dependencies: + core-js: 2.6.1 + regenerator-runtime: 0.11.1 + resolution: + integrity: sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + /babel-template/6.26.0: + dependencies: + babel-runtime: 6.26.0 + babel-traverse: 6.26.0 + babel-types: 6.26.0 + babylon: 6.18.0 + lodash: 4.17.11 + dev: true + resolution: + integrity: sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= + /babel-traverse/6.26.0: + dependencies: + babel-code-frame: 6.26.0 + babel-messages: 6.23.0 + babel-runtime: 6.26.0 + babel-types: 6.26.0 + babylon: 6.18.0 + debug: 2.6.9 + globals: 9.18.0 + invariant: 2.2.4 + lodash: 4.17.11 + dev: true + resolution: + integrity: sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + /babel-types/6.26.0: + dependencies: + babel-runtime: 6.26.0 + esutils: 2.0.2 + lodash: 4.17.11 + to-fast-properties: 1.0.3 + dev: true + resolution: + integrity: sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + /babelify/10.0.0: + dev: true + engines: + node: '>=6.9.0' + peerDependencies: + '@babel/core': ^7.0.0 + resolution: + integrity: sha512-X40FaxyH7t3X+JFAKvb1H9wooWKLRCi8pg3m8poqtdZaIng+bjzp9RvKQCvRjF9isHiPkXspbbXT/zwXLtwgwg== + /babylon/6.18.0: + dev: true + hasBin: true + resolution: + integrity: sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== /balanced-match/1.0.0: dev: true resolution: @@ -760,6 +939,10 @@ packages: optional: true resolution: integrity: sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== + /base64-js/1.3.0: + dev: true + resolution: + integrity: sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw== /binary-extensions/1.12.0: dev: true engines: @@ -767,6 +950,10 @@ packages: optional: true resolution: integrity: sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg== + /bn.js/4.11.8: + dev: true + resolution: + integrity: sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== /brace-expansion/1.1.11: dependencies: balanced-match: 1.0.0 @@ -792,6 +979,137 @@ packages: optional: true resolution: integrity: sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== + /brorand/1.1.0: + dev: true + resolution: + integrity: sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + /browser-pack/6.1.0: + dependencies: + JSONStream: 1.3.5 + combine-source-map: 0.8.0 + defined: 1.0.0 + safe-buffer: 5.1.2 + through2: 2.0.5 + umd: 3.0.3 + dev: true + hasBin: true + resolution: + integrity: sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA== + /browser-resolve/1.11.3: + dependencies: + resolve: 1.1.7 + dev: true + resolution: + integrity: sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + /browserify-aes/1.2.0: + dependencies: + buffer-xor: 1.0.3 + cipher-base: 1.0.4 + create-hash: 1.2.0 + evp_bytestokey: 1.0.3 + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + /browserify-cipher/1.0.1: + dependencies: + browserify-aes: 1.2.0 + browserify-des: 1.0.2 + evp_bytestokey: 1.0.3 + dev: true + resolution: + integrity: sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== + /browserify-des/1.0.2: + dependencies: + cipher-base: 1.0.4 + des.js: 1.0.0 + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== + /browserify-rsa/4.0.1: + dependencies: + bn.js: 4.11.8 + randombytes: 2.0.6 + dev: true + resolution: + integrity: sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= + /browserify-sign/4.0.4: + dependencies: + bn.js: 4.11.8 + browserify-rsa: 4.0.1 + create-hash: 1.2.0 + create-hmac: 1.1.7 + elliptic: 6.4.1 + inherits: 2.0.3 + parse-asn1: 5.1.1 + dev: true + resolution: + integrity: sha1-qk62jl17ZYuqa/alfmMMvXqT0pg= + /browserify-zlib/0.2.0: + dependencies: + pako: 1.0.7 + dev: true + resolution: + integrity: sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== + /browserify/16.2.3: + dependencies: + JSONStream: 1.3.5 + assert: 1.4.1 + browser-pack: 6.1.0 + browser-resolve: 1.11.3 + browserify-zlib: 0.2.0 + buffer: 5.2.1 + cached-path-relative: 1.0.2 + concat-stream: 1.6.2 + console-browserify: 1.1.0 + constants-browserify: 1.0.0 + crypto-browserify: 3.12.0 + defined: 1.0.0 + deps-sort: 2.0.0 + domain-browser: 1.2.0 + duplexer2: 0.1.4 + events: 2.1.0 + glob: 7.1.3 + has: 1.0.3 + htmlescape: 1.1.1 + https-browserify: 1.0.0 + inherits: 2.0.3 + insert-module-globals: 7.2.0 + labeled-stream-splicer: 2.0.1 + mkdirp: 0.5.1 + module-deps: 6.2.0 + os-browserify: 0.3.0 + parents: 1.0.1 + path-browserify: 0.0.1 + process: 0.11.10 + punycode: 1.4.1 + querystring-es3: 0.2.1 + read-only-stream: 2.0.0 + readable-stream: 2.3.6 + resolve: 1.9.0 + shasum: 1.0.2 + shell-quote: 1.6.1 + stream-browserify: 2.0.1 + stream-http: 2.8.3 + string_decoder: 1.2.0 + subarg: 1.0.0 + syntax-error: 1.4.0 + through2: 2.0.5 + timers-browserify: 1.4.2 + tty-browserify: 0.0.1 + url: 0.11.0 + util: 0.10.4 + vm-browserify: 1.1.0 + xtend: 4.0.1 + dev: true + engines: + node: '>= 0.8' + hasBin: true + resolution: + integrity: sha512-zQt/Gd1+W+IY+h/xX2NYMW4orQWhqSwyV+xsblycTtpOuB27h1fZhhNQuipJ4t79ohw4P4mMem0jp/ZkISQtjQ== /browserslist/4.3.5: dependencies: caniuse-lite: 1.0.30000912 @@ -801,6 +1119,25 @@ packages: hasBin: true resolution: integrity: sha512-z9ZhGc3d9e/sJ9dIx5NFXkKoaiQTnrvrMsN3R1fGb1tkWWNSz12UewJn9TNxGo1l7J23h0MRaPmk7jfeTZYs1w== + /buffer-from/1.1.1: + dev: true + resolution: + integrity: sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + /buffer-xor/1.0.3: + dev: true + resolution: + integrity: sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + /buffer/5.2.1: + dependencies: + base64-js: 1.3.0 + ieee754: 1.1.12 + dev: true + resolution: + integrity: sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== + /builtin-status-codes/3.0.0: + dev: true + resolution: + integrity: sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= /cache-base/1.0.1: dependencies: collection-visit: 1.0.0 @@ -818,6 +1155,10 @@ packages: optional: true resolution: integrity: sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== + /cached-path-relative/1.0.2: + dev: true + resolution: + integrity: sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== /caller-path/0.1.0: dependencies: callsites: 0.2.0 @@ -836,6 +1177,18 @@ packages: dev: true resolution: integrity: sha512-M3zAtV36U+xw5mMROlTXpAHClmPAor6GPKAMD5Yi7glCB5sbMPFtnQ3rGpk4XqPdUrrTIaVYSJZxREZWNy8QJg== + /chalk/1.1.3: + dependencies: + ansi-styles: 2.2.1 + escape-string-regexp: 1.0.5 + has-ansi: 2.0.0 + strip-ansi: 3.0.1 + supports-color: 2.0.0 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= /chalk/2.4.1: dependencies: ansi-styles: 3.2.1 @@ -870,6 +1223,13 @@ packages: fsevents: 1.2.4 resolution: integrity: sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ== + /cipher-base/1.0.4: + dependencies: + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== /circular-json/0.3.3: deprecated: 'CircularJSON is in maintenance only, flatted is its successor.' dev: true @@ -919,6 +1279,15 @@ packages: dev: true resolution: integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + /combine-source-map/0.8.0: + dependencies: + convert-source-map: 1.1.3 + inline-source-map: 0.6.2 + lodash.memoize: 3.0.4 + source-map: 0.5.7 + dev: true + resolution: + integrity: sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos= /commander/2.19.0: dev: true resolution: @@ -932,6 +1301,31 @@ packages: dev: true resolution: integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + /concat-stream/1.6.2: + dependencies: + buffer-from: 1.1.1 + inherits: 2.0.3 + readable-stream: 2.3.6 + typedarray: 0.0.6 + dev: true + engines: + '0': node >= 0.8 + resolution: + integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + /console-browserify/1.1.0: + dependencies: + date-now: 0.1.4 + dev: true + resolution: + integrity: sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA= + /constants-browserify/1.0.0: + dev: true + resolution: + integrity: sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= + /convert-source-map/1.1.3: + dev: true + resolution: + integrity: sha1-SCnId+n+SbMWHzvzZziI4gRpmGA= /convert-source-map/1.6.0: dependencies: safe-buffer: 5.1.2 @@ -945,11 +1339,41 @@ packages: optional: true resolution: integrity: sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + /core-js/2.6.1: + resolution: + integrity: sha512-L72mmmEayPJBejKIWe2pYtGis5r0tQ5NaJekdhyXgeMQTpJoBsH0NL4ElY2LfSoV15xeQWKQ+XTTOZdyero5Xg== /core-util-is/1.0.2: dev: true - optional: true resolution: integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + /create-ecdh/4.0.3: + dependencies: + bn.js: 4.11.8 + elliptic: 6.4.1 + dev: true + resolution: + integrity: sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw== + /create-hash/1.2.0: + dependencies: + cipher-base: 1.0.4 + inherits: 2.0.3 + md5.js: 1.3.5 + ripemd160: 2.0.2 + sha.js: 2.4.11 + dev: true + resolution: + integrity: sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + /create-hmac/1.1.7: + dependencies: + cipher-base: 1.0.4 + create-hash: 1.2.0 + inherits: 2.0.3 + ripemd160: 2.0.2 + safe-buffer: 5.1.2 + sha.js: 2.4.11 + dev: true + resolution: + integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== /cross-spawn/6.0.5: dependencies: nice-try: 1.0.5 @@ -962,11 +1386,30 @@ packages: node: '>=4.8' resolution: integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + /crypto-browserify/3.12.0: + dependencies: + browserify-cipher: 1.0.1 + browserify-sign: 4.0.4 + create-ecdh: 4.0.3 + create-hash: 1.2.0 + create-hmac: 1.1.7 + diffie-hellman: 5.0.3 + inherits: 2.0.3 + pbkdf2: 3.0.17 + public-encrypt: 4.0.3 + randombytes: 2.0.6 + randomfill: 1.0.4 + dev: true + resolution: + integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== + /date-now/0.1.4: + dev: true + resolution: + integrity: sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= /debug/2.6.9: dependencies: ms: 2.0.0 dev: true - optional: true resolution: integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== /debug/4.1.0: @@ -1014,6 +1457,46 @@ packages: optional: true resolution: integrity: sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + /defined/1.0.0: + dev: true + resolution: + integrity: sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= + /deps-sort/2.0.0: + dependencies: + JSONStream: 1.3.5 + shasum: 1.0.2 + subarg: 1.0.0 + through2: 2.0.5 + dev: true + hasBin: true + resolution: + integrity: sha1-CRckkC6EZYJg65EHSMzNGvbiH7U= + /des.js/1.0.0: + dependencies: + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + dev: true + resolution: + integrity: sha1-wHTS4qpqipoH29YfmhXCzYPsjsw= + /detective/5.1.0: + dependencies: + acorn-node: 1.6.2 + defined: 1.0.0 + minimist: 1.2.0 + dev: true + engines: + node: '>=0.8.0' + hasBin: true + resolution: + integrity: sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ== + /diffie-hellman/5.0.3: + dependencies: + bn.js: 4.11.8 + miller-rabin: 4.0.1 + randombytes: 2.0.6 + dev: true + resolution: + integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== /doctrine/2.1.0: dependencies: esutils: 2.0.2 @@ -1022,10 +1505,35 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + /domain-browser/1.2.0: + dev: true + engines: + node: '>=0.4' + npm: '>=1.2' + resolution: + integrity: sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== + /duplexer2/0.1.4: + dependencies: + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= /electron-to-chromium/1.3.86: dev: true resolution: integrity: sha512-BcmXOu37FCPxrrh0wyKgKi5dAjIu2ohxN5ptapkLPKRC3IBK2NeIwh9n1x/8HzSRQiEKamJkDce1ZgOGgEX9iw== + /elliptic/6.4.1: + dependencies: + bn.js: 4.11.8 + brorand: 1.1.0 + hash.js: 1.1.7 + hmac-drbg: 1.0.1 + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + dev: true + resolution: + integrity: sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ== /escape-string-regexp/1.0.5: dev: true engines: @@ -1144,6 +1652,19 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= + /events/2.1.0: + dev: true + engines: + node: '>=0.4.x' + resolution: + integrity: sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== + /evp_bytestokey/1.0.3: + dependencies: + md5.js: 1.3.5 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== /expand-brackets/2.1.4: dependencies: debug: 2.6.9 @@ -1292,10 +1813,18 @@ packages: requiresBuild: true resolution: integrity: sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg== + /function-bind/1.1.1: + dev: true + resolution: + integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== /functional-red-black-tree/1.0.1: dev: true resolution: integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + /get-assigned-identifiers/1.2.0: + dev: true + resolution: + integrity: sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ== /get-value/2.0.6: dev: true engines: @@ -1328,10 +1857,24 @@ packages: node: '>=4' resolution: integrity: sha512-5cJVtyXWH8PiJPVLZzzoIizXx944O4OmRro5MWKx5fT4MgcN7OfaMutPeaTdJCCURwbWdhhcCWcKIffPnmTzBg== + /globals/9.18.0: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== /graceful-fs/4.1.15: dev: true resolution: integrity: sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== + /has-ansi/2.0.0: + dependencies: + ansi-regex: 2.1.1 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= /has-flag/3.0.0: dev: true engines: @@ -1377,6 +1920,48 @@ packages: optional: true resolution: integrity: sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + /has/1.0.3: + dependencies: + function-bind: 1.1.1 + dev: true + engines: + node: '>= 0.4.0' + resolution: + integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + /hash-base/3.0.4: + dependencies: + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha1-X8hoaEfs1zSZQDMZprCj8/auSRg= + /hash.js/1.1.7: + dependencies: + inherits: 2.0.3 + minimalistic-assert: 1.0.1 + dev: true + resolution: + integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + /hmac-drbg/1.0.1: + dependencies: + hash.js: 1.1.7 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + dev: true + resolution: + integrity: sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + /htmlescape/1.1.1: + dev: true + engines: + node: '>=0.10' + resolution: + integrity: sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E= + /https-browserify/1.0.0: + dev: true + resolution: + integrity: sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= /iconv-lite/0.4.24: dependencies: safer-buffer: 2.1.2 @@ -1385,6 +1970,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + /ieee754/1.1.12: + dev: true + resolution: + integrity: sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA== /ignore/4.0.6: dev: true engines: @@ -1404,10 +1993,20 @@ packages: dev: true resolution: integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + /inherits/2.0.1: + dev: true + resolution: + integrity: sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= /inherits/2.0.3: dev: true resolution: integrity: sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + /inline-source-map/0.6.2: + dependencies: + source-map: 0.5.7 + dev: true + resolution: + integrity: sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU= /inquirer/6.2.1: dependencies: ansi-escapes: 3.1.0 @@ -1428,6 +2027,22 @@ packages: node: '>=6.0.0' resolution: integrity: sha512-088kl3DRT2dLU5riVMKKr1DlImd6X7smDhpXUCkJDCKvTEJeRiXh0G132HG9u5a+6Ylw9plFRY7RuTnwohYSpg== + /insert-module-globals/7.2.0: + dependencies: + JSONStream: 1.3.5 + acorn-node: 1.6.2 + combine-source-map: 0.8.0 + concat-stream: 1.6.2 + is-buffer: 1.1.6 + path-is-absolute: 1.0.1 + process: 0.11.10 + through2: 2.0.5 + undeclared-identifiers: 1.1.2 + xtend: 4.0.1 + dev: true + hasBin: true + resolution: + integrity: sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw== /invariant/2.2.4: dependencies: loose-envify: 1.4.0 @@ -1463,7 +2078,6 @@ packages: integrity: sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= /is-buffer/1.1.6: dev: true - optional: true resolution: integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== /is-data-descriptor/0.1.4: @@ -1594,9 +2208,12 @@ packages: integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== /isarray/1.0.0: dev: true - optional: true resolution: integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + /isarray/2.0.4: + dev: true + resolution: + integrity: sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA== /isexe/2.0.0: dev: true resolution: @@ -1623,6 +2240,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-PxfGzSs0ztShKrUYPIn5r0MtyAhYcCwmndozzpz8YObbPnD1jFxzlBGbRnX2mIu6Z13xN6+PTu05TQFnZFlzow== + /js-tokens/3.0.2: + dev: true + resolution: + integrity: sha1-mGbfOVECEw449/mWvOtlRDIJwls= /js-tokens/4.0.0: dev: true resolution: @@ -1655,6 +2276,12 @@ packages: dev: true resolution: integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + /json-stable-stringify/0.0.1: + dependencies: + jsonify: 0.0.0 + dev: true + resolution: + integrity: sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= /json5/2.1.0: dependencies: minimist: 1.2.0 @@ -1664,6 +2291,16 @@ packages: hasBin: true resolution: integrity: sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + /jsonify/0.0.0: + dev: true + resolution: + integrity: sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + /jsonparse/1.3.1: + dev: true + engines: + '0': node >= 0.2.0 + resolution: + integrity: sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= /kind-of/3.2.2: dependencies: is-buffer: 1.1.6 @@ -1696,6 +2333,14 @@ packages: optional: true resolution: integrity: sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + /labeled-stream-splicer/2.0.1: + dependencies: + inherits: 2.0.3 + isarray: 2.0.4 + stream-splicer: 2.0.0 + dev: true + resolution: + integrity: sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg== /levn/0.3.0: dependencies: prelude-ls: 1.1.2 @@ -1710,6 +2355,10 @@ packages: optional: true resolution: integrity: sha1-gteb/zCmfEAF/9XiUVMArZyk168= + /lodash.memoize/3.0.4: + dev: true + resolution: + integrity: sha1-LcvSwofLwKVcxCMovQxzYVDVPj8= /lodash/4.17.11: dev: true resolution: @@ -1737,6 +2386,14 @@ packages: optional: true resolution: integrity: sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + /md5.js/1.3.5: + dependencies: + hash-base: 3.0.4 + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== /micromatch/3.1.10: dependencies: arr-diff: 4.0.0 @@ -1758,12 +2415,28 @@ packages: optional: true resolution: integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== + /miller-rabin/4.0.1: + dependencies: + bn.js: 4.11.8 + brorand: 1.1.0 + dev: true + hasBin: true + resolution: + integrity: sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== /mimic-fn/1.2.0: dev: true engines: node: '>=4' resolution: integrity: sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== + /minimalistic-assert/1.0.1: + dev: true + resolution: + integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + /minimalistic-crypto-utils/1.0.1: + dev: true + resolution: + integrity: sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= /minimatch/3.0.4: dependencies: brace-expansion: 1.1.11 @@ -1795,9 +2468,31 @@ packages: hasBin: true resolution: integrity: sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + /module-deps/6.2.0: + dependencies: + JSONStream: 1.3.5 + browser-resolve: 1.11.3 + cached-path-relative: 1.0.2 + concat-stream: 1.6.2 + defined: 1.0.0 + detective: 5.1.0 + duplexer2: 0.1.4 + inherits: 2.0.3 + parents: 1.0.1 + readable-stream: 2.3.6 + resolve: 1.9.0 + stream-combiner2: 1.1.1 + subarg: 1.0.0 + through2: 2.0.5 + xtend: 4.0.1 + dev: true + engines: + node: '>= 0.8.0' + hasBin: true + resolution: + integrity: sha512-hKPmO06so6bL/ZvqVNVqdTVO8UAYsi3tQWlCa+z9KuWhoN4KDQtb5hcqQQv58qYiDE21wIvnttZEPiDgEbpwbA== /ms/2.0.0: dev: true - optional: true resolution: integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= /ms/2.1.1: @@ -1917,6 +2612,10 @@ packages: node: '>= 0.8.0' resolution: integrity: sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= + /os-browserify/0.3.0: + dev: true + resolution: + integrity: sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= /os-tmpdir/1.0.2: dev: true engines: @@ -1931,6 +2630,26 @@ packages: dev: true resolution: integrity: sha512-mDho4qm7WgIXIGf4eYU1RHN2UU5tPfVYVSRwDJw0uTmj35DQUt/eNp19N7v6T3SrR0ESTEf2up2CGO73qI35zQ== + /pako/1.0.7: + dev: true + resolution: + integrity: sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ== + /parents/1.0.1: + dependencies: + path-platform: 0.11.15 + dev: true + resolution: + integrity: sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E= + /parse-asn1/5.1.1: + dependencies: + asn1.js: 4.10.1 + browserify-aes: 1.2.0 + create-hash: 1.2.0 + evp_bytestokey: 1.0.3 + pbkdf2: 3.0.17 + dev: true + resolution: + integrity: sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw== /pascalcase/0.1.1: dev: true engines: @@ -1938,6 +2657,10 @@ packages: optional: true resolution: integrity: sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + /path-browserify/0.0.1: + dev: true + resolution: + integrity: sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== /path-dirname/1.0.2: dev: true optional: true @@ -1963,6 +2686,24 @@ packages: dev: true resolution: integrity: sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + /path-platform/0.11.15: + dev: true + engines: + node: '>= 0.8.0' + resolution: + integrity: sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I= + /pbkdf2/3.0.17: + dependencies: + create-hash: 1.2.0 + create-hmac: 1.1.7 + ripemd160: 2.0.2 + safe-buffer: 5.1.2 + sha.js: 2.4.11 + dev: true + engines: + node: '>=0.12' + resolution: + integrity: sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA== /pluralize/7.0.0: dev: true engines: @@ -1990,21 +2731,76 @@ packages: integrity: sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== /process-nextick-args/2.0.0: dev: true - optional: true resolution: integrity: sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== + /process/0.11.10: + dev: true + engines: + node: '>= 0.6.0' + resolution: + integrity: sha1-czIwDoQBYb2j5podHZGn1LwW8YI= /progress/2.0.1: dev: true engines: node: '>=0.4.0' resolution: integrity: sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg== + /public-encrypt/4.0.3: + dependencies: + bn.js: 4.11.8 + browserify-rsa: 4.0.1 + create-hash: 1.2.0 + parse-asn1: 5.1.1 + randombytes: 2.0.6 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== + /punycode/1.3.2: + dev: true + resolution: + integrity: sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= + /punycode/1.4.1: + dev: true + resolution: + integrity: sha1-wNWmOycYgArY4esPpSachN1BhF4= /punycode/2.1.1: dev: true engines: node: '>=6' resolution: integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + /querystring-es3/0.2.1: + dev: true + engines: + node: '>=0.4.x' + resolution: + integrity: sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= + /querystring/0.2.0: + dev: true + engines: + node: '>=0.4.x' + resolution: + integrity: sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= + /randombytes/2.0.6: + dependencies: + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A== + /randomfill/1.0.4: + dependencies: + randombytes: 2.0.6 + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== + /read-only-stream/2.0.0: + dependencies: + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A= /readable-stream/2.3.6: dependencies: core-util-is: 1.0.2 @@ -2015,7 +2811,6 @@ packages: string_decoder: 1.1.1 util-deprecate: 1.0.2 dev: true - optional: true resolution: integrity: sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== /readdirp/2.2.1: @@ -2041,6 +2836,13 @@ packages: dev: true resolution: integrity: sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== + /regenerator-runtime/0.10.5: + dev: false + resolution: + integrity: sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= + /regenerator-runtime/0.11.1: + resolution: + integrity: sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== /regenerator-transform/0.13.3: dependencies: private: 0.1.8 @@ -2126,12 +2928,22 @@ packages: optional: true resolution: integrity: sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + /resolve/1.1.7: + dev: true + resolution: + integrity: sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= /resolve/1.8.1: dependencies: path-parse: 1.0.6 dev: true resolution: integrity: sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== + /resolve/1.9.0: + dependencies: + path-parse: 1.0.6 + dev: true + resolution: + integrity: sha512-TZNye00tI67lwYvzxCxHGjwTNlUV70io54/Ed4j6PscB8xVfuBJpRenI/o6dVk0cY0PYTY27AgCoGGxRnYuItQ== /restore-cursor/2.0.0: dependencies: onetime: 2.0.1 @@ -2155,6 +2967,13 @@ packages: hasBin: true resolution: integrity: sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w== + /ripemd160/2.0.2: + dependencies: + hash-base: 3.0.4 + inherits: 2.0.3 + dev: true + resolution: + integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== /run-async/2.3.0: dependencies: is-promise: 2.1.0 @@ -2215,6 +3034,21 @@ packages: optional: true resolution: integrity: sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg== + /sha.js/2.4.11: + dependencies: + inherits: 2.0.3 + safe-buffer: 5.1.2 + dev: true + hasBin: true + resolution: + integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + /shasum/1.0.2: + dependencies: + json-stable-stringify: 0.0.1 + sha.js: 2.4.11 + dev: true + resolution: + integrity: sha1-5wEjENj0F/TetXEhUOVni4euVl8= /shebang-command/1.2.0: dependencies: shebang-regex: 1.0.0 @@ -2229,10 +3063,23 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + /shell-quote/1.6.1: + dependencies: + array-filter: 0.0.1 + array-map: 0.0.0 + array-reduce: 0.0.0 + jsonify: 0.0.0 + dev: true + resolution: + integrity: sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c= /signal-exit/3.0.2: dev: true resolution: integrity: sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + /simple-concat/1.0.0: + dev: true + resolution: + integrity: sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY= /slash/2.0.0: dev: true engines: @@ -2330,6 +3177,37 @@ packages: optional: true resolution: integrity: sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + /stream-browserify/2.0.1: + dependencies: + inherits: 2.0.3 + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds= + /stream-combiner2/1.1.1: + dependencies: + duplexer2: 0.1.4 + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-+02KFCDqNidk4hrUeAOXvry0HL4= + /stream-http/2.8.3: + dependencies: + builtin-status-codes: 3.0.0 + inherits: 2.0.3 + readable-stream: 2.3.6 + to-arraybuffer: 1.0.1 + xtend: 4.0.1 + dev: true + resolution: + integrity: sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw== + /stream-splicer/2.0.0: + dependencies: + inherits: 2.0.3 + readable-stream: 2.3.6 + dev: true + resolution: + integrity: sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM= /string-width/2.1.1: dependencies: is-fullwidth-code-point: 2.0.0 @@ -2343,9 +3221,22 @@ packages: dependencies: safe-buffer: 5.1.2 dev: true - optional: true resolution: integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + /string_decoder/1.2.0: + dependencies: + safe-buffer: 5.1.2 + dev: true + resolution: + integrity: sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w== + /strip-ansi/3.0.1: + dependencies: + ansi-regex: 2.1.1 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= /strip-ansi/4.0.0: dependencies: ansi-regex: 3.0.0 @@ -2368,6 +3259,18 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-PFMZQukIwml8DsNEhYwobHygpgo= + /subarg/1.0.0: + dependencies: + minimist: 1.2.0 + dev: true + resolution: + integrity: sha1-9izxdYHplrSPyWVpn1TAauJouNI= + /supports-color/2.0.0: + dev: true + engines: + node: '>=0.8.0' + resolution: + integrity: sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= /supports-color/5.5.0: dependencies: has-flag: 3.0.0 @@ -2376,6 +3279,12 @@ packages: node: '>=4' resolution: integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + /syntax-error/1.4.0: + dependencies: + acorn-node: 1.6.2 + dev: true + resolution: + integrity: sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w== /table/5.1.1: dependencies: ajv: 6.6.1 @@ -2395,6 +3304,21 @@ packages: dev: true resolution: integrity: sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + /through2/2.0.5: + dependencies: + readable-stream: 2.3.6 + xtend: 4.0.1 + dev: true + resolution: + integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== + /timers-browserify/1.4.2: + dependencies: + process: 0.11.10 + dev: true + engines: + node: '>=0.6.0' + resolution: + integrity: sha1-ycWLV1voQHN1y14kYtrO50NZ9B0= /tmp/0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -2403,6 +3327,16 @@ packages: node: '>=0.6.0' resolution: integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + /to-arraybuffer/1.0.1: + dev: true + resolution: + integrity: sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= + /to-fast-properties/1.0.3: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= /to-fast-properties/2.0.0: dev: true engines: @@ -2450,6 +3384,10 @@ packages: dev: true resolution: integrity: sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== + /tty-browserify/0.0.1: + dev: true + resolution: + integrity: sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== /type-check/0.3.2: dependencies: prelude-ls: 1.1.2 @@ -2458,6 +3396,25 @@ packages: node: '>= 0.8.0' resolution: integrity: sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + /typedarray/0.0.6: + dev: true + resolution: + integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + /umd/3.0.3: + dev: true + hasBin: true + resolution: + integrity: sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== + /undeclared-identifiers/1.1.2: + dependencies: + acorn-node: 1.6.2 + get-assigned-identifiers: 1.2.0 + simple-concat: 1.0.0 + xtend: 4.0.1 + dev: true + hasBin: true + resolution: + integrity: sha512-13EaeocO4edF/3JKime9rD7oB6QI8llAGhgn5fKOPyfkJbRb6NFv9pYV6dFEmpa4uRjKeBqLZP8GpuzqHlKDMQ== /unicode-canonical-property-names-ecmascript/1.0.4: dev: true engines: @@ -2525,6 +3482,13 @@ packages: optional: true resolution: integrity: sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + /url/0.11.0: + dependencies: + punycode: 1.3.2 + querystring: 0.2.0 + dev: true + resolution: + integrity: sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= /use/3.1.1: dev: true engines: @@ -2534,9 +3498,24 @@ packages: integrity: sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== /util-deprecate/1.0.2: dev: true - optional: true resolution: integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + /util/0.10.3: + dependencies: + inherits: 2.0.1 + dev: true + resolution: + integrity: sha1-evsa/lCAUkZInj23/g7TeTNqwPk= + /util/0.10.4: + dependencies: + inherits: 2.0.3 + dev: true + resolution: + integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== + /vm-browserify/1.1.0: + dev: true + resolution: + integrity: sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw== /which/1.3.1: dependencies: isexe: 2.0.0 @@ -2560,6 +3539,12 @@ packages: node: '>=0.10.0' resolution: integrity: sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= + /xtend/4.0.1: + dev: true + engines: + node: '>=0.4' + resolution: + integrity: sha1-pcbVMr5lbiPbgg77lDofBJmNY68= registry: 'https://registry.npmjs.org/' shrinkwrapMinorVersion: 9 shrinkwrapVersion: 3 @@ -2567,4 +3552,12 @@ specifiers: '@babel/cli': ^7.1.5 '@babel/core': ^7.1.6 '@babel/preset-env': ^7.1.6 + '@babel/standalone': ^7.2.5 + babel-plugin-transform-es2015-modules-commonjs: ^6.26.2 + babel-plugin-transform-runtime: ^6.23.0 + babel-polyfill: ^6.26.0 + babel-runtime: ^6.26.0 + babelify: ^10.0.0 + browserify: ^16.2.3 + core-js: ^2.6.1 eslint: ^5.9.0 diff --git a/scripts/src/color-picker.js b/scripts/src/color-picker.js deleted file mode 100644 index e69de29..0000000 --- a/scripts/src/color-picker.js +++ /dev/null diff --git a/scripts/src/lib/overlay.js b/scripts/src/lib/overlay.js deleted file mode 100644 index b40d911..0000000 --- a/scripts/src/lib/overlay.js +++ /dev/null @@ -1,253 +0,0 @@ -'use strict'; -/** - * @name Novicell overlay - * @desc Simple script that opens an overlay / modal with some content form either a selector or an URL - * @author Danni Larsen (DLA), Michael Sølvsteen (MSL), Signe Helbo Poulsen (SHP), Emil Skytte Ankersen (EAN) - * @example novicell.overlay.create({ 'selector': SELECTOR, 'url': URL, 'class':'CLASSNAME', 'onCreate': FUNCTIONNAME, 'onLoaded': FUNCTIONNAME, 'onDestroy': FUNCTIONNAME }); - * @requires none - */ - -var novicell = novicell || {}; - -novicell.overlay = novicell.overlay || new function () { - var self = this; - var options = {}; - var overlayElem; - var overlayContainer; - var overlayContent; - var backdrop; - var content; - var onCreate; - var onLoaded; - var onDestroy; - var isVideo = false; - - this.create = function (opts) { - var self = this; - // Set global options - options = opts; - - // Call onCreate callback - if (typeof options.onCreate === 'function') { - options.onCreate(); - } - - // Remove existing overlays - self.destroy(); - - // Check if content comes from a DOM selector - if (options.hasOwnProperty('selector') && options.selector !== null) { - var element = document.querySelector(options.selector); - - if (element) { - content = element.innerHTML; - constructOverlay(); - } else { - console.warn('novicell.overlay: element does not exist. Please provide a valid selector for use in document.querySelector.'); - return; - } - } - - // Check if content comes from a HTML element - else if (options.hasOwnProperty('element') && options.element !== null) { - var element = options.element; - - if (element) { - content = element.innerHTML; - constructOverlay(); - } else { - console.warn('novicell.overlay: element does not exist. Please provide a valid DOM element.'); - return; - } - } - - // Or if content comes from an ID - else if (options.hasOwnProperty('videoId')) { - if (options.videoId !== null) { - var src = ''; - isVideo = true; - - if(options.type == 'vimeo') { - src = 'https://player.vimeo.com/video/' + options.videoId + '?autoplay=' + options.autoplay; - } - else if(options.type == 'youtube') { - src = 'https://www.youtube.com/embed/' + options.videoId + '?autoplay=' + options.autoplay + '&rel=0'; - } - else { - return; - } - - var iframe = document.createElement('iframe'); - iframe.setAttribute('src', src); - iframe.setAttribute('frameborder', 0); - iframe.setAttribute('allowfullscreen', ''); - iframe.setAttribute('width', '100%'); - iframe.setAttribute('height', '100%'); - - content = iframe.outerHTML; - - constructOverlay(); - } else { - console.warn('novicell.overlay: video-id is empty. Please provide a video-id for use in video embed code (we support only Vimeo and YouTube).'); - return; - } - } - // If nothing is working, send error to los consolé - else { - console.error('novicell.overlay: no content to display! Please set a selector or a url to load.') - return; - } - }; - - this.destroy = function () { - if(document.querySelector('#js-novi-overlay')) { - // Remove elements - overlayElem.parentElement.removeChild(overlayElem); - backdrop.parentElement.removeChild(backdrop); - - // Stop listening for close overlay events - document.removeEventListener('keyup', self.destroy); - - // Remove class on body - document.documentElement.classList.remove('no-scroll', 'novi-overlay--open'); - - // Reset video variable - isVideo = false; - - // Call onDestroy callback - if (typeof options.onDestroy === 'function') { - options.onDestroy(); - } - } - }; - - function constructOverlay() { - // Create backdrop - setupBackdrop(); - - // Create the overlay - setupOverlay(); - - // Create content for overlay - setupOverlayContainer(); - - // Create close button - setupCloseButton(); - - // Add class to body-element - document.documentElement.classList.add('no-scroll'); - - // Call onLoaded callback - if (typeof options.onLoaded === 'function') { - options.onLoaded(); - } - }; - - function setupBackdrop() { - // Create the backdrop - backdrop = document.createElement('div'); - backdrop.classList.add('novi-backdrop'); - backdrop.id = 'js-novi-backdrop'; - - backdrop.addEventListener('click', function(e){ - if(e.target.classList.contains('novi-overlay') || e.target.classList.contains('novi-overlay__container')) { - self.destroy(); - } - }); - - // Add backdrop to overlay element - document.querySelector('body').appendChild(backdrop); - }; - - /* - * Helper functions for HTML elements - */ - function setupOverlay() { - // Create the overlay - overlayElem = document.createElement('div'); - overlayElem.classList.add('novi-overlay'); - overlayElem.id = 'js-novi-overlay'; - - // Set class for the overlay, if set in options - if (options.hasOwnProperty('class')) { - overlayElem.classList.add(options.class); - } - - // Add overlay to overlay element - // document.querySelector('body').appendChild(overlayElem); - backdrop.appendChild(overlayElem); - }; - - function setupOverlayContainer() { - // Create content for overlay - overlayContainer = document.createElement('div'); - overlayContainer.classList.add('novi-overlay__container'); - - // Create scroll element - overlayContent = document.createElement('div'); - overlayContent.classList.add('novi-overlay__content'); - - if(isVideo) { - overlayContent.classList.add('novi-overlay__content--video') - } - - // Set content - overlayContent.innerHTML = content; - overlayContainer.appendChild(overlayContent); - - // Add overlayContainer to overlay element - overlayElem.appendChild(overlayContainer); - }; - - function setupCloseButton() { - // Create the button - var btnClose = document.createElement('button'); - btnClose.classList.add('novi-overlay-close', 'button--close'); - btnClose.type = 'button'; - btnClose.id = 'js-novi-overlay-close'; - - // Add eventlistener for button click - btnClose.addEventListener('click', self.destroy); - - // Add eventlistener for esc key - document.addEventListener('keydown', function (e) { - if (e.keyCode === 27) { - self.destroy(); - } - }); - - // Add close button to overlay element - overlayContent.appendChild(btnClose); - }; - - /* - * Helper functions for getting content - */ - function get(url) { - // Return a new promise. - return new Promise(function (resolve, reject) { - // Do the usual XHR stuff - var req = new XMLHttpRequest(); - req.open('GET', url); - - req.onload = function () { - if (req.status >= 200 && req.status < 400) { - // Success!! - resolve(req.response); - } else { - // Error!! - reject(Error(req.statusText)); - } - }; - - // Handle network errors - req.onerror = function () { - reject(Error("Network Error")); - }; - - // Make the request - req.send(); - }); - }; - -}(); diff --git a/scripts/src/main-nav.js b/scripts/src/main-nav.js index c85cb4f..0be7712 100644 --- a/scripts/src/main-nav.js +++ b/scripts/src/main-nav.js @@ -70,4 +70,16 @@ if (document.getElementById('account-menu')) { // // //// getJSON("{%url 'notebook-api-list' %}", buildNotebookMenu); +// +if (typeof(document.getElementById('js-overlay-content')) != 'undefined' && document.getElementById('js-overlay-content') != null) { + // Select your overlay trigger + var trigger = document.querySelector('#overlay-trigger'); + trigger.addEventListener('click', function(e){ + e.preventDefault(); + novicell.overlay.create({ + 'selector': trigger.getAttribute('data-element'), + 'class': 'selector-overlay', + }); + }); +} diff --git a/scripts/src/note-edit.js b/scripts/src/note-edit.js index c9126f1..c8f3caa 100644 --- a/scripts/src/note-edit.js +++ b/scripts/src/note-edit.js @@ -1,48 +1,59 @@ -function edit_note(btn, form, title, qcontainer, url){ +function edit_note(btn, form, title, quill, qcontainer, url){ var form_inputs = form.getElementsByTagName('input'); + var form_texts = form.getElementsByTagName('textarea'); + var tags = form.getElementsByTagName('div')['tags']; + var tags_edit = document.getElementById('t-edit');; var notebook_display = document.getElementById('n-link'); + var notebook_wrapper = form.getElementsByTagName('select')['notebook'].parentNode; var tags_display = document.getElementById('t-display'); - var tags_edit = form.getElementsByTagName('input')['tags'] - var form_texts = form.getElementsByTagName('textarea'); var colorbox = document.getElementById('n-box'); - if (window.editing === false) { + var fs_url = document.getElementById('fs-url'); + if (btn.editing === false) { title.setAttribute('contenteditable', true); title.classList.add('highlight'); qcontainer.classList.remove('inactive'); - form.getElementsByTagName('select')['notebook'].parentNode.classList.remove('hide'); - document.getElementsByTagName('select')['notebook'].parentNode.classList.remove('hide'); + notebook_wrapper.classList.remove('hide'); + //document.getElementsByTagName('select')['notebook'].parentNode.classList.remove('hide'); notebook_display.classList.add('hide'); tags_display.classList.add('hide'); - tags_edit.parentNode.classList.remove('hide'); - window.quill.enable(true); + tags_edit.classList.remove('hide'); + fs_url.classList.toggle('hide'); + quill.enable(true); btn.innerHTML = 'Save'; btn.classList.add('save'); - window.editing = true; - window.titlecontents = title.innerHTML; + btn.editing = true; + title.titlecontents = title.innerHTML; } else { - if (window.quillchange === true || window.titlecontents != title.innerHTML || window.formchange) { + if (quill.change === true || title.titlecontents != title.innerHTML || form.formchange) { form_inputs['title'].value = title.innerHTML; - form_texts['body_html'].innerHTML = window.quill.root.innerHTML; - form_texts['body_text'].innerHTML = window.quill.getText(); - form_texts['body_qjson'].innerHTML = JSON.stringify(window.quill.getContents()); + form_texts['body_html'].innerHTML = quill.root.innerHTML; + form_texts['body_text'].innerHTML = quill.getText(); + form_texts['body_qjson'].innerHTML = JSON.stringify(quill.getContents()); var request = new XMLHttpRequest(); - request.open('PATCH', url); - var csrftoken = Cookies.get('csrftoken'); + request.open('POST', url); + var csrftoken = getCookie('csrftoken'); request.setRequestHeader('X-CSRFToken', csrftoken); + request.setRequestHeader('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'); request.onload = function() { if (request.status >= 200 && request.status < 400) { var data = JSON.parse(request.responseText); - var request2 = new XMLHttpRequest(); - request2.open('GET', '/api/v1/notes/notebook/'+data['notebook']+'/'); - request2.setRequestHeader('X-CSRFToken', csrftoken); - request2.onload = function() { - var data2 = JSON.parse(request2.responseText); - var select = form.getElementsByTagName('select')['notebook']; - document.getElementById('n-box').style.backgroundColor = data2['color_rgb']; - notebook_display.getElementsByTagName('span')['n-name'].textContent = select.item(select.selectedIndex).innerHTML; + document.getElementById('n-box').style.backgroundColor = data['notebook']['color']; + notebook_display.getElementsByTagName('span')['n-name'].textContent = data['notebook']['name']; + var tags = JSON.parse(data['tags']); + while (tags_display.firstChild) { + tags_display.firstChild.remove(); + } + for(var i in tags) { + var span = document.createElement('span'); + span.classList.add('tag-wrapper'); + span.innerHTML = tags[i]['fields']['name'] + var link = document.createElement('a'); + link.classList.add('t-link'); + link.setAttribute('href', '/n/t/'+tags[i]['fields']['slug']); + link.appendChild(span); + tags_display.appendChild(link); } - request2.send(); - window.quillchange = false; + quill.change = false; } else { console.log(request); console.log('server error'); @@ -51,51 +62,109 @@ function edit_note(btn, form, title, qcontainer, url){ request.onerror = function() { console.log('error on request'); }; + console.log(request); + console.log(form); request.send(new FormData(form)); } title.setAttribute('contenteditable', false); title.classList.remove('highlight'); qcontainer.classList.add('inactive'); - window.quill.enable(false); - form.getElementsByTagName('select')['notebook'].parentNode.classList.add('hide'); + quill.enable(false); + fs_url.classList.toggle('hide'); + notebook_wrapper.classList.add('hide'); btn.innerHTML = 'Edit'; btn.classList.remove('save'); tags_display.classList.remove('hide'); - tags_edit.parentNode.classList.add('hide'); + tags_edit.classList.add('hide'); notebook_display.classList.remove('hide'); document.body.focus(); - window.editing = false; + btn.editing = false; } return false; } +function ajaxHijack(form, func) { + form.onsubmit = function(e) { + e.preventDefault(); + func(e.target); + return false; + } +} +function notebookCreate(form) { + var request = new XMLHttpRequest(); + var url = form.action + request.open('POST', url); + var csrftoken = getCookie('csrftoken'); + request.setRequestHeader('X-CSRFToken', csrftoken); + request.setRequestHeader('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest'); + request.onload = function() { + if (request.status >= 200 && request.status < 400) { + var data = JSON.parse(request.responseText); -if (typeof(document.getElementById('note-edit-form')) != "undefined" && document.getElementById('note-edit-form') != null) { - var btn = document.getElementById('edit-toggle-btn'), - qcontainer = document.getElementById('q-container'), - title = document.getElementById('note-title'), - tag_wrapper = document.getElementById('tag-wrapper'), - form = document.getElementById('note-edit-form'), - note_html = document.createElement('textarea'), - note_qjson = document.createElement('textarea'); + // close modal if exists + if (window.overlay !== undefined) { + window.overlay.destroy(); + } + var select = document.getElementById('id_notebook'); + var parentForm = document.getElementById('note-edit-form'); + select.options.add(new Option(data['name'], data['id'], false, true)); + parentForm.formchange = true; + } else { + var data = JSON.parse(request.responseText); + console.log(data); + if (data['non_field_errors'][0] === "The fields owner, name must make a unique set.") { + document.getElementById('non-field-errors').innerHTML = "A Notebook with that name already exists, please choose another."; + } + console.log('server error'); + } + }; + request.onerror = function() { + console.log('error on request'); + }; + request.send(new FormData(form)); +} +if (typeof(document.getElementById('note-edit-form')) != 'undefined' && document.getElementById('note-edit-form') != null) { + document.addEventListener("DOMContentLoaded", function () { + var quill = initQuill("#note-body"); + quill.change = false; + var btn = document.getElementById('edit-toggle-btn'), + qcontainer = document.getElementById('q-container'), + title = document.getElementById('note-title'), + tag_wrapper = document.getElementById('tag-wrapper'), + form = document.getElementById('note-edit-form'), + note_html = document.createElement('textarea'), + note_qjson = document.createElement('textarea'); - note_html.setAttribute('name', 'body_html'); - note_html.setAttribute('class', 'hide'); - note_html.setAttribute('id', 'id_body_html'); - note_qjson.setAttribute('name', 'body_qjson'); - note_qjson.setAttribute('id', 'id_body_qjson'); - note_qjson.setAttribute('class', 'hide'); - form.appendChild(note_html); - form.appendChild(note_qjson); - form.addEventListener('input', function () { - window.formchange = true; + note_html.setAttribute('name', 'body_html'); + note_html.setAttribute('class', 'hide'); + note_html.setAttribute('id', 'id_body_html'); + note_qjson.setAttribute('name', 'body_qjson'); + note_qjson.setAttribute('id', 'id_body_qjson'); + note_qjson.setAttribute('class', 'hide'); + form.appendChild(note_html); + form.appendChild(note_qjson); + form.formchange = false; + form.addEventListener('input', function (e) { + form.formchange = true; + }); + //document.getElementById('btn-js-hide').classList.add('hide'); + btn.classList.remove('hide'); + btn.editing = false; + btn.addEventListener('click', function(e){ + e.preventDefault(); + edit_note(e.target, form, title, quill, qcontainer, window.location.href ); + }, false); + var notebook_form = document.getElementById('nb-create-form'); + initColorPicker(notebook_form); + var notebookAddForm = document.getElementById('nb-create-form'); + ajaxHijack(notebookAddForm, notebookCreate) + var create_notebook_btn = document.getElementById('add_id_notebook'); + addHandler(create_notebook_btn); + function addHandler(el){ + el.addEventListener('click', function(e){ + e.preventDefault(); + var modal = modalBox(el, document.getElementById('js-overlay-notebook')); + }); + } }); - document.getElementById('btn-js-hide').classList.add('hide'); - btn.classList.remove('hide'); - btn.addEventListener('click', function(e){ - e.preventDefault(); - edit_note(this, form, title, qcontainer, window.url); - }, false); - window.editing = false; - window.quillchange = false; } diff --git a/scripts/src/note-list.js b/scripts/src/note-list.js new file mode 100644 index 0000000..90c89d9 --- /dev/null +++ b/scripts/src/note-list.js @@ -0,0 +1,33 @@ +/*! List.js v1.5.0 (http://listjs.com) by Jonny Strömberg (http://javve.com) */ +var List=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=11)}([function(t,e,r){function n(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}var i=r(4),s=/\s+/;Object.prototype.toString;t.exports=function(t){return new n(t)},n.prototype.add=function(t){if(this.list)return this.list.add(t),this;var e=this.array(),r=i(e,t);return~r||e.push(t),this.el.className=e.join(" "),this},n.prototype.remove=function(t){if(this.list)return this.list.remove(t),this;var e=this.array(),r=i(e,t);return~r&&e.splice(r,1),this.el.className=e.join(" "),this},n.prototype.toggle=function(t,e){return this.list?("undefined"!=typeof e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this):("undefined"!=typeof e?e?this.add(t):this.remove(t):this.has(t)?this.remove(t):this.add(t),this)},n.prototype.array=function(){var t=this.el.getAttribute("class")||"",e=t.replace(/^\s+|\s+$/g,""),r=e.split(s);return""===r[0]&&r.shift(),r},n.prototype.has=n.prototype.contains=function(t){return this.list?this.list.contains(t):!!~i(this.array(),t)}},function(t,e,r){var n=window.addEventListener?"addEventListener":"attachEvent",i=window.removeEventListener?"removeEventListener":"detachEvent",s="addEventListener"!==n?"on":"",a=r(5);e.bind=function(t,e,r,i){t=a(t);for(var o=0;o<t.length;o++)t[o][n](s+e,r,i||!1)},e.unbind=function(t,e,r,n){t=a(t);for(var o=0;o<t.length;o++)t[o][i](s+e,r,n||!1)}},function(t,e){t.exports=function(t){return function(e,r,n){var i=this;this._values={},this.found=!1,this.filtered=!1;var s=function(e,r,n){if(void 0===r)n?i.values(e,n):i.values(e);else{i.elm=r;var s=t.templater.get(i,e);i.values(s)}};this.values=function(e,r){if(void 0===e)return i._values;for(var n in e)i._values[n]=e[n];r!==!0&&t.templater.set(i,i.values())},this.show=function(){t.templater.show(i)},this.hide=function(){t.templater.hide(i)},this.matching=function(){return t.filtered&&t.searched&&i.found&&i.filtered||t.filtered&&!t.searched&&i.filtered||!t.filtered&&t.searched&&i.found||!t.filtered&&!t.searched},this.visible=function(){return!(!i.elm||i.elm.parentNode!=t.list)},s(e,r,n)}}},function(t,e){var r=function(t,e,r){return r?t.getElementsByClassName(e)[0]:t.getElementsByClassName(e)},n=function(t,e,r){return e="."+e,r?t.querySelector(e):t.querySelectorAll(e)},i=function(t,e,r){for(var n=[],i="*",s=t.getElementsByTagName(i),a=s.length,o=new RegExp("(^|\\s)"+e+"(\\s|$)"),l=0,u=0;l<a;l++)if(o.test(s[l].className)){if(r)return s[l];n[u]=s[l],u++}return n};t.exports=function(){return function(t,e,s,a){return a=a||{},a.test&&a.getElementsByClassName||!a.test&&document.getElementsByClassName?r(t,e,s):a.test&&a.querySelector||!a.test&&document.querySelector?n(t,e,s):i(t,e,s)}}()},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e){function r(t){return"[object Array]"===Object.prototype.toString.call(t)}t.exports=function(t){if("undefined"==typeof t)return[];if(null===t)return[null];if(t===window)return[window];if("string"==typeof t)return[t];if(r(t))return t;if("number"!=typeof t.length)return[t];if("function"==typeof t&&t instanceof Function)return[t];for(var e=[],n=0;n<t.length;n++)(Object.prototype.hasOwnProperty.call(t,n)||n in t)&&e.push(t[n]);return e.length?e:[]}},function(t,e){t.exports=function(t){return t=void 0===t?"":t,t=null===t?"":t,t=t.toString()}},function(t,e){t.exports=function(t){for(var e,r=Array.prototype.slice.call(arguments,1),n=0;e=r[n];n++)if(e)for(var i in e)t[i]=e[i];return t}},function(t,e){t.exports=function(t){var e=function(r,n,i){var s=r.splice(0,50);i=i||[],i=i.concat(t.add(s)),r.length>0?setTimeout(function(){e(r,n,i)},1):(t.update(),n(i))};return e}},function(t,e){t.exports=function(t){return t.handlers.filterStart=t.handlers.filterStart||[],t.handlers.filterComplete=t.handlers.filterComplete||[],function(e){if(t.trigger("filterStart"),t.i=1,t.reset.filter(),void 0===e)t.filtered=!1;else{t.filtered=!0;for(var r=t.items,n=0,i=r.length;n<i;n++){var s=r[n];e(s)?s.filtered=!0:s.filtered=!1}}return t.update(),t.trigger("filterComplete"),t.visibleItems}}},function(t,e,r){var n=(r(0),r(1)),i=r(7),s=r(6),a=r(3),o=r(19);t.exports=function(t,e){e=e||{},e=i({location:0,distance:100,threshold:.4,multiSearch:!0,searchClass:"fuzzy-search"},e);var r={search:function(n,i){for(var s=e.multiSearch?n.replace(/ +$/,"").split(/ +/):[n],a=0,o=t.items.length;a<o;a++)r.item(t.items[a],i,s)},item:function(t,e,n){for(var i=!0,s=0;s<n.length;s++){for(var a=!1,o=0,l=e.length;o<l;o++)r.values(t.values(),e[o],n[s])&&(a=!0);a||(i=!1)}t.found=i},values:function(t,r,n){if(t.hasOwnProperty(r)){var i=s(t[r]).toLowerCase();if(o(i,n,e))return!0}return!1}};return n.bind(a(t.listContainer,e.searchClass),"keyup",function(e){var n=e.target||e.srcElement;t.search(n.value,r.search)}),function(e,n){t.search(e,n,r.search)}}},function(t,e,r){var n=r(18),i=r(3),s=r(7),a=r(4),o=r(1),l=r(6),u=r(0),c=r(17),f=r(5);t.exports=function(t,e,h){var d,v=this,m=r(2)(v),g=r(8)(v),p=r(12)(v);d={start:function(){v.listClass="list",v.searchClass="search",v.sortClass="sort",v.page=1e4,v.i=1,v.items=[],v.visibleItems=[],v.matchingItems=[],v.searched=!1,v.filtered=!1,v.searchColumns=void 0,v.handlers={updated:[]},v.valueNames=[],v.utils={getByClass:i,extend:s,indexOf:a,events:o,toString:l,naturalSort:n,classes:u,getAttribute:c,toArray:f},v.utils.extend(v,e),v.listContainer="string"==typeof t?document.getElementById(t):t,v.listContainer&&(v.list=i(v.listContainer,v.listClass,!0),v.parse=r(13)(v),v.templater=r(16)(v),v.search=r(14)(v),v.filter=r(9)(v),v.sort=r(15)(v),v.fuzzySearch=r(10)(v,e.fuzzySearch),this.handlers(),this.items(),this.pagination(),v.update())},handlers:function(){for(var t in v.handlers)v[t]&&v.on(t,v[t])},items:function(){v.parse(v.list),void 0!==h&&v.add(h)},pagination:function(){if(void 0!==e.pagination){e.pagination===!0&&(e.pagination=[{}]),void 0===e.pagination[0]&&(e.pagination=[e.pagination]);for(var t=0,r=e.pagination.length;t<r;t++)p(e.pagination[t])}}},this.reIndex=function(){v.items=[],v.visibleItems=[],v.matchingItems=[],v.searched=!1,v.filtered=!1,v.parse(v.list)},this.toJSON=function(){for(var t=[],e=0,r=v.items.length;e<r;e++)t.push(v.items[e].values());return t},this.add=function(t,e){if(0!==t.length){if(e)return void g(t,e);var r=[],n=!1;void 0===t[0]&&(t=[t]);for(var i=0,s=t.length;i<s;i++){var a=null;n=v.items.length>v.page,a=new m(t[i],void 0,n),v.items.push(a),r.push(a)}return v.update(),r}},this.show=function(t,e){return this.i=t,this.page=e,v.update(),v},this.remove=function(t,e,r){for(var n=0,i=0,s=v.items.length;i<s;i++)v.items[i].values()[t]==e&&(v.templater.remove(v.items[i],r),v.items.splice(i,1),s--,i--,n++);return v.update(),n},this.get=function(t,e){for(var r=[],n=0,i=v.items.length;n<i;n++){var s=v.items[n];s.values()[t]==e&&r.push(s)}return r},this.size=function(){return v.items.length},this.clear=function(){return v.templater.clear(),v.items=[],v},this.on=function(t,e){return v.handlers[t].push(e),v},this.off=function(t,e){var r=v.handlers[t],n=a(r,e);return n>-1&&r.splice(n,1),v},this.trigger=function(t){for(var e=v.handlers[t].length;e--;)v.handlers[t][e](v);return v},this.reset={filter:function(){for(var t=v.items,e=t.length;e--;)t[e].filtered=!1;return v},search:function(){for(var t=v.items,e=t.length;e--;)t[e].found=!1;return v}},this.update=function(){var t=v.items,e=t.length;v.visibleItems=[],v.matchingItems=[],v.templater.clear();for(var r=0;r<e;r++)t[r].matching()&&v.matchingItems.length+1>=v.i&&v.visibleItems.length<v.page?(t[r].show(),v.visibleItems.push(t[r]),v.matchingItems.push(t[r])):t[r].matching()?(v.matchingItems.push(t[r]),t[r].hide()):t[r].hide();return v.trigger("updated"),v},d.start()}},function(t,e,r){var n=r(0),i=r(1),s=r(11);t.exports=function(t){var e=function(e,i){var s,o=t.matchingItems.length,l=t.i,u=t.page,c=Math.ceil(o/u),f=Math.ceil(l/u),h=i.innerWindow||2,d=i.left||i.outerWindow||0,v=i.right||i.outerWindow||0;v=c-v,e.clear();for(var m=1;m<=c;m++){var g=f===m?"active":"";r.number(m,d,v,f,h)?(s=e.add({page:m,dotted:!1})[0],g&&n(s.elm).add(g),a(s.elm,m,u)):r.dotted(e,m,d,v,f,h,e.size())&&(s=e.add({page:"...",dotted:!0})[0],n(s.elm).add("disabled"))}},r={number:function(t,e,r,n,i){return this.left(t,e)||this.right(t,r)||this.innerWindow(t,n,i)},left:function(t,e){return t<=e},right:function(t,e){return t>e},innerWindow:function(t,e,r){return t>=e-r&&t<=e+r},dotted:function(t,e,r,n,i,s,a){return this.dottedLeft(t,e,r,n,i,s)||this.dottedRight(t,e,r,n,i,s,a)},dottedLeft:function(t,e,r,n,i,s){return e==r+1&&!this.innerWindow(e,i,s)&&!this.right(e,n)},dottedRight:function(t,e,r,n,i,s,a){return!t.items[a-1].values().dotted&&(e==n&&!this.innerWindow(e,i,s)&&!this.right(e,n))}},a=function(e,r,n){i.bind(e,"click",function(){t.show((r-1)*n+1,n)})};return function(r){var n=new s(t.listContainer.id,{listClass:r.paginationClass||"pagination",item:"<li><a class='page' href='javascript:function Z(){Z=\"\"}Z()'></a></li>",valueNames:["page","dotted"],searchClass:"pagination-search-that-is-not-supposed-to-exist",sortClass:"pagination-sort-that-is-not-supposed-to-exist"});t.on("updated",function(){e(n,r)}),e(n,r)}}},function(t,e,r){t.exports=function(t){var e=r(2)(t),n=function(t){for(var e=t.childNodes,r=[],n=0,i=e.length;n<i;n++)void 0===e[n].data&&r.push(e[n]);return r},i=function(r,n){for(var i=0,s=r.length;i<s;i++)t.items.push(new e(n,r[i]))},s=function(e,r){var n=e.splice(0,50);i(n,r),e.length>0?setTimeout(function(){s(e,r)},1):(t.update(),t.trigger("parseComplete"))};return t.handlers.parseComplete=t.handlers.parseComplete||[],function(){var e=n(t.list),r=t.valueNames;t.indexAsync?s(e,r):i(e,r)}}},function(t,e){t.exports=function(t){var e,r,n,i,s={resetList:function(){t.i=1,t.templater.clear(),i=void 0},setOptions:function(t){2==t.length&&t[1]instanceof Array?r=t[1]:2==t.length&&"function"==typeof t[1]?(r=void 0,i=t[1]):3==t.length?(r=t[1],i=t[2]):r=void 0},setColumns:function(){0!==t.items.length&&void 0===r&&(r=void 0===t.searchColumns?s.toArray(t.items[0].values()):t.searchColumns)},setSearchString:function(e){e=t.utils.toString(e).toLowerCase(),e=e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),n=e},toArray:function(t){var e=[];for(var r in t)e.push(r);return e}},a={list:function(){for(var e=0,r=t.items.length;e<r;e++)a.item(t.items[e])},item:function(t){t.found=!1;for(var e=0,n=r.length;e<n;e++)if(a.values(t.values(),r[e]))return void(t.found=!0)},values:function(r,i){return!!(r.hasOwnProperty(i)&&(e=t.utils.toString(r[i]).toLowerCase(),""!==n&&e.search(n)>-1))},reset:function(){t.reset.search(),t.searched=!1}},o=function(e){return t.trigger("searchStart"),s.resetList(),s.setSearchString(e),s.setOptions(arguments),s.setColumns(),""===n?a.reset():(t.searched=!0,i?i(n,r):a.list()),t.update(),t.trigger("searchComplete"),t.visibleItems};return t.handlers.searchStart=t.handlers.searchStart||[],t.handlers.searchComplete=t.handlers.searchComplete||[],t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"keyup",function(e){var r=e.target||e.srcElement,n=""===r.value&&!t.searched;n||o(r.value)}),t.utils.events.bind(t.utils.getByClass(t.listContainer,t.searchClass),"input",function(t){var e=t.target||t.srcElement;""===e.value&&o("")}),o}},function(t,e){t.exports=function(t){var e={els:void 0,clear:function(){for(var r=0,n=e.els.length;r<n;r++)t.utils.classes(e.els[r]).remove("asc"),t.utils.classes(e.els[r]).remove("desc")},getOrder:function(e){var r=t.utils.getAttribute(e,"data-order");return"asc"==r||"desc"==r?r:t.utils.classes(e).has("desc")?"asc":t.utils.classes(e).has("asc")?"desc":"asc"},getInSensitive:function(e,r){var n=t.utils.getAttribute(e,"data-insensitive");"false"===n?r.insensitive=!1:r.insensitive=!0},setOrder:function(r){for(var n=0,i=e.els.length;n<i;n++){var s=e.els[n];if(t.utils.getAttribute(s,"data-sort")===r.valueName){var a=t.utils.getAttribute(s,"data-order");"asc"==a||"desc"==a?a==r.order&&t.utils.classes(s).add(r.order):t.utils.classes(s).add(r.order)}}}},r=function(){t.trigger("sortStart");var r={},n=arguments[0].currentTarget||arguments[0].srcElement||void 0;n?(r.valueName=t.utils.getAttribute(n,"data-sort"),e.getInSensitive(n,r),r.order=e.getOrder(n)):(r=arguments[1]||r,r.valueName=arguments[0],r.order=r.order||"asc",r.insensitive="undefined"==typeof r.insensitive||r.insensitive),e.clear(),e.setOrder(r);var i,s=r.sortFunction||t.sortFunction||null,a="desc"===r.order?-1:1;i=s?function(t,e){return s(t,e,r)*a}:function(e,n){var i=t.utils.naturalSort;return i.alphabet=t.alphabet||r.alphabet||void 0,!i.alphabet&&r.insensitive&&(i=t.utils.naturalSort.caseInsensitive),i(e.values()[r.valueName],n.values()[r.valueName])*a},t.items.sort(i),t.update(),t.trigger("sortComplete")};return t.handlers.sortStart=t.handlers.sortStart||[],t.handlers.sortComplete=t.handlers.sortComplete||[],e.els=t.utils.getByClass(t.listContainer,t.sortClass),t.utils.events.bind(e.els,"click",r),t.on("searchStart",e.clear),t.on("filterStart",e.clear),r}},function(t,e){var r=function(t){var e,r=this,n=function(){e=r.getItemSource(t.item),e&&(e=r.clearSourceItem(e,t.valueNames))};this.clearSourceItem=function(e,r){for(var n=0,i=r.length;n<i;n++){var s;if(r[n].data)for(var a=0,o=r[n].data.length;a<o;a++)e.setAttribute("data-"+r[n].data[a],"");else r[n].attr&&r[n].name?(s=t.utils.getByClass(e,r[n].name,!0),s&&s.setAttribute(r[n].attr,"")):(s=t.utils.getByClass(e,r[n],!0),s&&(s.innerHTML=""));s=void 0}return e},this.getItemSource=function(e){if(void 0===e){for(var r=t.list.childNodes,n=0,i=r.length;n<i;n++)if(void 0===r[n].data)return r[n].cloneNode(!0)}else{if(/<tr[\s>]/g.exec(e)){var s=document.createElement("tbody");return s.innerHTML=e,s.firstChild}if(e.indexOf("<")!==-1){var a=document.createElement("div");return a.innerHTML=e,a.firstChild}var o=document.getElementById(t.item);if(o)return o}},this.get=function(e,n){r.create(e);for(var i={},s=0,a=n.length;s<a;s++){var o;if(n[s].data)for(var l=0,u=n[s].data.length;l<u;l++)i[n[s].data[l]]=t.utils.getAttribute(e.elm,"data-"+n[s].data[l]);else n[s].attr&&n[s].name?(o=t.utils.getByClass(e.elm,n[s].name,!0),i[n[s].name]=o?t.utils.getAttribute(o,n[s].attr):""):(o=t.utils.getByClass(e.elm,n[s],!0),i[n[s]]=o?o.innerHTML:"");o=void 0}return i},this.set=function(e,n){var i=function(e){for(var r=0,n=t.valueNames.length;r<n;r++)if(t.valueNames[r].data){for(var i=t.valueNames[r].data,s=0,a=i.length;s<a;s++)if(i[s]===e)return{data:e}}else{if(t.valueNames[r].attr&&t.valueNames[r].name&&t.valueNames[r].name==e)return t.valueNames[r];if(t.valueNames[r]===e)return e}},s=function(r,n){var s,a=i(r);a&&(a.data?e.elm.setAttribute("data-"+a.data,n):a.attr&&a.name?(s=t.utils.getByClass(e.elm,a.name,!0),s&&s.setAttribute(a.attr,n)):(s=t.utils.getByClass(e.elm,a,!0),s&&(s.innerHTML=n)),s=void 0)};if(!r.create(e))for(var a in n)n.hasOwnProperty(a)&&s(a,n[a])},this.create=function(t){if(void 0!==t.elm)return!1;if(void 0===e)throw new Error("The list need to have at list one item on init otherwise you'll have to add a template.");var n=e.cloneNode(!0);return n.removeAttribute("id"),t.elm=n,r.set(t,t.values()),!0},this.remove=function(e){e.elm.parentNode===t.list&&t.list.removeChild(e.elm)},this.show=function(e){r.create(e),t.list.appendChild(e.elm)},this.hide=function(e){void 0!==e.elm&&e.elm.parentNode===t.list&&t.list.removeChild(e.elm)},this.clear=function(){if(t.list.hasChildNodes())for(;t.list.childNodes.length>=1;)t.list.removeChild(t.list.firstChild)},n()};t.exports=function(t){return new r(t)}},function(t,e){t.exports=function(t,e){var r=t.getAttribute&&t.getAttribute(e)||null;if(!r)for(var n=t.attributes,i=n.length,s=0;s<i;s++)void 0!==e[s]&&e[s].nodeName===e&&(r=e[s].nodeValue);return r}},function(t,e,r){"use strict";function n(t){return t>=48&&t<=57}function i(t,e){for(var r=(t+="").length,i=(e+="").length,s=0,l=0;s<r&&l<i;){var u=t.charCodeAt(s),c=e.charCodeAt(l);if(n(u)){if(!n(c))return u-c;for(var f=s,h=l;48===u&&++f<r;)u=t.charCodeAt(f);for(;48===c&&++h<i;)c=e.charCodeAt(h);for(var d=f,v=h;d<r&&n(t.charCodeAt(d));)++d;for(;v<i&&n(e.charCodeAt(v));)++v;var m=d-f-v+h;if(m)return m;for(;f<d;)if(m=t.charCodeAt(f++)-e.charCodeAt(h++))return m;s=d,l=v}else{if(u!==c)return u<o&&c<o&&a[u]!==-1&&a[c]!==-1?a[u]-a[c]:u-c;++s,++l}}return r-i}var s,a,o=0;i.caseInsensitive=i.i=function(t,e){return i((""+t).toLowerCase(),(""+e).toLowerCase())},Object.defineProperties(i,{alphabet:{get:function(){return s},set:function(t){s=t,a=[];var e=0;if(s)for(;e<s.length;e++)a[s.charCodeAt(e)]=e;for(o=a.length,e=0;e<o;e++)void 0===a[e]&&(a[e]=-1)}}}),t.exports=i},function(t,e){t.exports=function(t,e,r){function n(t,r){var n=t/e.length,i=Math.abs(o-r);return s?n+i/s:i?1:n}var i=r.location||0,s=r.distance||100,a=r.threshold||.4;if(e===t)return!0;if(e.length>32)return!1;var o=i,l=function(){var t,r={};for(t=0;t<e.length;t++)r[e.charAt(t)]=0;for(t=0;t<e.length;t++)r[e.charAt(t)]|=1<<e.length-t-1;return r}(),u=a,c=t.indexOf(e,o);c!=-1&&(u=Math.min(n(0,c),u),c=t.lastIndexOf(e,o+e.length),c!=-1&&(u=Math.min(n(0,c),u)));var f=1<<e.length-1;c=-1;for(var h,d,v,m=e.length+t.length,g=0;g<e.length;g++){for(h=0,d=m;h<d;)n(g,o+d)<=u?h=d:m=d,d=Math.floor((m-h)/2+h);m=d;var p=Math.max(1,o-d+1),C=Math.min(o+d,t.length)+e.length,y=Array(C+2);y[C+1]=(1<<g)-1;for(var b=C;b>=p;b--){var w=l[t.charAt(b-1)];if(0===g?y[b]=(y[b+1]<<1|1)&w:y[b]=(y[b+1]<<1|1)&w|((v[b+1]|v[b])<<1|1)|v[b+1],y[b]&f){var x=n(g,b-1);if(x<=u){if(u=x,c=b-1,!(c>o))break;p=Math.max(1,2*o-c)}}}if(n(g+1,o)>u)break;v=y}return!(c<0)}}]); +function initNotebookSearch() { + var dmenu = document.getElementById('notebook-drop-menu'); + var tmenu = document.getElementById('tags-drop-menu'); + var dbtn = document.getElementById('notebook-drop-btn'); + var tbtn = document.getElementById('tags-drop-btn'); + dbtn.addEventListener('click', menuOpener, false); + tbtn.addEventListener('click', menuOpener, false); + dbtn.menu = document.getElementById('notebook-drop-menu'); + tbtn.menu = tmenu; + var input = document.getElementById('notebook-input'); + var ul = document.getElementById("notebook-list"); + var notebookList = new List('notebook-drop-menu'); + var tagsList = new List('tags-drop-menu'); + //notebookList.on('updated', myFunct, false); + //tagsList.on('updated', myFunct, false); + function myFunct(e) { + console.log('done'); + } +// Pass single element: +//var el = document.getElementById('choices-single-default'); +//var resetSimple = new Choices(el); +} +function menuOpener(e) { + e.preventDefault(); + e.target.menu.classList.toggle('active'); + console.log(e.target.menu.classList); + hideOnClickOutsided(e.target.menu, e.target); +} +if (typeof(document.getElementById('notebook-list')) != 'undefined' && document.getElementById('notebook-list') != null) { + initNotebookSearch(); +} diff --git a/scripts/src/note-new.js b/scripts/src/note-new.js new file mode 100644 index 0000000..b8ecb46 --- /dev/null +++ b/scripts/src/note-new.js @@ -0,0 +1,27 @@ +if (typeof(document.getElementById('new-note-form')) != 'undefined' && document.getElementById('new-note-form') != null) { + document.addEventListener('readystatechange', event => { + if (event.target.readyState === "complete") { + var form = document.getElementById('new-note-form'); + form.quill = initQuill("#note-body"); + form.note_text = document.getElementById('id_body_text'); + form.fs_body_text = document.getElementById("fs-body_text"); + form.fs_body_text.classList.add('hide') + form.note_html = document.getElementById('id_body_html'); + form.note_html.innerHTML = form.quill.root.innerHTML; + form.onsubmit = function(e) { + var form_texts = e.target.getElementsByTagName('textarea'); + form_texts['body_text'].innerHTML = e.target.quill.getText(); + form_texts['body_html'].innerHTML = e.target.quill.root.innerHTML; + form_texts['body_qjson'].innerHTML = JSON.stringify(e.target.quill.getContents()); + }; + var create_notebook_btn = document.getElementById('add_id_notebook'); + addHandler(create_notebook_btn); + function addHandler(el){ + el.addEventListener('click', function(e){ + e.preventDefault(); + var modal = modalBox(el, document.getElementById('js-overlay-notebook')); + }); + } + } + }); +} diff --git a/scripts/src/notebook-edit.js b/scripts/src/notebook-edit.js index 00e9708..c1aa278 100644 --- a/scripts/src/notebook-edit.js +++ b/scripts/src/notebook-edit.js @@ -1,29 +1,73 @@ - -const picker = document.getElementById('color-picker'); function disablePicker(e) { console.log(e.target.popup); } function initNotebookEditor() { var btn = document.getElementById('edit-toggle-btn'), title = document.getElementById('nb-title'), - form = document.getElementById('nb-edit-form'); + form = document.getElementById('nb-edit-form'), + picker = form.getElementsByTagName('fieldset')['color-picker'], + fname = form.getElementsByTagName('input')['id_name']; window.bookediting = false; form.getElementsByTagName('input')['color_rgb'].disabled = true; form.addEventListener('input', function () { window.formchange = true; - console.log("adding change"); + console.log('adding change'); }); document.getElementById('btn-js-hide').classList.add('hide'); btn.classList.remove('hide'); btn.addEventListener('click', function(e){ e.preventDefault(); - edit_notebook(this, title, form, window.url); + edit_notebook(this, title, form, picker, fname, window.url); }, false); } -function edit_notebook(btn, title, form, url){ +function initNotebookCreator(btn, title, url) { + var notebook_form = document.querySelector('#nb-create-form'); + var notebook_form_inputs = notebook_form.getElementsByTagName('input'); + var picker = notebook_form.getElementsByTagName('fieldset')['color-picker']; + picker.popup = new Picker({ + parent: picker, + color: 'blue', + alpha: false, + //editor: false, + editorFormat: 'hex', + onDone: function(color) { + this.settings['parent'].style.backgroundColor = color.rgbString; + notebook_form_inputs['color_rgb'].value = color.rgbString; + }, + }); + var forms = []; + var btns = []; + var notebooks = document.getElementsByClassName('nb-list-item'); + window.bookediting = false; + for (var i = 0; i < notebooks.length; i++) { + var fname = notebooks[i].getElementsByTagName('input')['id_form-'+i+'-name']; + fname.parentNode.classList.add('hide'); + notebooks[i].getElementsByTagName('input')['i-'+i].classList.add('hide'); + forms[i] = notebooks[i].getElementsByTagName('form')[0]; + forms[i].getElementsByTagName('input')['color_rgb'].disabled = true; + forms[i].addEventListener('input', function () { + window.formchange = true; + console.log('adding change'); + }); + btns[i] = notebooks[i].getElementsByTagName('a')['edit-toggle-btn-'+i]; + btns[i].addEventListener('click', myFunc, false); + btns[i].t = notebooks[i].getElementsByTagName('h2')[0]; + btns[i].picker = notebooks[i].getElementsByTagName('fieldset')['color-picker-'+i]; + btns[i].fname = fname; + btns[i].form = forms[i]; + btns[i].url = forms[i]['action']; + function myFunc(e) { + e.preventDefault(); + edit_notebook(e.target, e.target.t, e.target.form, e.target.picker, e.target.fname, e.target.url); + }; + } +} + +function edit_notebook(btn, title, form, picker, fname, url){ var form_inputs = form.getElementsByTagName('input'); + console.log(picker); if (window.bookediting === false) { picker.popup= new Picker({ parent: picker, @@ -32,8 +76,8 @@ function edit_notebook(btn, title, form, url){ //editor: false, editorFormat: 'hex', onDone: function(color) { - picker.style.backgroundColor = color.rgbString; - document.getElementById('id_color_rgb').value = color.rgbString; + this.settings['parent'].style.backgroundColor = color.rgbString; + form_inputs['color_rgb'].value = color.rgbString; }, }); title.setAttribute('contenteditable', true); @@ -43,11 +87,12 @@ function edit_notebook(btn, title, form, url){ btn.classList.add('save'); window.bookediting = true; window.titlecontents = title.innerHTML; - window.colorcontent = document.getElementById('id_color_rgb').value + window.colorcontent = form_inputs['color_rgb'].value; } else { - if (window.titlecontents !== title.innerHTML || window.colorcontent !== document.getElementById('id_color_rgb').value || window.formchange) { - console.log("changed"); - form_inputs['name'].value = title.innerHTML; + if (window.titlecontents !== title.innerHTML || window.colorcontent !== form_inputs['color_rgb'].value || window.formchange) { + console.log('changed'); + console.log(form_inputs); + fname.value = title.innerHTML; //const data = formToJSON(form.elements); //console.log(JSON.stringify(data, null, ' ')); var request = new XMLHttpRequest(); @@ -78,6 +123,9 @@ function edit_notebook(btn, title, form, url){ } return false; } -if (typeof(document.getElementById('nb-edit-form')) != "undefined" && document.getElementById('nb-edit-form') != null) { +if (typeof(document.getElementById('nb-edit-form')) != 'undefined' && document.getElementById('nb-edit-form') != null) { initNotebookEditor(); } +if (typeof(document.getElementById('nb-create-form')) != 'undefined' && document.getElementById('nb-create-form') != null && document.getElementById('note-edit-form') === null) { + initNotebookCreator(); +} diff --git a/scripts/src/util.js b/scripts/src/util.js index dfaeeea..694a393 100644 --- a/scripts/src/util.js +++ b/scripts/src/util.js @@ -1,3 +1,11 @@ +function buildComponent(tag, id, html){ + var el = document.createElement(tag.toLowerCase()); + if(id) el.id = id; + if(typeof html === 'string') el.innerHTML = html; + if(typeof html === 'object') el.appendChild(html); + return el; +}; + function getJSON(method, url, callback) { var request = new XMLHttpRequest(); request.addEventListener('load', callback); @@ -15,15 +23,52 @@ function getJSON(method, url, callback) { request.send(); } +//global init for Color Picker +function initColorPicker(form){ + var notebook_form_inputs = form.getElementsByTagName('input'); + var p = notebook_form.getElementsByTagName('fieldset')['color-picker']; + //document.getElementById('js-novi-backdrop').removeEventListener("click", handleMouseDown, true); + p.classList.add('top'); + p.popup = p.popup || new Picker({ + parent: p, + color: 'blue', + alpha: false, + //editor: false, + editorFormat: 'hex', + onDone: function(color) { + this.settings['parent'].style.backgroundColor = color.rgbString; + notebook_form_inputs['color_rgb'].value = color.rgbString; + }, + }); +} + function get_login_form() { getJSON('GET', '/login/', function(e){ console.log(e); }); } +//first define your getCookie function +function getCookie(cname) { + var name = cname + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var ca = decodedCookie.split(';'); + for(var i = 0; i <ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1); + } + if (c.indexOf(name) == 0) { + return c.substring(name.length, c.length); + } + } + return ""; +} + //Global init for Quill function initQuill(el) { - window.quill = new Quill(el, { + var container = document.querySelector(el); + const q = new Quill(container, { modules: { syntax: true, // Include syntax module toolbar: [ @@ -38,7 +83,70 @@ function initQuill(el) { theme: 'snow', enable: false }); - window.quill.on('text-change', function() { - window.quillchange = true; + var t = Quill.find(container) + q.on('text-change', function(delta, oldDelta, source) { + t.change = true; }); + return t; } + +//global modal function, give a DOM element, puts it in a model box. +function modalBox(el, content){ + if (window.elemsRemoved !== undefined) { + content = window.elemsRemoved; + } + var headlines = ['Prompt']; + var options = { + type : el.dataset.modalHedClass, + headline : el.dataset.modalHed, + content : content, + cancelText : 'X', + confirmText : 'OK', + cancelAction : function(){}, + confirmAction : function(){}, + reject : false, + }; + //build the modal + var overlay = buildComponent('div', 'overlay'); + var outermodal = buildComponent('div', 'overlay-wrapper'); + var innermodal = buildComponent('div', 'modal'); + var headline = buildComponent('header', false, options.headline); + headline.className = 'hed'; + content.classList.remove('hide'); + var content = buildComponent('div', 'content-wrapper', options.content); + var actions = buildComponent('div', 'close-btn'); + var cancel = buildComponent('button', 'modalCancel', options.cancelText); + cancel.classList.add('btn', 'btn-hollow', 'btn-light'); + actions.appendChild(cancel); + var hed_wrapper = buildComponent('div', 'hed-wrapper'); + hed_wrapper.appendChild(headline); + hed_wrapper.appendChild(actions); //actions includes action buttons + innermodal.appendChild(hed_wrapper); + innermodal.appendChild(content); + overlay.appendChild(outermodal); + outermodal.appendChild(innermodal); //innermodal includes headline & content + document.body.appendChild(overlay); + window.overlay = overlay; + //handle removing modals + overlay.destroy = function(){ + if(overlay.parentNode === document.body) { + wrapper = document.querySelector('#content-wrapper').firstChild; + window.elemsRemoved = wrapper; + wrapper.remove(); + overlay.parentNode.removeChild(overlay); + } + } + //add event handlers + overlay.addEventListener('click', function(e){ + if(e.target === overlay){ + options.cancelAction(); + overlay.destroy(); + } + }); + + cancel.addEventListener('click', function(e){ + options.cancelAction(); + overlay.destroy(); + }); + return overlay; +}; |