From d89e9ad76b57a9cc0c28d4f21a44b8e7830db191 Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Mon, 19 Jul 2021 13:51:03 -0400 Subject: [PATCH 01/10] beginning of retroactive editing --- main/migrations/0087_signature_edit_hash.py | 18 +++++ main/migrations/0088_auto_20210713_1540.py | 18 +++++ main/migrations/0089_auto_20210713_1541.py | 18 +++++ main/models.py | 1 + main/urls.py | 6 ++ main/views/main.py | 89 +++++++++++++++++++-- 6 files changed, 142 insertions(+), 8 deletions(-) create mode 100644 main/migrations/0087_signature_edit_hash.py create mode 100644 main/migrations/0088_auto_20210713_1540.py create mode 100644 main/migrations/0089_auto_20210713_1541.py diff --git a/main/migrations/0087_signature_edit_hash.py b/main/migrations/0087_signature_edit_hash.py new file mode 100644 index 000000000..a0a5e2bc4 --- /dev/null +++ b/main/migrations/0087_signature_edit_hash.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.20 on 2021-07-13 15:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0086_merge_20210617_1455'), + ] + + operations = [ + migrations.AddField( + model_name='signature', + name='edit_hash', + field=models.CharField(blank=True, max_length=64), + ), + ] diff --git a/main/migrations/0088_auto_20210713_1540.py b/main/migrations/0088_auto_20210713_1540.py new file mode 100644 index 000000000..740b23b3e --- /dev/null +++ b/main/migrations/0088_auto_20210713_1540.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.20 on 2021-07-13 15:40 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0087_signature_edit_hash'), + ] + + operations = [ + migrations.RenameField( + model_name='signature', + old_name='edit_hash', + new_name='edit_Hash', + ), + ] diff --git a/main/migrations/0089_auto_20210713_1541.py b/main/migrations/0089_auto_20210713_1541.py new file mode 100644 index 000000000..0140d0baa --- /dev/null +++ b/main/migrations/0089_auto_20210713_1541.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.20 on 2021-07-13 15:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0088_auto_20210713_1540'), + ] + + operations = [ + migrations.RenameField( + model_name='signature', + old_name='edit_Hash', + new_name='edit_hash', + ), + ] diff --git a/main/models.py b/main/models.py index 3e1000230..5f0cc9cf4 100644 --- a/main/models.py +++ b/main/models.py @@ -439,6 +439,7 @@ class Signature(models.Model): CommunityEntry, on_delete=models.CASCADE, default="" ) hash = models.CharField(max_length=64, blank=True) + edit_hash = models.CharField(max_length=64, blank=True) # ******************************************************************************# diff --git a/main/urls.py b/main/urls.py index e948b84d7..d81405925 100644 --- a/main/urls.py +++ b/main/urls.py @@ -87,6 +87,12 @@ {"token": "", "state": "", "drive": ""}, name="entry", ), + path( + "edit//", + views.main.EntryView.as_view(), + {"token": "", "state": "", "drive": ""}, + name="entry", + ), path("about/", views.main.About.as_view(), name="about"), path("faq/", views.main.FAQ.as_view(), name="faq"), path("glossary/", views.main.Glossary.as_view(), name="glossary"), diff --git a/main/views/main.py b/main/views/main.py index 863c531bc..cc24f01fb 100644 --- a/main/views/main.py +++ b/main/views/main.py @@ -107,6 +107,7 @@ from shapely.geometry import mapping from geojson_rewind import rewind import geojson +import psycopg2 import os import json import re @@ -114,6 +115,8 @@ import hmac import hashlib import base64 +import uuid +import datetime from django.template import loader import shapely.wkt import reverse_geocoder as rg @@ -1005,22 +1008,92 @@ class EntryView(LoginRequiredMixin, View): "form-MAX_NUM_FORMS": "10", } - # https://www.agiliq.com/blog/2019/01/django-formview/ + # https://www.agiliq.com/blog/2019/01/django-formview/, for creating an entry from scratch def get_initial(self): initial = self.initial if self.request.user.is_authenticated: initial.update({"user": self.request.user}) return initial + + # for editing pre-existing entry + def get_initial_values(self, id): + initial = self.initial + if self.request.user.is_authenticated: + + # cur.execute("""SELECT "custom_question" FROM community_entry WHERE id='"""+str(id)+"""'""") + # query_results = cur.fetchall() + # custom_question = query_results[0][0] + custom_question = "custom q!!" + + query = CommunityEntry.objects.filter(id=id) + entry = query[0] + + query = Address.objects.filter(entry_id=id) + address = query[0] + + print(entry.census_blocks_polygon.type()) + + initial.update({"user": self.request.user}) + initial.update({"user_name": entry.user_name}) + initial.update({"street": address.street}) + initial.update({"city": address.city}) + initial.update({"state": address.state}) + initial.update({"zipcode": address.zipcode}) + initial.update({"comm_activities": entry.comm_activities}) + initial.update({"cultural_interests": entry.cultural_interests}) + initial.update({"economic_interests": entry.economic_interests}) + initial.update({"other_considerations": entry.other_considerations}) + initial.update({"custom_question": custom_question}) + initial.update({"entry_name": entry.entry_name}) + initial.update({"census_blocks_polygon": entry.census_blocks_polygon}) + + return initial + + def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): + if edit_hash: + print("edit_hash: "+edit_hash) + conn = psycopg2.connect(host="localhost", port = 5432, database="representable_db", user="representable", password="representable333") + cur = conn.cursor() - def get(self, request, abbr=None, *args, **kwargs): - if not abbr: - return redirect("/#select") + cur.execute("""SELECT entry_id FROM main_signature WHERE edit_hash='"""+str(edit_hash)+"""'""") + query_results = cur.fetchall() + if not query_results: + return redirect("/404.html") + entry_id = query_results[0][0] + + cur.execute("""SELECT state FROM community_entry WHERE "id"='"""+str(entry_id)+"""'""") + query_results = cur.fetchall() + if not query_results: + return redirect("/404.html") + abbr = query_results[0][0] + + cur.execute("""SELECT created_at FROM community_entry WHERE id='"""+str(entry_id)+"""'""") + query_results = cur.fetchall() + created_at = query_results[0][0].replace(tzinfo=None) + + cur.execute("""SELECT "entry_ID" FROM community_entry WHERE id='"""+str(entry_id)+"""'""") + query_results = cur.fetchall() + entry_ID = query_results[0][0] + + current_time = datetime.datetime.now() + + if (current_time-created_at).total_seconds() > 86400: + return redirect("../../submission/"+str(entry_ID)) + + cur.close() + conn.close() + + comm_form = self.community_form_class( + initial=self.get_initial_values(entry_id), label_suffix="" + ) + elif not abbr: + return redirect("/entry_state_selection") else: if not any(abbr.upper() in i for i in STATES): return redirect("/entry_state_selection") - comm_form = self.community_form_class( - initial=self.get_initial(), label_suffix="" - ) + comm_form = self.community_form_class( + initial=self.get_initial(), label_suffix="" + ) addr_form = self.address_form_class( initial=self.get_initial(), label_suffix="" ) @@ -1318,7 +1391,7 @@ def flagText(text): digestmod=hashlib.sha256, ).digest() signature = base64.b64encode(digest).decode() - sign_obj = Signature(entry=entryForm, hash=signature) + sign_obj = Signature(entry=entryForm, hash=signature, edit_hash = uuid.uuid4()) sign_obj.save() m_uuid = str(entryForm.entry_ID) From aa96d06e016349201f5ac0224812af623cd1c33c Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Tue, 27 Jul 2021 19:17:30 -0400 Subject: [PATCH 02/10] added editing feature TODO: fix mapbox, then deal with frontend collaboration stuff (probably more meetings with people before doing the latter) --- main/forms.py | 1 + main/migrations/0087_signature_edit_hash.py | 6 +- main/migrations/0088_auto_20210713_1540.py | 8 +- main/migrations/0089_auto_20210713_1541.py | 8 +- .../0090_communityentry_is_final.py | 18 ++ .../0091_remove_communityentry_is_final.py | 17 ++ .../0092_communityentry_is_final.py | 18 ++ main/migrations/0093_auto_20210727_1455.py | 18 ++ main/migrations/0094_auto_20210727_1455.py | 18 ++ main/models.py | 3 +- main/static/main/js/geo.js | 28 +++ main/templates/main/entry.html | 2 +- main/templates/main/entry_privacy.html | 54 ++--- main/templates/main/submission.html | 3 + main/urls.py | 6 +- main/views/main.py | 198 ++++++++++++------ 16 files changed, 306 insertions(+), 100 deletions(-) create mode 100644 main/migrations/0090_communityentry_is_final.py create mode 100644 main/migrations/0091_remove_communityentry_is_final.py create mode 100644 main/migrations/0092_communityentry_is_final.py create mode 100644 main/migrations/0093_auto_20210727_1455.py create mode 100644 main/migrations/0094_auto_20210727_1455.py diff --git a/main/forms.py b/main/forms.py index 8548dd8d3..97cd21f91 100644 --- a/main/forms.py +++ b/main/forms.py @@ -141,6 +141,7 @@ class Meta: ), "user_name": forms.TextInput(attrs={"maxlength": 500}), "user_polygon": forms.HiddenInput(), + "is_final": forms.TextInput() } label = { "user_name": "Input your full name: ", diff --git a/main/migrations/0087_signature_edit_hash.py b/main/migrations/0087_signature_edit_hash.py index a0a5e2bc4..77e81bb54 100644 --- a/main/migrations/0087_signature_edit_hash.py +++ b/main/migrations/0087_signature_edit_hash.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('main', '0086_merge_20210617_1455'), + ("main", "0086_merge_20210617_1455"), ] operations = [ migrations.AddField( - model_name='signature', - name='edit_hash', + model_name="signature", + name="edit_hash", field=models.CharField(blank=True, max_length=64), ), ] diff --git a/main/migrations/0088_auto_20210713_1540.py b/main/migrations/0088_auto_20210713_1540.py index 740b23b3e..92ea66b97 100644 --- a/main/migrations/0088_auto_20210713_1540.py +++ b/main/migrations/0088_auto_20210713_1540.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('main', '0087_signature_edit_hash'), + ("main", "0087_signature_edit_hash"), ] operations = [ migrations.RenameField( - model_name='signature', - old_name='edit_hash', - new_name='edit_Hash', + model_name="signature", + old_name="edit_hash", + new_name="edit_Hash", ), ] diff --git a/main/migrations/0089_auto_20210713_1541.py b/main/migrations/0089_auto_20210713_1541.py index 0140d0baa..99bdb78d7 100644 --- a/main/migrations/0089_auto_20210713_1541.py +++ b/main/migrations/0089_auto_20210713_1541.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('main', '0088_auto_20210713_1540'), + ("main", "0088_auto_20210713_1540"), ] operations = [ migrations.RenameField( - model_name='signature', - old_name='edit_Hash', - new_name='edit_hash', + model_name="signature", + old_name="edit_Hash", + new_name="edit_hash", ), ] diff --git a/main/migrations/0090_communityentry_is_final.py b/main/migrations/0090_communityentry_is_final.py new file mode 100644 index 000000000..79e97fdd9 --- /dev/null +++ b/main/migrations/0090_communityentry_is_final.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.24 on 2021-07-27 14:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0089_auto_20210713_1541'), + ] + + operations = [ + migrations.AddField( + model_name='communityentry', + name='is_final', + field=models.BooleanField(default=False), + ), + ] diff --git a/main/migrations/0091_remove_communityentry_is_final.py b/main/migrations/0091_remove_communityentry_is_final.py new file mode 100644 index 000000000..cc3054f89 --- /dev/null +++ b/main/migrations/0091_remove_communityentry_is_final.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.24 on 2021-07-27 14:54 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0090_communityentry_is_final'), + ] + + operations = [ + migrations.RemoveField( + model_name='communityentry', + name='is_final', + ), + ] diff --git a/main/migrations/0092_communityentry_is_final.py b/main/migrations/0092_communityentry_is_final.py new file mode 100644 index 000000000..6e743ebf8 --- /dev/null +++ b/main/migrations/0092_communityentry_is_final.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.24 on 2021-07-27 14:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0091_remove_communityentry_is_final'), + ] + + operations = [ + migrations.AddField( + model_name='communityentry', + name='is_final', + field=models.BooleanField(default=True), + ), + ] diff --git a/main/migrations/0093_auto_20210727_1455.py b/main/migrations/0093_auto_20210727_1455.py new file mode 100644 index 000000000..e02c255b5 --- /dev/null +++ b/main/migrations/0093_auto_20210727_1455.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.24 on 2021-07-27 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0092_communityentry_is_final'), + ] + + operations = [ + migrations.AlterField( + model_name='communityentry', + name='is_final', + field=models.BooleanField(default=False), + ), + ] diff --git a/main/migrations/0094_auto_20210727_1455.py b/main/migrations/0094_auto_20210727_1455.py new file mode 100644 index 000000000..98daae702 --- /dev/null +++ b/main/migrations/0094_auto_20210727_1455.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.24 on 2021-07-27 14:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0093_auto_20210727_1455'), + ] + + operations = [ + migrations.AlterField( + model_name='communityentry', + name='is_final', + field=models.BooleanField(default=True), + ), + ] diff --git a/main/models.py b/main/models.py index 5f0cc9cf4..28e272135 100644 --- a/main/models.py +++ b/main/models.py @@ -393,12 +393,13 @@ class CommunityEntry(models.Model): ) # signature = models.CharField(max_length=64, blank=True) created_at = models.DateTimeField(auto_now_add=True) + is_final = models.BooleanField(default=True) admin_approved = models.BooleanField(default=True) private = models.BooleanField(default=False, null=True) population = models.IntegerField(blank=True, null=True, default=0) def human_readable_name(self): - return self.entry_name.replace(' ', '_') + return self.entry_name.replace(" ", "_") def __str__(self): return str(self.entry_ID) diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index c228d7102..eeae89efc 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -787,6 +787,34 @@ document.addEventListener( $("#entrySubmissionButton").on("click", function (e) { e.preventDefault(); + document.getElementById('id_is_final').value = "True" + var form = $("#entryForm"); + zoomToCommunity(); + // delay so that zoom can occur + var polySuccess = true, + formSuccess = true; + // loading icon + // $("#loading-entry").css("display", "block"); + // $("#loading-entry").delay(1000).fadeOut(1000); + //todo: switch this to a promise ? + setTimeout(function () { + backupSuccess = backupFormValidation(); + privacySuccess = privacyCheckValidation(); + animateStepForward(4, 5, null); + }, 500); + setTimeout(function () { + if (backupSuccess && privacySuccess) { + form.submit(); + } else { + animateStepBackward(5, 4, null); + } + }, 850); + return false; + }); + + $("#entrySaveButton").on("click", function (e) { + e.preventDefault(); + document.getElementById('id_is_final').value = "False" var form = $("#entryForm"); zoomToCommunity(); // delay so that zoom can occur diff --git a/main/templates/main/entry.html b/main/templates/main/entry.html index 44ca056e4..3b4c9b94a 100644 --- a/main/templates/main/entry.html +++ b/main/templates/main/entry.html @@ -207,4 +207,4 @@
- {% endblock %} + {% endblock %} \ No newline at end of file diff --git a/main/templates/main/entry_privacy.html b/main/templates/main/entry_privacy.html index d31b04555..7f706f601 100644 --- a/main/templates/main/entry_privacy.html +++ b/main/templates/main/entry_privacy.html @@ -42,7 +42,7 @@

{% endif %}

-
+
- -
-
-

- {% blocktrans trimmed %} - Submitted communities are final and public. - {% endblocktrans %} -

- -

- {% blocktrans trimmed %} In order to edit a saved community you will need - to create a new community and delete the old one. Your community map, name, - and testimony will be publicly visible on Representable.org {% endblocktrans %} -

-
-
- -
+
-
+
+
+ {{ comm_form.is_final }} +
+
+
+
+

+ {% blocktrans trimmed %} + Submitted communities are final. + {% endblocktrans %} +

-
-
- - +

+ {% blocktrans %} + In order to edit your community again before submitting (or allow collaborators + to edit your community), choose to save as draft. Otherwise, you will need to + delete your community and make a new one in order to make changes. + {% endblocktrans %} +

+
+
+ + +
+
+
+ +
diff --git a/main/templates/main/submission.html b/main/templates/main/submission.html index b39141d60..2289fe6a9 100644 --- a/main/templates/main/submission.html +++ b/main/templates/main/submission.html @@ -49,6 +49,9 @@

{{c.entry_name}}

{{c.drive.name}}
+ {% if c.is_final is False or 86400 > time_difference %} + + {% endif %}
diff --git a/main/urls.py b/main/urls.py index d81405925..f9bb46123 100644 --- a/main/urls.py +++ b/main/urls.py @@ -127,7 +127,11 @@ # path("blog/", views.main.Blog.as_view(), name="blog"), path("export/geojson/", views.main.ExportView.as_view(), name="export"), path("export/csv/", views.main.ExportView.as_view(), name="export"), - path("export/geojson//", views.main.ExportView.as_view(), name="export"), + path( + "export/geojson//", + views.main.ExportView.as_view(), + name="export", + ), path("export/csv//", views.main.ExportView.as_view(), name="export"), path( "multiexport///", diff --git a/main/views/main.py b/main/views/main.py index cc24f01fb..2dc46d660 100644 --- a/main/views/main.py +++ b/main/views/main.py @@ -605,6 +605,8 @@ def get(self, request, *args, **kwargs): "has_state": has_state, "state": state, "c": comm, + "edit_hash": Signature.objects.filter(entry_id=comm.id)[0].edit_hash, + "time_difference": (datetime.datetime.now() - comm.created_at.replace(tzinfo=None)).total_seconds(), "entries": json.dumps(entryPolyDict), "mapbox_key": os.environ.get("DISTR_MAPBOX_KEY"), "mapbox_user_name": os.environ.get("MAPBOX_USER_NAME"), @@ -1013,6 +1015,17 @@ def get_initial(self): initial = self.initial if self.request.user.is_authenticated: initial.update({"user": self.request.user}) + initial.update({"user_name": ""}) + initial.update({"street": ""}) + initial.update({"city": ""}) + initial.update({"state": ""}) + initial.update({"zipcode": ""}) + initial.update({"comm_activities": ""}) + initial.update({"cultural_interests": ""}) + initial.update({"economic_interests": ""}) + initial.update({"other_considerations": ""}) + initial.update({"custom_question": ""}) + initial.update({"entry_name": ""}) return initial # for editing pre-existing entry @@ -1031,8 +1044,6 @@ def get_initial_values(self, id): query = Address.objects.filter(entry_id=id) address = query[0] - print(entry.census_blocks_polygon.type()) - initial.update({"user": self.request.user}) initial.update({"user_name": entry.user_name}) initial.update({"street": address.street}) @@ -1050,67 +1061,99 @@ def get_initial_values(self, id): return initial def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): + + address_required = True + has_drive = False + organization_name = "" + organization_id = None + drive_name = "" + drive_slug = "" + drive_id = None + drive_custom_question = "" + drive_custom_question_example = "" + if edit_hash: - print("edit_hash: "+edit_hash) - conn = psycopg2.connect(host="localhost", port = 5432, database="representable_db", user="representable", password="representable333") - cur = conn.cursor() - cur.execute("""SELECT entry_id FROM main_signature WHERE edit_hash='"""+str(edit_hash)+"""'""") - query_results = cur.fetchall() - if not query_results: - return redirect("/404.html") - entry_id = query_results[0][0] + query = Signature.objects.filter(edit_hash=edit_hash) - cur.execute("""SELECT state FROM community_entry WHERE "id"='"""+str(entry_id)+"""'""") - query_results = cur.fetchall() - if not query_results: + if not query: return redirect("/404.html") - abbr = query_results[0][0] + signature = query[0] + entry_id = signature.entry_id - cur.execute("""SELECT created_at FROM community_entry WHERE id='"""+str(entry_id)+"""'""") - query_results = cur.fetchall() - created_at = query_results[0][0].replace(tzinfo=None) + query = CommunityEntry.objects.filter(id=entry_id) + entry = query[0] + + query = Address.objects.filter(entry_id=entry_id) + address = query[0] - cur.execute("""SELECT "entry_ID" FROM community_entry WHERE id='"""+str(entry_id)+"""'""") - query_results = cur.fetchall() - entry_ID = query_results[0][0] + abbr = entry.state + created_at = entry.created_at.replace(tzinfo=None) + entry_ID = entry.entry_ID current_time = datetime.datetime.now() - if (current_time-created_at).total_seconds() > 86400: + # if more than 24 hrs. since community submitted + if (current_time - created_at).total_seconds() > 86400 and entry.is_final: return redirect("../../submission/"+str(entry_ID)) - cur.close() - conn.close() comm_form = self.community_form_class( - initial=self.get_initial_values(entry_id), label_suffix="" + initial=self.get_initial_values(entry_id), label_suffix="", instance=entry + ) + addr_form = self.address_form_class( + initial=self.get_initial_values(entry_id), label_suffix="", instance=address ) + + if entry.drive_id != None: + has_drive = True + try: + drive = Drive.objects.get(id=entry.drive_id) + except: + raise Http404 + if abbr.upper() != drive.state: + return redirect( + "/entry/drive/" + drive.slug + "/" + drive.state.lower() + ) + + drive_name = drive.name + drive_id = drive.id + drive_custom_question = drive.custom_question + drive_custom_question_example = drive.custom_question_example + organization = drive.organization + organization_name = organization.name + organization_id = organization.id + org_admin = self.request.user.is_org_admin(drive.organization.id) + on_allowlist = False + allowlist_q = AllowList.objects.filter( + organization=drive.organization.id, + email=self.request.user.email, + ) + if allowlist_q: + on_allowlist = True + if drive.private and not (org_admin or on_allowlist): + # if someone somehow gets the URL for a private drive, + # redirect them if they're not an org admin or on the allowlist + return redirect(reverse_lazy("main:entry")) + address_required = drive.require_user_addresses + elif not abbr: return redirect("/entry_state_selection") else: if not any(abbr.upper() in i for i in STATES): return redirect("/entry_state_selection") + print("making new community") comm_form = self.community_form_class( initial=self.get_initial(), label_suffix="" ) - addr_form = self.address_form_class( - initial=self.get_initial(), label_suffix="" - ) + addr_form = self.address_form_class( + initial=self.get_initial(), label_suffix="" + ) has_token = False if kwargs["token"]: has_token = True - address_required = True - has_drive = False - organization_name = "" - organization_id = None - drive_name = "" - drive_slug = "" - drive_id = None - drive_custom_question = "" - drive_custom_question_example = "" if kwargs["drive"]: has_drive = True drive_slug = self.kwargs["drive"] @@ -1168,18 +1211,42 @@ def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): } return render(request, self.template_name, context) - def post(self, request, *args, **kwargs): + def post(self, request, edit_hash=None, *args, **kwargs): # for creation of BlockGroup and CensusBlock objects STATES_USING_OLD_UNITS = ["il", "ok"] + if edit_hash: + query = Signature.objects.filter(edit_hash=edit_hash) + + if not query: + return redirect("/404.html") + signature = query[0] + entry_id = signature.entry_id - comm_form = self.community_form_class(request.POST, label_suffix="") - addr_form = self.address_form_class(request.POST, label_suffix="") + query = CommunityEntry.objects.filter(id=entry_id) + entry = query[0] + + query = Address.objects.filter(entry_id=entry_id) + address = query[0] + + state = entry.state + + comm_form = self.community_form_class(request.POST, label_suffix="", instance=entry) + addr_form = self.address_form_class(request.POST, label_suffix="", instance=address) + else: + state = self.kwargs["abbr"].lower() + comm_form = self.community_form_class(request.POST, label_suffix="") + addr_form = self.address_form_class(request.POST, label_suffix="") # parse block groups and add to field comm_form.data._mutable = True block_groups = comm_form.data["block_groups"].split(",") census_blocks = comm_form.data["census_blocks"].split(",") + if block_groups == ['[]']: + block_groups = [''] + if census_blocks == ['[]']: + census_blocks = [''] + + # get the year of census units being used -- use for get_or_create function - state = self.kwargs["abbr"].lower() year = 2020 if state in STATES_USING_OLD_UNITS: year = 2010 @@ -1194,6 +1261,11 @@ def post(self, request, *args, **kwargs): for bg in block_groups ] + if comm_form.data["census_blocks_polygon_array"] == '{}': + comm_form.data["census_blocks_polygon_array"] = '' + if comm_form.data["census_blocks"] == '[]': + comm_form.data["census_blocks"] = '' + def flagText(text): API_KEY = os.environ.get("PERSPECTIVE_API_KEY") @@ -1212,7 +1284,7 @@ def flagText(text): # special characters attributeThresholds = [ ("TOXICITY", 0.75), - ("IDENTITY_ATTACK", 0.4), + ("IDENTITY_ATTACK", 0.5), ("INSULT", 0.5), ("PROFANITY", 0.75), ("THREAT", 0.9), @@ -1237,7 +1309,7 @@ def flagText(text): ): return True return False - + is_final = comm_form.data["is_final"] comm_form.data._mutable = False if comm_form.is_valid(): recaptcha_response = request.POST.get("g-recaptcha-response") @@ -1282,25 +1354,19 @@ def flagText(text): entryForm.drive = drive entryForm.organization = drive.organization entryForm.private = drive.private - + elif edit_hash and CommunityEntry.objects.filter(id=Signature.objects.filter(edit_hash=edit_hash)[0].entry_id)[0].drive_id != None: + drive = Drive.objects.filter(id=CommunityEntry.objects.filter(id=Signature.objects.filter(edit_hash=edit_hash)[0].entry_id)[0].drive_id)[0] + entryForm.drive = drive + entryForm.organization = drive.organization + entryForm.private = drive.private + folder_name = drive.slug else: - folder_name = self.kwargs["abbr"] + folder_name = state - entryForm.state = self.kwargs["abbr"].lower() + entryForm.state = state.lower() entryForm.state_obj = State.objects.get( - abbr=self.kwargs["abbr"].upper() + abbr=state.upper() ) - if ( - flagText(comm_form.data["entry_name"]) - or flagText(comm_form.data["user_name"]) - or flagText(comm_form.data["cultural_interests"] + " ") - or flagText(comm_form.data["economic_interests"] + " ") - or flagText(comm_form.data["comm_activities"] + " ") - or flagText(comm_form.data["other_considerations"] + " ") - ): - entryForm.admin_approved = False - else: - entryForm.admin_approved = True if entryForm.organization: if ( self.request.user.is_org_admin(entryForm.organization.id) @@ -1324,6 +1390,7 @@ def flagText(text): ServerSideEncryption="AES256", StorageClass="STANDARD_IA", ) + entryForm.is_final = is_final entryForm.save() comm_form.save_m2m() @@ -1337,6 +1404,7 @@ def flagText(text): finalres["census_blocks_polygon"] = str( entryForm.census_blocks_polygon ) + finalres["census_blocks_polygon"] = shapely.wkt.dumps(shapely.wkt.loads(str(entryForm.census_blocks_polygon)[10:]), rounding_precision=10) finalres["user"] = entryForm.user.email if entryForm.organization: finalres["organization"] = entryForm.organization.name @@ -1346,8 +1414,6 @@ def flagText(text): del finalres["admin_approved"] string_to_hash = str(finalres) - print("finalres: ") - print(finalres) if ( @@ -1367,7 +1433,6 @@ def flagText(text): community_id=finalres["id"], email="AUTOMATIC PROFANITY CHECKER", ) - print(finalres["entry_ID"] + " failed!") addres = dict() if addr_form.is_valid(): @@ -1384,6 +1449,9 @@ def flagText(text): del addres["id"] finalres.update(addres) string_to_hash = str(finalres) + + print("finalres: ") + print(string_to_hash) digest = hmac.new( bytes(os.environ.get("AUDIT_SECRET"), encoding="utf8"), @@ -1391,8 +1459,14 @@ def flagText(text): digestmod=hashlib.sha256, ).digest() signature = base64.b64encode(digest).decode() - sign_obj = Signature(entry=entryForm, hash=signature, edit_hash = uuid.uuid4()) - sign_obj.save() + if edit_hash: + query = Signature.objects.filter(edit_hash=edit_hash) + sig = query[0] + sig.hash = signature + sig.save() + else: + sign_obj = Signature(entry=entryForm, hash=signature, edit_hash = uuid.uuid4()) + sign_obj.save() m_uuid = str(entryForm.entry_ID) if not entryForm.drive: From a8d2cffc8578ff67ea7b079d7f8c4a474b567b78 Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Mon, 2 Aug 2021 15:52:10 -0400 Subject: [PATCH 03/10] version 1.0 of editing --- main/models.py | 2 +- main/static/img/collaborate-active.png | Bin 0 -> 3297 bytes main/static/img/collaborate-icon.svg | 3 + main/static/img/collaborate-inactive.png | Bin 0 -> 3115 bytes main/static/img/collaborate-link.svg | 5 + main/static/img/collaborate-plus.png | Bin 0 -> 1030 bytes main/static/img/collaborate-plus.svg | 1 + main/static/main/css/style.css | 19 +- main/static/main/js/geo.js | 64 ++- main/static/main/js/submission.js | 27 + main/static/main/php/send-email.php | 37 ++ main/templates/main/draft.html | 600 +++++++++++++++++++++++ main/templates/main/entry.html | 70 +++ main/templates/main/entry_privacy.html | 2 + main/templates/main/submission.html | 2 +- main/urls.py | 10 + main/views/main.py | 192 +++++++- 17 files changed, 1027 insertions(+), 7 deletions(-) create mode 100644 main/static/img/collaborate-active.png create mode 100644 main/static/img/collaborate-icon.svg create mode 100644 main/static/img/collaborate-inactive.png create mode 100644 main/static/img/collaborate-link.svg create mode 100644 main/static/img/collaborate-plus.png create mode 100644 main/static/img/collaborate-plus.svg create mode 100644 main/static/main/php/send-email.php create mode 100644 main/templates/main/draft.html diff --git a/main/models.py b/main/models.py index 28e272135..bdbbd5976 100644 --- a/main/models.py +++ b/main/models.py @@ -497,4 +497,4 @@ def unapprove(self): self.community.save() -# ******************************************************************************# +# ******************************************************************************# \ No newline at end of file diff --git a/main/static/img/collaborate-active.png b/main/static/img/collaborate-active.png new file mode 100644 index 0000000000000000000000000000000000000000..7dd62e0281e9ef547cf9d92af780255cc1ac1982 GIT binary patch literal 3297 zcmV<73?B1|P)z@U63#5SU-*s93vq%Gi;2Kufj9x?1kaoRJ7P8y*aJQR_6cmTJhQ|;0p(*)7G4tqO8Gssl=k>*fg%)G%336J?8W0`xrV@8T z#NVE6{dS^jU)1x`0TPmeh`%#}^`b$EVzLJoCps=$vPuJ}`D(CE44xpss?pa-)F;Fa z5d8s!JwV<=#(JF9`j?lN{oeL%vChnXV~Jc`tiy2FK%hDhYXDM%A>JpV79a-JtQZ

0pUX!^bY|SBaDW6b!0-jYc!7`p5%qzw6Bv!&bH_RT_>W(ES-pfYWZ#Kothic+p4pIu;lqB>=|+a8k5t8LL{Lbv;qyN=kh zp6h|a9(R8{%Hu=J9H5oM@6Q=JIx$@%?=>0Z8mQes!ETDno#XA72bd z&*w#*nKD)*O&#vKkF!vDsR5d1Rvc;A#9Bx``8!J(IDTem_M+*Jl6YHs%qzU~v^GkHz=?*4dS zt68i8YPP?9kT;-W<9P#45DpbcVjp<6x%|lHqqPD^wa*b|^mSKjF+RPJy0hIU83QCd z1V}uvOD2HM+2-;Cn=j(JwQaTsA7sOU0Jcp%4n_cpb*HxAeDJ$(uA3>H^uucHo!9^8 zI3FYvyw6?tfyqYJ2%u*B+o!-rl&H^#L!%cYo!C|CH#Nb9B>6Y9ovwlQ(E_9j8Q6&E zRbq6SxlBC{dx0^CcDq}*)Zv(E!&rc($bXUuJL+yOZ=@miy7pD=k+|#LiBom40Nra3 z-jOe<<7VAS_i3rtBc16T3D6|D177<{;v6xcooMp`ffW7YK(jC?CN`REoqtTTa(S9w4QLgPAHdHBHY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@T?k zc+88aqf=VprK*FfG74<#P#8 z5(5+uQu5;BRbjXd9eG}voeCh0B=rg4>R+~g`288iyV5{SCFU6;SdY9S#~@^&Q)6+@a|Otgrkdlt_FwlY6GVt7 zz(?ZJ_LDS|$*S+PfX0isIt{`QAlKcZ>Wg=4u8Hh>892UkN0G)E8$(*oty{()NUA#z&N-SRaC zhQn^r_sA9wkRK?nZ}RBjE3Vs4~sd3X6UJX=*S5 zoD`+XqKGUVAU|Q^tPF^2ILiP_6sBeDgmZperP5}V0>}@RcOxSrJ|v=6=F&CUSay); zJqI`~TTh^Kj52&Kp3i0Z0voc%LTTiaHS0LjX=nHTMBP{P)B^jpz>$YuAF) fDXTWNt-k#~%h(%mRc4v*00000NkvXXu0mjfFkc<> literal 0 HcmV?d00001 diff --git a/main/static/img/collaborate-icon.svg b/main/static/img/collaborate-icon.svg new file mode 100644 index 000000000..e4386b912 --- /dev/null +++ b/main/static/img/collaborate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/main/static/img/collaborate-inactive.png b/main/static/img/collaborate-inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..2fefc2b48708aafcf4a7291875482f8a180bdc0f GIT binary patch literal 3115 zcmV+`4Ak?9P)<9&iO6? z;J@+jUHrc~6#$rX&gYCV`De-)`&tym?D6q&_UY3n{D1Es=qrVXhll$~lDr0heFR1a zpefw~z$xeaOHmXzS65dzO~;JUzc&CK931TK?Ck6f27`A1a1a`hI_3$$u8X4he0h0! zUDv*?-#Z5gC1o%e`~(2UZG&QBvIHy7^YgAHt22Ox!{IRiykm^*+kB16lJpk<%syUni5v*oMx~ZCVFN0P~SC zhKw^l@+(&Mh*`+V4~N4&#@HV2ag4Fob@VXCW}NfWwt;F5AhDGFR>cSer6`K?BuTC> zE-qT#v`3@SKIi<{0<2bniVhH}$AiHDfvH-`ZUEr4ZBR@SIU0=)7-R1^=lHkjxykeV z{ngb~P|4O`78Ri3aQG1bPN*45X(@{0EcPUQmqzh%A^o^lk`L$nWH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+g&uGp!E>dHOD6zc z3U9@(UgQtQ5dh#GH3tB>U;TyuetdkK##WE5z7mT@{|6;dQlbWn#G?QJ002ovPDHLk FV1h<*+&lmP literal 0 HcmV?d00001 diff --git a/main/static/img/collaborate-link.svg b/main/static/img/collaborate-link.svg new file mode 100644 index 000000000..47b4925ee --- /dev/null +++ b/main/static/img/collaborate-link.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/main/static/img/collaborate-plus.png b/main/static/img/collaborate-plus.png new file mode 100644 index 0000000000000000000000000000000000000000..d28e66944cb54d5fff3eeb8bb9ed9d807fb5bc08 GIT binary patch literal 1030 zcmV+h1o``kP)h~UBef7OpuZz&| z>GgW&udc3M7ecs_h%O?cZOnX@ng3Qw{nBo?f9Uu7|27Fvb)350?)DIZ0k99iO%;4k z0XU|V@`J(P_X_s8NhMHP>#LMf&oJ};s)5UPM07NS@Jg0tKhKIW6O=LL0DwcqKtyyJ zz{dbi648&XR_m{RzkjyZ>unp4$CohkH2`)3*vrh!{K-X)@Y z3ju~i^oDcphGC zcE*@niRf@KCK25?O=}aNVpg3<&dmIFmSvAL1ylCZTE9g^59fj=I^Ax!Zz(f20ZMCq zENvMxzm{d$Q}Y6p;%Kd3C88%~EL)jnnPl_Yvkp{I)bnO&GsXa{6aN}0NqZvtDbebj zyP+yW#+W{UYl-MP=iK8}{j9a$7i4mEDi>>@thGl9b?CM_qPEt4#mqMY_}qJcdsR>( ze({M!9CgkuuNBW&seg;XhTeN!HL%z<1tq@5m@JhGrPO7TjX6_AEfLYKI&~=ee+^() zU8drKq>ge6U5`X}z|A?Mt4b+)d^ z6cHVF&fQVh-&*?;GanScPN#DLS!;JQ^Oq6SJIO|rG4t^(%bI|?o0&h181|6X zdOr~zkqM>L6@$Ux*9M?O6QYeqpt{}e?WbVpXP=LkI$DOhl{lpMElC<_iHV0g%=H z0U);_qHzczw-q}gdfhoUoXONYG^MqcW^V_8&%F0{)@5`;Q*+8bY5E$2vevH8zB$#Y z1nN`o{atmLny6E;_-(bKZxz(~iaw{aFJBaZ+DyeBe)8-MSQkE!_Q75!^!E \ No newline at end of file diff --git a/main/static/main/css/style.css b/main/static/main/css/style.css index 914862e00..cbb6b6d1c 100644 --- a/main/static/main/css/style.css +++ b/main/static/main/css/style.css @@ -2,8 +2,8 @@ Name: style.css Project: Representable Version: 1.0 -Modified: 5/30/2019 -Authors: S. Arora, K. Barnes, P.Iyer, L. Johnston, T. Marcu +Modified: 7/30/2021 +Authors: S. Arora, K. Barnes, P.Iyer, L. Johnston, T. Marcu, N. Shapiro ----------------------------------------------------------------------*/ /* IMPORTANT - READ BELOW BEFORE ADDING - IMPORTANT*/ @@ -33,6 +33,21 @@ Bootstrap is better in that case. https://getbootstrap.com/docs/4.5/getting-star justify-content: center; } +.collaboration-notification { + position: fixed; + bottom: 0; + left: auto; + right: 0; + z-index: 100; + /* display: none; */ + background-color: #DAEFFF; +} + +.collaboration-notification p.small { + font-size: 75%; + line-height: 95%; +} + /* Entry Form CSS */ form:invalid { border-color: red; diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index eeae89efc..ba031469d 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -21,6 +21,7 @@ // GEO Js file for handling map drawing. /* https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/ */ + var bg_id = "GEOID"; // census FIPS code for block group var block_id = "GEOID20"; // census FIPS code for block var unit_id = bg_id; // abstracted - current unit @@ -375,6 +376,7 @@ function surveyP2ToMap() { animateStepForward(2, 3, 4); $("#2to3").removeClass("h-75"); automaticScrollToTop(); + document.getElementById('collaborationBar').style = "display: none;"; } function mapToSurveyP2() { @@ -386,6 +388,7 @@ function mapToSurveyP2() { $("#2to3").addClass("h-75"); }, 600); automaticScrollToTop(); + document.getElementById('collaborationBar').style = "visibility: visible"; } function mapToPrivacy() { @@ -395,6 +398,7 @@ function mapToPrivacy() { $("#entry_survey").addClass("d-none"); animateStepForward(3, 4, 5); automaticScrollToTop(); + document.getElementById('collaborationBar').style = "visibility: visible"; } function privacyToMap() { @@ -692,7 +696,12 @@ function backupFormValidation() { function createCommPolygon() { // start by checking size -- 800 is an arbitrary number // it means a community with a population between 480,000 & 2,400,000 - var polyFilter = JSON.parse(sessionStorage.getItem("bgFilter")); + if(JSON.parse(sessionStorage.getItem("bgFilter")) === null && !isEmptyFilter(map.getFilter(state + "-highlighted-" + layer_suffix))){ + var polyFilter = map.getFilter(state + "-highlighted-" + layer_suffix); + } + else if (JSON.parse(sessionStorage.getItem("bgFilter")) !== null){ + var polyFilter = JSON.parse(sessionStorage.getItem("bgFilter")); + } if (polyFilter === null) { triggerMissingPolygonError(); @@ -1369,6 +1378,59 @@ map.on("style.load", function () { } sessionStorage.setItem("prev_state", state); + console.log(polygon); + census_blocks = census_blocks.split("' "); + block_groups = block_groups.split("'"); + toDisplay = ["in", "GEOID"]; + if(census_blocks.length > 1 || block_groups.length > 1){ + if (census_blocks.length > 1){ // if there are census blocks + let i = 1; + while (i < census_blocks.length){ + toDisplay[(i+3)/2] = parseInt(census_blocks[i]); + i+=2; + } + } + else { // (block_groups.length > 1) if there are block groups + let i = 1; + while (i < block_groups.length){ + toDisplay[(i+3)/2] = block_groups[i]; + i+=2; + } + } + + map.setFilter(state + "-highlighted-" + layer_suffix, toDisplay); + + polygon = polygon.slice(20).slice(0,-2).split(", "); + for(let i = 0; i < polygon.length; i++){ + polygon[i] = polygon[i].split(" "); + } + + var north = polygon[0][1]; + var south = polygon[0][1]; + var east = polygon[0][0]; + var west = polygon[0][0]; + + for(let i = 0; i < polygon.length; i++){ + if (north < parseFloat(polygon[i][1])){ + north = parseFloat(polygon[i][1]); + } + if (south > parseFloat(polygon[i][1])){ + south = parseFloat(polygon[i][1]); + } + if (east < parseFloat(polygon[i][0])){ + east = parseFloat(polygon[i][0]); + } + if (west > parseFloat(polygon[i][0])){ + west = parseFloat(polygon[i][0]); + } + } + // console.log("("+east+", "+north+"), ("+west+", "+south+")"); + map.fitBounds([ + [west, south], // southwestern corner of the bounds + [east, north] // northeastern corner of the bounds + ]); + } + // When the user moves their mouse over the census shading layer, we'll update the // feature state for the feature under the mouse. var bgID = null; diff --git a/main/static/main/js/submission.js b/main/static/main/js/submission.js index 75b93b9f2..09e552388 100644 --- a/main/static/main/js/submission.js +++ b/main/static/main/js/submission.js @@ -17,6 +17,33 @@ function toggleAngle(e) { } } +function toggleGrayScale(){ + if (document.getElementById("collaborationButton").style.filter == "grayscale(100%)"){ + document.getElementById("collaborationButton").style.filter = "grayscale(0%)"; + } + else{ + document.getElementById("collaborationButton").style.filter = "grayscale(100%)"; + } +} + +function copyEditLink() { + var message; + var link = document.getElementById("edit-link").innerText; + console.log(link); + navigator.clipboard.writeText(link).then(function() { + message = "Copied to clipboard!"; + copyText.innerHTML = message; + }, function(err) { + message = "There was an error, please try again later"; + copyText.innerHTML = message; + }); + + // set text to say "copied!" for feedback mechanism that the copying worked + var copyText = document.getElementById("copy-link-text"); + + setTimeout(function () { copyText.innerHTML = '🔗 Copy Link' }, 2000); +} + /*------------------------------------------------------------------------*/ /* JS file from mapbox site -- display a polygon */ /* https://docs.mapbox.com/mapbox-gl-js/example/geojson-polygon/ */ diff --git a/main/static/main/php/send-email.php b/main/static/main/php/send-email.php new file mode 100644 index 000000000..a712e3442 --- /dev/null +++ b/main/static/main/php/send-email.php @@ -0,0 +1,37 @@ +special = $special; + $this->message = $message; + $this->response = $response; + $this->data = $data; + } + + function spit() { + echo(json_encode($this)); + } +} + +$op = ''; +if (isset($_GET['op'])) { + $op = $_GET['op']; +} +else if (isset($_POST['op'])) { + $op = $_POST['op']; +} + + +$headers = 'From:'. $from . "\r\n"; // Set from headers + + +mail($op, "Make a map on Reprsentable!", "test", $headers); + +$rval = new AjaxResponse(false, $op, 'email sent!', array()); +$rval->spit(); + +?> \ No newline at end of file diff --git a/main/templates/main/draft.html b/main/templates/main/draft.html new file mode 100644 index 000000000..6c8b84b2d --- /dev/null +++ b/main/templates/main/draft.html @@ -0,0 +1,600 @@ +{% extends 'main/base.html' %} +{% load leaflet_tags %} +{% load static %} +{% load representable_extras %} +{% load i18n %} + + +{% block head %} +{% leaflet_js %} +{% leaflet_css %} + + + +View Map + + + + + + + + + + + + + + + + + + + + +{% endblock %} +{% block content %} +

+
+
+ +
+ {% if entries is None %} + + {% endif %} +
+
+
+
+
+

This is a draft map.

+

Add collaborators so they can edit your map.

+
+
+ + +
+
+
+
+
+
+
+ +
nathanshap@gmail.com
+
+
+
+
+
+

Copy Link

+
+
+ +
+ + +
+ +
+
+

Anyone with the link can edit this map, however only the creator may officially submit the map. Changes to the map will be reflected here when you open your map on Representable.

+
+
+
+
+
+
+
+
+
+
+
+

{{c.entry_name}}

+
{{c.drive.name}}
+

{% trans "Community Information" %}

+
+ +
+

+ {{c.comm_activities}} +

+
+
+
+ +
+

+ {{c.cultural_interests}} +

+
+
+
+ +
+

+ {{c.economic_interests}} +

+
+
+
+ +
+

+ {{c.other_considerations}} +

+
+
+ {% if c.drive and c.drive.custom_question %} +
+ +
+

+ {{c.custom_response}} +

+
+
+ {% endif %} +
+
+
+
+
{% trans "Download this draft" %}
+

+ {% blocktrans trimmed %} + Map downloads include the community information above. + {% endblocktrans %} +

+
+
+ + + + + + +
+ {% if has_state %} + +
+ +
+ + {% else %} + +
+ +
+ {% endif %} +
+ +
+
+ +
+
+
+
+ + +
+
+
+
+
+
+

{{c.entry_name}}

+
{{c.drive.name}}
+
+
+
+
+
+
+
{% trans "Data Layers" %}
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
{% trans "Election Data" %}
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
{% trans "Demographics" %}
+
+ {% if c.population > 0 %} + Population: {{ c.population }} +
+ {% else %} + {% trans "Demographic information will become available with the release of 2020 Census data by the US Census Bureau." %} + {% endif %} +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+ + {% if is_owner %} + + {% else %} + + {% endif%} +
+
+
+
+
+
+
+ + +
+ {% blocktrans trimmed %} This map was created at Representable.org {% endblocktrans %} +
+
+ {% if c.economic_interests %} +

+
+ {% trans "Economic or Environmental Interests" %} +

+ + {{c.economic_interests}} + + {% endif %} + {% if c.comm_activities %} +

+
+ {% trans "Community Activities and Services" %} +

+ + {{c.comm_activities}} + + {% endif %} + {% if c.cultural_interests %} +

+
+ {% trans "Cultural or Historical Interests" %} +

+ + {{c.cultural_interests}} + + {% endif %} + {% if c.other_considerations %} +

+
+ {% trans "Community Needs and Concerns" %} +

+ + {{c.other_considerations}} + + {% endif %} + {% if c.custom_response %} +
+
+ + {{ c.drive.custom_question }} +
+ + {{c.custom_response}} + + {% endif %} +
+ {% if c.drive %} +
{{c.organization}}
+
{{c.drive}}
+ {% endif %} +{% endblock %} + + {% block script %} + + + + + + + + {% endblock %} \ No newline at end of file diff --git a/main/templates/main/entry.html b/main/templates/main/entry.html index 3b4c9b94a..db2fc9785 100644 --- a/main/templates/main/entry.html +++ b/main/templates/main/entry.html @@ -41,6 +41,9 @@ var address_required = "{{address_required}}"; var census_key = "{{ census_key }}"; var language = "{{LANGUAGE_CODE}}"; + var census_blocks = "{{ census_blocks }}"; + var block_groups = "{{ block_groups }}"; + var polygon = "{{ polygon }}"; mixpanel.track("Entry Page Loaded", { "drive_id": drive_id, @@ -49,6 +52,7 @@ "organization_name": organization_name, } ); + @@ -56,6 +60,58 @@ {% block content %} +
+ +
+{% if edit_hash == None %} + +{% endif %} + +
+ {% if edit_hash == None %} +
+ +
+
+
+
+ +
+
+ Collaborate +
+
+ +
+ {% endif %} +
+ +
{% csrf_token %} @@ -207,4 +263,18 @@
+ {% endblock %} \ No newline at end of file diff --git a/main/templates/main/entry_privacy.html b/main/templates/main/entry_privacy.html index 7f706f601..92c169e0a 100644 --- a/main/templates/main/entry_privacy.html +++ b/main/templates/main/entry_privacy.html @@ -106,7 +106,9 @@

+ {% if show_submit %} + {% endif %}

diff --git a/main/templates/main/submission.html b/main/templates/main/submission.html index 2289fe6a9..cd4093038 100644 --- a/main/templates/main/submission.html +++ b/main/templates/main/submission.html @@ -50,7 +50,7 @@

{{c.entry_name}}

{{c.drive.name}}
{% if c.is_final is False or 86400 > time_difference %} - + {% endif %} diff --git a/main/urls.py b/main/urls.py index f9bb46123..bf6ebf179 100644 --- a/main/urls.py +++ b/main/urls.py @@ -124,6 +124,16 @@ views.main.Submission.as_view(), name="submission_thanks", ), + path( + "draft//", + views.main.Draft.as_view(), + name="draft", + ), + path( + "submit//", + views.main.Submit.as_view(), + name="submit", + ), # path("blog/", views.main.Blog.as_view(), name="blog"), path("export/geojson/", views.main.ExportView.as_view(), name="export"), path("export/csv/", views.main.ExportView.as_view(), name="export"), diff --git a/main/views/main.py b/main/views/main.py index 2dc46d660..56eb035c2 100644 --- a/main/views/main.py +++ b/main/views/main.py @@ -514,6 +514,7 @@ def post(self, request, *args, **kwargs): raise Http404 user_map = query[0] + if user_map.drive: state = "" else: @@ -561,6 +562,10 @@ def get(self, request, *args, **kwargs): # query will have length 1 or database is invalid user_map = query[0] + if not user_map.is_final: + query = Signature.objects.filter(entry_id = user_map.id) + return redirect("/draft/"+str(query[0].edit_hash)) + if user_map.drive: folder_name = query[0].drive.slug # has_state = False @@ -810,6 +815,161 @@ def make_geojson_for_state_map_page(request, entry): # ******************************************************************************# +class Draft(View): + template_name = "main/draft.html" + + def get(self, request, edit_hash, *args, **kwargs): + if not edit_hash: + raise Http404 + query = Signature.objects.filter(edit_hash=edit_hash) + if not query: + raise Http404 + + # query will have length 1 or database is invalid + signature = query[0] + query = CommunityEntry.objects.filter(id=signature.entry_id) + user_map = query[0] + + if user_map.is_final: + return redirect("/submission/"+str(user_map.entry_ID)) + + if user_map.drive: + folder_name = query[0].drive.slug + # has_state = False + # state = "" + has_state = user_map.state != "" + state = user_map.state + else: + if "abbr" in self.kwargs: + folder_name = self.kwargs["abbr"] + has_state = True + state = folder_name + else: + has_state = user_map.state != "" + state = user_map.state + folder_name = state + + entryPolyDict = {} + + if ( + user_map.census_blocks_polygon == "" + or user_map.census_blocks_polygon is None + and user_map.user_polygon + ): + s = "".join(user_map.user_polygon.geojson) + elif user_map.census_blocks_polygon: + s = "".join(user_map.census_blocks_polygon.geojson) + else: + raise Http404 + map_poly = geojson.loads(s) + entryPolyDict[user_map.entry_ID] = map_poly.coordinates + comm = user_map + + # get user email address + if self.request.user.is_authenticated: + user_email_address = EmailAddress.objects.get( + user=self.request.user + ) + else: + user_email_address = "" + + is_owner = self.request.user.id == comm.user_id + + + context = { + "has_state": has_state, + "state": state, + "c": comm, + "edit_hash": Signature.objects.filter(entry_id=comm.id)[0].edit_hash, + "time_difference": (datetime.datetime.now() - comm.created_at.replace(tzinfo=None)).total_seconds(), + "entries": json.dumps(entryPolyDict), + "mapbox_key": os.environ.get("DISTR_MAPBOX_KEY"), + "mapbox_user_name": os.environ.get("MAPBOX_USER_NAME"), + "map_id": user_map.entry_ID, + "email": user_email_address, + "is_owner": is_owner, + } + + # from thanks view + context["is_thanks"] = False + if "thanks" in request.path: + context["is_thanks"] = True + has_drive = False + organization_name = "" + drive_name = "" + organization_slug = "" + if kwargs["drive"]: + has_drive = True + drive_slug = self.kwargs["drive"] + drive = Drive.objects.get(slug=drive_slug) + drive_name = drive.name + organization = drive.organization + organization_name = organization.name + organization_slug = organization.slug + + if ( + self.request.user.is_authenticated + and EmailAddress.objects.filter( + user=self.request.user, verified=True + ).exists() + ): + context["verified"] = True + + elif self.request.user.is_authenticated: + user_email_confirmation = EmailConfirmationHMAC( + email_address=user_email_address + ) + + user_email_confirmation.send(self.request, False) + context["verified"] = False + + context["drive_slug"] = self.kwargs["drive"] + context["has_drive"] = has_drive + context["organization_name"] = organization_name + context["organization_slug"] = organization_slug + context["drive_name"] = drive_name + + # if self.request.user.is_authenticated: + # if user_map.organization: + # context["is_org_admin"] = self.request.user.is_org_admin( + # user_map.organization_id + # ) + # if self.request.user == user_map.user: + # for a in Address.objects.filter(entry=user_map): + # context["street"] = a.street + # context["city"] = a.city + ", " + a.state + " " + a.zipcode + # context["is_community_author"] = ( + # self.request.user == user_map.user + # ) + # comm.user_name = user_map.user_name + + return render(request, self.template_name, context) + +# ******************************************************************************# + +class Submit(TemplateView): + template = "draft.html" + + def get(self, request, edit_hash, *args, **kwargs): + if not edit_hash: + raise Http404 + query = Signature.objects.filter(edit_hash=edit_hash) + if not query: + raise Http404 + sig = query[0] + + query = CommunityEntry.objects.filter(id=sig.entry_id) + entry = query[0] + + is_owner = self.request.user.id == entry.user_id + + if is_owner: + entry.is_final = True + entry.save() + return redirect("/draft/"+edit_hash) + + + class ExportView(TemplateView): template = "main/export.html" @@ -1072,6 +1232,10 @@ def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): drive_custom_question = "" drive_custom_question_example = "" + census_blocks = [] + block_groups = [] + polygon = None + if edit_hash: query = Signature.objects.filter(edit_hash=edit_hash) @@ -1091,6 +1255,13 @@ def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): created_at = entry.created_at.replace(tzinfo=None) entry_ID = entry.entry_ID + for census_block in entry.census_blocks.all(): + census_blocks.append(census_block.census_id) + for block_group in entry.block_groups.all(): + block_groups.append(block_group.census_id) + + polygon = entry.census_blocks_polygon + current_time = datetime.datetime.now() # if more than 24 hrs. since community submitted @@ -1187,6 +1358,8 @@ def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): return redirect(reverse_lazy("main:entry")) address_required = drive.require_user_addresses + show_submit = not (edit_hash and self.request.user.id != entry.user_id) + context = { "comm_form": comm_form, "addr_form": addr_form, @@ -1195,6 +1368,11 @@ def get(self, request, abbr=None, edit_hash=None, *args, **kwargs): "recaptcha_public": settings.RECAPTCHA_PUBLIC, "check_captcha": settings.CHECK_CAPTCHA_SUBMIT, "census_key": os.environ.get("CENSUS_API_KEY"), + "edit_hash": edit_hash, + "show_submit": show_submit, + "census_blocks": census_blocks, + "block_groups": block_groups, + "polygon": polygon, "has_token": has_token, "has_drive": has_drive, "organization_name": organization_name, @@ -1228,6 +1406,8 @@ def post(self, request, edit_hash=None, *args, **kwargs): query = Address.objects.filter(entry_id=entry_id) address = query[0] + user_id = entry.user_id + state = entry.state comm_form = self.community_form_class(request.POST, label_suffix="", instance=entry) @@ -1392,6 +1572,9 @@ def flagText(text): ) entryForm.is_final = is_final + if(edit_hash): + entryForm.user_id = user_id + entryForm.save() comm_form.save_m2m() @@ -1413,6 +1596,10 @@ def flagText(text): finalres["state_obj"] = finalres["state"] del finalres["admin_approved"] + if not edit_hash: + finalres["edit_hash"] = uuid.uuid4() + else: + finalres["edit_hash"] = uuid.UUID(edit_hash) string_to_hash = str(finalres) @@ -1449,7 +1636,8 @@ def flagText(text): del addres["id"] finalres.update(addres) string_to_hash = str(finalres) - + + print("finalres: ") print(string_to_hash) @@ -1465,7 +1653,7 @@ def flagText(text): sig.hash = signature sig.save() else: - sign_obj = Signature(entry=entryForm, hash=signature, edit_hash = uuid.uuid4()) + sign_obj = Signature(entry=entryForm, hash=signature, edit_hash = finalres["edit_hash"]) sign_obj.save() m_uuid = str(entryForm.entry_ID) From b7ce11cd7fcb44b84974415c747922e3e3d27e25 Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Tue, 3 Aug 2021 10:14:00 -0400 Subject: [PATCH 04/10] fixed collapse bug --- main/templates/main/draft.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/templates/main/draft.html b/main/templates/main/draft.html index 6c8b84b2d..74a33d832 100644 --- a/main/templates/main/draft.html +++ b/main/templates/main/draft.html @@ -23,7 +23,6 @@ - @@ -97,7 +96,7 @@

Add collaborators so they can edit your map.

-
nathanshap@gmail.com
+
@@ -597,4 +596,5 @@
+ {% endblock %} \ No newline at end of file From ac1b2637c22cd52dcadb06dba581ba8f1b4b8e34 Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Tue, 3 Aug 2021 12:26:53 -0400 Subject: [PATCH 05/10] added array split --- main/static/main/js/geo.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index ba031469d..7e1c0c832 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -1379,8 +1379,10 @@ map.on("style.load", function () { sessionStorage.setItem("prev_state", state); console.log(polygon); - census_blocks = census_blocks.split("' "); + census_blocks = census_blocks.split("'"); block_groups = block_groups.split("'"); + census_blocks = census_blocks.split(""); + block_groups = block_groups.split(""); toDisplay = ["in", "GEOID"]; if(census_blocks.length > 1 || block_groups.length > 1){ if (census_blocks.length > 1){ // if there are census blocks From d443ffebcc52a5b07f74ce7943d7a2a921d1b582 Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Tue, 3 Aug 2021 12:30:58 -0400 Subject: [PATCH 06/10] mapbox fix --- main/static/main/js/geo.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index 7e1c0c832..2644c9f5b 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -1379,10 +1379,17 @@ map.on("style.load", function () { sessionStorage.setItem("prev_state", state); console.log(polygon); - census_blocks = census_blocks.split("'"); - block_groups = block_groups.split("'"); - census_blocks = census_blocks.split(""); - block_groups = block_groups.split(""); + if (census_blocks.includes("'")){ + census_blocks = census_blocks.split("'"); + block_groups = block_groups.split("'"); + } + else if (census_blocks.includes("")){ + census_blocks = census_blocks.split(""); + block_groups = block_groups.split(""); + } + else{ + window.alert("A problem has occurred. Please notify team@representable.org if you have any issues"); + } toDisplay = ["in", "GEOID"]; if(census_blocks.length > 1 || block_groups.length > 1){ if (census_blocks.length > 1){ // if there are census blocks From f978848b32f6bff83ac148704efc6f6cbbe3aa46 Mon Sep 17 00:00:00 2001 From: Kyle Barnes Date: Tue, 3 Aug 2021 12:48:22 -0400 Subject: [PATCH 07/10] fix split for block groups string --- main/static/main/js/geo.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index 2644c9f5b..7ee8568e1 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -1378,17 +1378,12 @@ map.on("style.load", function () { } sessionStorage.setItem("prev_state", state); - console.log(polygon); - if (census_blocks.includes("'")){ + if (census_blocks.includes("'") || block_groups.includes("'")){ census_blocks = census_blocks.split("'"); block_groups = block_groups.split("'"); - } - else if (census_blocks.includes("")){ - census_blocks = census_blocks.split(""); - block_groups = block_groups.split(""); - } - else{ - window.alert("A problem has occurred. Please notify team@representable.org if you have any issues"); + } else if (census_blocks.includes("x27") || block_groups.includes("x27")){ + census_blocks = census_blocks.split("'"); + block_groups = block_groups.split("'"); } toDisplay = ["in", "GEOID"]; if(census_blocks.length > 1 || block_groups.length > 1){ @@ -1413,12 +1408,12 @@ map.on("style.load", function () { for(let i = 0; i < polygon.length; i++){ polygon[i] = polygon[i].split(" "); } - + var north = polygon[0][1]; var south = polygon[0][1]; var east = polygon[0][0]; var west = polygon[0][0]; - + for(let i = 0; i < polygon.length; i++){ if (north < parseFloat(polygon[i][1])){ north = parseFloat(polygon[i][1]); From d281316d8a119847012b72dbf5baadf979e4c38b Mon Sep 17 00:00:00 2001 From: Kyle Barnes Date: Tue, 3 Aug 2021 16:49:17 -0400 Subject: [PATCH 08/10] various small fixes --- main/static/img/collaborate-link.png | Bin 0 -> 1370 bytes main/static/img/collaborate-link.svg | 5 --- main/static/img/collaborate-plus.png | Bin 1030 -> 1086 bytes main/static/img/collaborate-plus.svg | 1 - main/static/main/css/style.css | 4 ++ main/static/main/js/submission.js | 10 ++--- main/templates/main/draft.html | 65 +++++++++++++-------------- 7 files changed, 40 insertions(+), 45 deletions(-) create mode 100644 main/static/img/collaborate-link.png delete mode 100644 main/static/img/collaborate-link.svg delete mode 100644 main/static/img/collaborate-plus.svg diff --git a/main/static/img/collaborate-link.png b/main/static/img/collaborate-link.png new file mode 100644 index 0000000000000000000000000000000000000000..b5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6WLY&Li(umE__4IyUi9QI*)y)d}_|p6O(u{ ziEj;uOf`A+_7h+lsd*v<(|36{rXqh`lE7*aLGdTWr}U+On}ON+=f(VS@sq{+^?Xxm zuUs1D|5Ts`|C|g<&-Z`ICaWGNxJm&LCiLU;^YivFm)oI0*+fsmRjR@oU#0$evK#`C ck^g!A0_yv~>^_Ni-2eap07*qoM6N<$f|$;NP5=M^ literal 0 HcmV?d00001 diff --git a/main/static/img/collaborate-link.svg b/main/static/img/collaborate-link.svg deleted file mode 100644 index 47b4925ee..000000000 --- a/main/static/img/collaborate-link.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/main/static/img/collaborate-plus.png b/main/static/img/collaborate-plus.png index d28e66944cb54d5fff3eeb8bb9ed9d807fb5bc08..dd122be85211a89ba56e421b259c262c1e0c5c0c 100644 GIT binary patch delta 1066 zcmV+_1l9Y72)+oABYyx1a7bBm000XU000XU0RWnu7ytkO0drDELIAGL9O(c600d`2 zO+f$vv5yPTSG#EI!R3CSlVo_`t7&*yn>-p`b1Kvb*M z%FN7+>o|@=RT;11mzS6L{{B8{x7*h=07^wVGm+WZ*{xEkwY4=hH8oX7(Wk-D1i6L{x&M;d+}zy4BY1s%tr*QA>c1hn@agF(G8bB3UuTh4 zAi^qk^edWNbALXJ3yzMC8Z-zg7S-I`+z;v&Q;3Bc2L}fsS%OJo%r=VO%z3bDwY**H zOG?CbN^c4rW8zv7GB$I9*h)WQj>X{C?d|RIFoYPq`1JJjGCpoknv!*V->+o*ma`4$ zxUUI8{td`Kpb??jY_f^ihMrzyZaz5b@$r#WWTlIPS${$2^n_v19teG>55UF6MYy!I z^qD$`KrJjR{JpxmI@j-0@v+$WWJoo>ySoc4*PxA!jeY!1@!PQ-15vW_#|a6?sq^|h zq{I#-UO zF@o)$v48e$7gKOm2Sw>Cw8iMRLwTX|C3Qw@^sl|Wrpi_B%w=~ zd7ro-j7$6XxS1TVr>|S|WBv5=USbzoWC2@J{eKV}WyOCW&OR-x0@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W1NK)&2n>w;`f&2qCu>J0g1BIX9fi)I2n$ zwU%aY2Y}DK_jlH1bV5^e%06lO8iTUduFt+X)u{yPQ}6v`>6t`PrUbgt7>Y~eoBIDvGaTsz@-4r zc<i6z!vhmPk=4l7joLhg}X~AX3s+1x)gye-2GG$+(O;t fO)G}~=bh&{A-&4fe~zg{00000NkvXXu0mjfup;?& diff --git a/main/static/img/collaborate-plus.svg b/main/static/img/collaborate-plus.svg deleted file mode 100644 index 5ec7d8081..000000000 --- a/main/static/img/collaborate-plus.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/main/static/main/css/style.css b/main/static/main/css/style.css index cbb6b6d1c..4a0674116 100644 --- a/main/static/main/css/style.css +++ b/main/static/main/css/style.css @@ -393,6 +393,10 @@ Entry Preview Page #entry_preview_button { padding-top: 20px; } + + #collaborationButton { + width: 100%; + } } input[type="range"]::-webkit-slider-thumb { diff --git a/main/static/main/js/submission.js b/main/static/main/js/submission.js index 09e552388..a2e68f981 100644 --- a/main/static/main/js/submission.js +++ b/main/static/main/js/submission.js @@ -40,7 +40,7 @@ function copyEditLink() { // set text to say "copied!" for feedback mechanism that the copying worked var copyText = document.getElementById("copy-link-text"); - + setTimeout(function () { copyText.innerHTML = '🔗 Copy Link' }, 2000); } @@ -264,7 +264,7 @@ map.on("load", function () { for (var key in BOUNDARIES_LAYERS) { newBoundariesLayer(key); } - + var outputstr = a.replace(/'/g, '"'); a = JSON.parse(outputstr); var dest = []; @@ -569,7 +569,7 @@ for (var id in toggleableLayerIds) { function updateFeatureState(source, sourceLayer, hoveredStateId, hover) { map.setFeatureState( { source: source, - sourceLayer: + sourceLayer: sourceLayer, id: hoveredStateId }, { hover: hover } @@ -618,7 +618,7 @@ function addToggleableLayer(id, appendElement) { map.setLayoutProperty(txt + "-fills", "visibility", "visible"); visible = txt; } - + } if (visible != null && visible != "sta5") { @@ -636,7 +636,7 @@ function addToggleableLayer(id, appendElement) { } } }); - + map.on('mouseleave', visible + '-fills', function(e) { popup.remove(); if (hoveredStateId !== null) { diff --git a/main/templates/main/draft.html b/main/templates/main/draft.html index 74a33d832..cca6c363c 100644 --- a/main/templates/main/draft.html +++ b/main/templates/main/draft.html @@ -14,7 +14,6 @@ View Map - @@ -79,38 +78,36 @@ {% endif %}
-
+
-
+

This is a draft map.

Add collaborators so they can edit your map.

-
- - +
+ +
-
-
+
+
-
+
-
-
+
+

Copy Link

-
- -
-
+
@@ -132,21 +130,21 @@

Copy Link

{{c.entry_name}}

{{c.drive.name}}

{% trans "Community Information" %}

-
- -
+

{{c.comm_activities}}

-
+
-
+

{{c.cultural_interests}}

@@ -162,22 +160,22 @@

{% trans "Community Information"

-
- -
+

{{c.other_considerations}}

{% if c.drive and c.drive.custom_question %} -
- -
+

{{c.custom_response}}

@@ -318,7 +316,7 @@
{% trans "Community Needs and Concerns" %}
- + {% else %}
@@ -415,11 +413,11 @@
{% trans "Demograp
- + {% if is_owner %} - + {% else %} - + {% endif%}
@@ -596,5 +594,4 @@
- - {% endblock %} \ No newline at end of file + {% endblock %} From d7a36e7490d1b163850b478b1453caa739b0c64d Mon Sep 17 00:00:00 2001 From: nshapiro23 <73450066+nshapiro23@users.noreply.github.com> Date: Wed, 4 Aug 2021 10:46:55 -0400 Subject: [PATCH 09/10] some edit changes (no parsing) --- main/static/main/js/geo.js | 13 ++++++------- main/static/main/js/submission.js | 5 +++-- main/templates/main/draft.html | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index 7ee8568e1..51186dcab 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -377,6 +377,7 @@ function surveyP2ToMap() { $("#2to3").removeClass("h-75"); automaticScrollToTop(); document.getElementById('collaborationBar').style = "display: none;"; + document.getElementById('collaboration-notification').style = "display: none;"; } function mapToSurveyP2() { @@ -411,6 +412,8 @@ function privacyToMap() { privacyCheckValidation(); animateStepBackward(4, 3, 5); automaticScrollToTop(); + document.getElementById('collaborationBar').style = "display: none;"; + document.getElementById('collaboration-notification').style = "display: none;"; } @@ -1378,13 +1381,9 @@ map.on("style.load", function () { } sessionStorage.setItem("prev_state", state); - if (census_blocks.includes("'") || block_groups.includes("'")){ - census_blocks = census_blocks.split("'"); - block_groups = block_groups.split("'"); - } else if (census_blocks.includes("x27") || block_groups.includes("x27")){ - census_blocks = census_blocks.split("'"); - block_groups = block_groups.split("'"); - } + console.log(polygon); + census_blocks = census_blocks.split("'"); + block_groups = block_groups.split("'"); toDisplay = ["in", "GEOID"]; if(census_blocks.length > 1 || block_groups.length > 1){ if (census_blocks.length > 1){ // if there are census blocks diff --git a/main/static/main/js/submission.js b/main/static/main/js/submission.js index a2e68f981..36f277e39 100644 --- a/main/static/main/js/submission.js +++ b/main/static/main/js/submission.js @@ -33,6 +33,7 @@ function copyEditLink() { navigator.clipboard.writeText(link).then(function() { message = "Copied to clipboard!"; copyText.innerHTML = message; + document.getElementById('copy-link-text').style = "cursor: text"; }, function(err) { message = "There was an error, please try again later"; copyText.innerHTML = message; @@ -40,8 +41,8 @@ function copyEditLink() { // set text to say "copied!" for feedback mechanism that the copying worked var copyText = document.getElementById("copy-link-text"); - - setTimeout(function () { copyText.innerHTML = '🔗 Copy Link' }, 2000); + + setTimeout(function () { copyText.innerHTML = '🔗 Copy Link'; document.getElementById('copy-link-text').style = "cursor: pointer"; }, 2000); } /*------------------------------------------------------------------------*/ diff --git a/main/templates/main/draft.html b/main/templates/main/draft.html index cca6c363c..ad76849fd 100644 --- a/main/templates/main/draft.html +++ b/main/templates/main/draft.html @@ -107,7 +107,7 @@

Copy Link

- From 8ab2df0768d8c458a3bfc5a419e9deea34496116 Mon Sep 17 00:00:00 2001 From: Kyle Barnes Date: Thu, 5 Aug 2021 11:40:35 -0400 Subject: [PATCH 10/10] update images to svg, fix mobile compatibility for entry page and draft page, add switch to entry page collaborate button --- main/static/img/collaborate-active.png | Bin 3297 -> 0 bytes main/static/img/collaborate-active.svg | 4 ++ main/static/img/collaborate-inactive.png | Bin 3115 -> 0 bytes main/static/img/collaborate-inactive.svg | 4 ++ main/static/img/collaborate-link.png | Bin 1370 -> 0 bytes main/static/img/collaborate-link.svg | 5 +++ main/static/img/collaborate-plus.png | Bin 1086 -> 0 bytes main/static/img/collaborate-plus.svg | 5 +++ main/static/main/css/style.css | 39 ++++++++++++++++- main/static/main/js/geo.js | 15 +++---- main/templates/main/draft.html | 18 +++++--- main/templates/main/entry.html | 51 +++++++++-------------- main/templates/main/entry_address.html | 2 +- main/templates/main/entry_privacy.html | 14 +++---- main/templates/main/entry_survey.html | 12 +++--- 15 files changed, 111 insertions(+), 58 deletions(-) delete mode 100644 main/static/img/collaborate-active.png create mode 100644 main/static/img/collaborate-active.svg delete mode 100644 main/static/img/collaborate-inactive.png create mode 100644 main/static/img/collaborate-inactive.svg delete mode 100644 main/static/img/collaborate-link.png create mode 100644 main/static/img/collaborate-link.svg delete mode 100644 main/static/img/collaborate-plus.png create mode 100644 main/static/img/collaborate-plus.svg diff --git a/main/static/img/collaborate-active.png b/main/static/img/collaborate-active.png deleted file mode 100644 index 7dd62e0281e9ef547cf9d92af780255cc1ac1982..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3297 zcmV<73?B1|P)z@U63#5SU-*s93vq%Gi;2Kufj9x?1kaoRJ7P8y*aJQR_6cmTJhQ|;0p(*)7G4tqO8Gssl=k>*fg%)G%336J?8W0`xrV@8T z#NVE6{dS^jU)1x`0TPmeh`%#}^`b$EVzLJoCps=$vPuJ}`D(CE44xpss?pa-)F;Fa z5d8s!JwV<=#(JF9`j?lN{oeL%vChnXV~Jc`tiy2FK%hDhYXDM%A>JpV79a-JtQZ

0pUX!^bY|SBaDW6b!0-jYc!7`p5%qzw6Bv!&bH_RT_>W(ES-pfYWZ#Kothic+p4pIu;lqB>=|+a8k5t8LL{Lbv;qyN=kh zp6h|a9(R8{%Hu=J9H5oM@6Q=JIx$@%?=>0Z8mQes!ETDno#XA72bd z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4Ot{AY5|-BkW`U{ z(gSv)*4$s5Uqtm1O<80u1o{RQ2T2*Qi;9KoXPZrntg=W=sVRGnjiXbQ8=_1aDazDV zokcQbbc%L?+~*YIWZE?%)KTY(uss)JK`W%#I)1WhKAd7BEXLyGfIfz<238BCL7;aM^)YdgiW? z=ql|t(@W8Idbw1YrKFY8qbT>LtOKyp9(?i_L9L=|Bn3Q`=o&5>qAq)&1W0xKLsz=7 z60@EYB21-6OeeCEhAc(8(v5S%n@W&rDm}3PsoXJDj-^zB^9DrNmKwDxDl1Ai+7>A? zp!wP~QHAz(n(3x2bAg|SDtfG2+qKo4RF2KEGJgu>W#+F^-F*QDt|l!&f>Ol=5yp29 zWIoe595Cwc3zKSMMgXbr9=KVLOuiLmN}0vo7e)XHLX>w802o~mVKR}c+D3UHR@T?k zc+88aqf=VprK*FfG74<#P#8 z5(5+uQu5;BRbjXd9eG}voeCh0B=rg4>R+~g`288iyV5{SCFU6;SdY9S#~@^&Q)6+@a|Otgrkdlt_FwlY6GVt7 zz(?ZJ_LDS|$*S+PfX0isIt{`QAlKcZ>Wg=4u8Hh>892UkN0G)E8$(*oty{()NUA#z&N-SRaC zhQn^r_sA9wkRK?nZ}RBjE3Vs4~sd3X6UJX=*S5 zoD`+XqKGUVAU|Q^tPF^2ILiP_6sBeDgmZperP5}V0>}@RcOxSrJ|v=6=F&CUSay); zJqI`~TTh^Kj52&Kp3i0Z0voc%LTTiaHS0LjX=nHTMBP{P)B^jpz>$YuAF) fDXTWNt-k#~%h(%mRc4v*00000NkvXXu0mjfFkc<> diff --git a/main/static/img/collaborate-active.svg b/main/static/img/collaborate-active.svg new file mode 100644 index 000000000..1f5894e70 --- /dev/null +++ b/main/static/img/collaborate-active.svg @@ -0,0 +1,4 @@ + + + + diff --git a/main/static/img/collaborate-inactive.png b/main/static/img/collaborate-inactive.png deleted file mode 100644 index 2fefc2b48708aafcf4a7291875482f8a180bdc0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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 zHImebs6H{?hL&Dl6)g#`AZ}h1#p&hcrPXbRHjLK~q5FGXD z%|&-tJE!iQK>-qW5_%jk5udscW38pB>L!*Dm9{9bf&)~eJV+YW3MjFh;YVjmg`URJ zT%!OaQJ_K<+E>zRpoGNy3;@TbD{=tf^y1>5>r*D;Reez$F9Q=9Uv(&A{LL6UfEa`slw_YIB_gML0(%~x2gL6E~}bUNsAbJ z1_19bE-qT3uQh-ifm&#OqO{AGhlhu$Uf$mq2-P&e;(!3~8Vh+?-160lCfYhc8c@bE zmpTB-g@Rb<^=nZS$gnvAd4GRD*KH2m*mrhzcJn;n-P+p1N{uMFKccM$0DBgIND>zH ze`4KyQum>C29Tmi;JKt@0Qkv)X?62z^t((APLkxht)P_F>ez}hd0LhcbROOn;x<&p^iUvRJMT2j_Rf~q)+g&uGp!E>dHOD6zc z3U9@(UgQtQ5dh#GH3tB>U;TyuetdkK##WE5z7mT@{|6;dQlbWn#G?QJ002ovPDHLk FV1h<*+&lmP diff --git a/main/static/img/collaborate-inactive.svg b/main/static/img/collaborate-inactive.svg new file mode 100644 index 000000000..e217748f0 --- /dev/null +++ b/main/static/img/collaborate-inactive.svg @@ -0,0 +1,4 @@ + + + + diff --git a/main/static/img/collaborate-link.png b/main/static/img/collaborate-link.png deleted file mode 100644 index b5e06c7fc56f12e8e95f345902bf058de93b7288..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1370 zcmV-g1*Q6lP)@0ndKGOtN>BPuZlsO6-3N3iv!G~?7*o4 zisGAd+P9UqkcjL6w@Rh%*1g@Q@9q0(mDGq-tybO1$;pc2I3Bv5^(nr;zmKo3uDYF0 zr>91s(lE>fGBq`|St^x$bo~M%T|7H?cXyq`!^2n=q(Y#UmX^G+v9Si4H8nbg0M{%6 z?vJ3>*48%h3LYLFTx&Q&{~Jsf-QM1I?S)oWR%lWeCaglE|6! z0pXpCi;IQ70Yu{B2+$gnw#b=rw72eZ2-akP1rwB&qQGuGDOsIPJ5V} zj^o|j-0+Aj4q&i5U`{*?LR$dzLA?N-oSa1S^Yd?2-wC|g+1a0GXJ=o`_r!cO8$Cn1 z@#W=Zpk9z*N*?}LgK(S%*H>v!5{ESL0FD}sixN#q=aH^!udlsN4)=G%zqhxypH7M5OZ_D=#$f?&RC^XQ-#a=w>SpmW?%~+@vNlZ`81FNI zt(zq*0gyaZYuJ-X=}BEYJ8+DUV>2@|+vq2}07s3);?1EwH$x4+MQHkx0hA+gLZ<=< z9j5^?&4BqUnsotU9wjoaOt=m34QrmrdSc3uXL)(Ko?e3~OPW6Ml##oV+=P79v6(SJ z6#{J$+=7>Mz|RGgiNtaqsg)KM4FK#1&Lm~psm(EeHZVsEG6Piub11$s$10ROl`?>E z2l^vzZ%;&56+pQ`6f!OrXu||bfKet)^TA93csw-MF)y{1XpBjnCYCilh6K-iw9k`e z)?OYU?tWro;wv>O+To@=XzQOWegN*s`(JxJmH#|PzwKEgg>R8leV8wy# zS-@kAvx;o7i#B<`L54tGQ>{w;At>#|I75*Qij}Itz)OcyE|U-d}yc^<;zS$(4=24tt>1^6Gy{3c~;abkQ8<`>4qkVCUFX83zP&m*6De%>A8sIja*R7`pI1| z0VOES2Nv`#^@4;urM@_@O=qxE&A`Rs^z`%#3VL6dD|2&m96MIeOmaanmy!r!VxZD} zbj3oHeg`el8(2Lsv$Kk9W<}{?Np9UO6WLY&Li(umE__4IyUi9QI*)y)d}_|p6O(u{ ziEj;uOf`A+_7h+lsd*v<(|36{rXqh`lE7*aLGdTWr}U+On}ON+=f(VS@sq{+^?Xxm zuUs1D|5Ts`|C|g<&-Z`ICaWGNxJm&LCiLU;^YivFm)oI0*+fsmRjR@oU#0$evK#`C ck^g!A0_yv~>^_Ni-2eap07*qoM6N<$f|$;NP5=M^ diff --git a/main/static/img/collaborate-link.svg b/main/static/img/collaborate-link.svg new file mode 100644 index 000000000..1c7daec3c --- /dev/null +++ b/main/static/img/collaborate-link.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/main/static/img/collaborate-plus.png b/main/static/img/collaborate-plus.png deleted file mode 100644 index dd122be85211a89ba56e421b259c262c1e0c5c0c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1086 zcmV-E1i|}>P)TSG#EI!R3CSlVo*B>2=Xr15&y;9DRIAm>%*>4IIF3S98L#4(mzVhd{yu8A+t)Mz zN<}&|k=fbVtx~Dvq3T%-iSTPZKR>sRkB?)rgcYf^wKX+0HC0E^r@_$#xrPn7|B~9= z+}y$=czu1X7|kK-zahHt>FFsl7g}FmXOUJQ!YX$3E1Fz$K8y>Fj*c2M2q_lT+}zv` z>K0Rog&GG32O(L4Nn*@4ir>t6uxquvUF%Cq#C1w<3LInNS`jifbAs4PKVpu>;MVQ! z?eZ{$7`*uO^z<@5Zcmz$b$s8iWc!x04d}S92|@l1$UmSFq1kM*iP(moUSn=PIO_57 zkyT`+i-TD~=k$bO&>jeVrw_oz#YMQZwDg%ehd?bXEd0H?x;oeIQ}MCb_+&^mzPq~% zEZ3lojg5W$PVw8Z9RpFa^2Z4Y$EoxBJ*31AC13?CXpI$hPN{1$7gKOm2Sw> zCw8iMRLwTX|C3Qw@^sl|Wrpi_B%w=~d7ro-j7$6XxS1TVr>|S|WBv5=USbzoWC2@J z{SX^v#eX2qJ}s*P*YabXjmZKfh{nfc$(Cb61%LO43W8k>bu4;#czC!{biBk|zl1{# zJL<&xB^s7#0^mqhmw7jxa=Dx;wt4;vm~3uc0?B4g zFe$#I_{o8xNs>PXV&|I|edFS#i*=%i1`g2fdutZCp9-k^=A + + + + diff --git a/main/static/main/css/style.css b/main/static/main/css/style.css index 4a0674116..30b5164cf 100644 --- a/main/static/main/css/style.css +++ b/main/static/main/css/style.css @@ -39,7 +39,7 @@ Bootstrap is better in that case. https://getbootstrap.com/docs/4.5/getting-star left: auto; right: 0; z-index: 100; - /* display: none; */ + width: 33%; background-color: #DAEFFF; } @@ -358,6 +358,13 @@ Entry Preview Page margin-top: 20px; margin-left: 0px !important; } + #collaboration-notification { + width: 60%; + } + #collab-switch { + top: 25%; + left: 25%; + } } @media only screen and (max-width: 540px) { @@ -397,6 +404,9 @@ Entry Preview Page #collaborationButton { width: 100%; } + #collaboration-notification { + width: 100%; + } } input[type="range"]::-webkit-slider-thumb { @@ -789,6 +799,10 @@ color scheme. See readme.md*/ color: #fff !important; } +.bg-primary { + background-color: #2a94f4 !important; +} + .btn-primary:active { background-color: #2176c2; border-color: #2176c2; @@ -1305,6 +1319,10 @@ Entry Mapping Page #mapping-image-div { width: 30% !important; } + #collab-switch { + left: 0% !important; + top: 25% !important; + } } .loader { @@ -1761,6 +1779,18 @@ input[type="checkbox"].switch_1:checked { background: #2a94f4; } +input[type="checkbox"]#collab-switch { + background: #fff; +} + +input[type="checkbox"]#collab-switch:checked { + background: #fff; +} + +input[type="checkbox"]#collab-switch:after { + background: #2a94f4; +} + input[type="checkbox"].switch_1:after { position: absolute; content: ""; @@ -2229,6 +2259,10 @@ height:25vh!important; .vh-lg-25 { height:25vh!important; } + #collab-switch { + left: 15%; + top: 20%; + } } /* Extra large devices (large desktops, 1200px and up)*/ @@ -2282,6 +2316,9 @@ height:25vh!important; .vh-xl-25 { height:25vh!important; } + #collab-switch { + left: 0% !important; + } } /* Fallback for Edge diff --git a/main/static/main/js/geo.js b/main/static/main/js/geo.js index 51186dcab..bc1b796ee 100644 --- a/main/static/main/js/geo.js +++ b/main/static/main/js/geo.js @@ -377,7 +377,6 @@ function surveyP2ToMap() { $("#2to3").removeClass("h-75"); automaticScrollToTop(); document.getElementById('collaborationBar').style = "display: none;"; - document.getElementById('collaboration-notification').style = "display: none;"; } function mapToSurveyP2() { @@ -412,8 +411,6 @@ function privacyToMap() { privacyCheckValidation(); animateStepBackward(4, 3, 5); automaticScrollToTop(); - document.getElementById('collaborationBar').style = "display: none;"; - document.getElementById('collaboration-notification').style = "display: none;"; } @@ -1381,11 +1378,15 @@ map.on("style.load", function () { } sessionStorage.setItem("prev_state", state); - console.log(polygon); - census_blocks = census_blocks.split("'"); - block_groups = block_groups.split("'"); + if (census_blocks.includes("'") || block_groups.includes("'")){ + census_blocks = census_blocks.split("'"); + block_groups = block_groups.split("'"); + } else if (census_blocks.includes("x27") || block_groups.includes("x27")){ + census_blocks = census_blocks.split("'"); + block_groups = block_groups.split("'"); + } toDisplay = ["in", "GEOID"]; - if(census_blocks.length > 1 || block_groups.length > 1){ + if(typeof block_groups !== "string" && (census_blocks.length > 1 || block_groups.length > 1)){ if (census_blocks.length > 1){ // if there are census blocks let i = 1; while (i < census_blocks.length){ diff --git a/main/templates/main/draft.html b/main/templates/main/draft.html index ad76849fd..66b17ee86 100644 --- a/main/templates/main/draft.html +++ b/main/templates/main/draft.html @@ -82,24 +82,24 @@

This is a draft map.

-

Add collaborators so they can edit your map.

+

- - + +
-
+
-
+

Copy Link

@@ -130,6 +130,7 @@

Copy Link

{{c.entry_name}}

{{c.drive.name}}

{% trans "Community Information" %}

+ {% if c.comm_activities %}
+ {% endif %} + {% if c.cultural_interests %}
+ {% endif %} + {% if c.economic_interests %}
+ {% endif %} + {% if c.other_considerations %}
+ {% endif %} {% if c.drive and c.drive.custom_question %}
-
- +
+
-
+

You have indicated collaboration.

You will be able to add collaborators after saving the map as a draft. Because of this, you will not be able to submit your map. If you would like to submit your map right away, you can turn off collaboration.

- {% endblock %} \ No newline at end of file + {% endblock %} diff --git a/main/templates/main/entry_address.html b/main/templates/main/entry_address.html index 19171cba4..ee5f9a814 100644 --- a/main/templates/main/entry_address.html +++ b/main/templates/main/entry_address.html @@ -175,7 +175,7 @@ {{ addr_form.zipcode|append_attr:"class:form-control addr-field" }}
-
+
diff --git a/main/templates/main/entry_privacy.html b/main/templates/main/entry_privacy.html index 92c169e0a..f15af4c4f 100644 --- a/main/templates/main/entry_privacy.html +++ b/main/templates/main/entry_privacy.html @@ -6,8 +6,8 @@ Step 4
-
-
+
+