Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#868ahqpwh drawing bounary on account creation #407

Draft
wants to merge 59 commits into
base: drawing-boundary
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
536f2c8
feat: created draw boundary option on Add Community Boundary page
lc-hd Nov 15, 2024
1856050
feat: created view for drawing boundary
lc-hd Nov 15, 2024
e0a455e
feat: modified html of drawing boundary page
lc-hd Nov 18, 2024
30d3a67
feat: created endpoint for geocoding api
lc-hd Nov 21, 2024
e9baad4
feat: added geocoding_api to urls
lc-hd Nov 21, 2024
c649e38
feat: created testcase for missing location variable in request
lc-hd Nov 21, 2024
44419be
feat: created testcase and fixed error
lc-hd Nov 22, 2024
0d7b4b6
feat: updated test
lc-hd Nov 22, 2024
1cd84a9
feat: created testcase when request to geocoder api provider fails
lc-hd Nov 22, 2024
0db4eab
feat: created test for the successful case
lc-hd Nov 22, 2024
4cef560
feat: created file with world regions
lc-hd Nov 26, 2024
f9ddb19
feat: changed key from lat-lon to lat_lon
lc-hd Nov 26, 2024
36eed2f
feat: updated draw-community-boundary in account creation so it popul…
lc-hd Nov 26, 2024
4a1ae2b
feat: removed older code
lc-hd Nov 26, 2024
3fdf7a9
feat: map is displayed whne user selects region in dropdown
lc-hd Nov 26, 2024
7da4494
feat: fixed issue preventing dropdown from being seen
lc-hd Dec 2, 2024
98c2d2a
feat: map pans to selected area when selected
lc-hd Dec 2, 2024
d42117c
feat: the search input is populated with the region clicked on within…
lc-hd Dec 2, 2024
3e1a613
feat: updated link for navigating to choosing another option
lc-hd Dec 3, 2024
935f241
feat: updated testcases
lc-hd Dec 3, 2024
73934ef
feat: added expand button
lc-hd Dec 3, 2024
57dad25
feat: code searches for text once user enters an input of any size
lc-hd Dec 3, 2024
391bd53
feat: refactored code so the dropdown shows all regional options oncl…
lc-hd Dec 3, 2024
eae9610
feat: expand button is activated when map is loaded intially
lc-hd Dec 3, 2024
3e4f83d
feat: modified styling of expand-arrows button
lc-hd Dec 3, 2024
a800c0a
feat: removed unused JS function
lc-hd Dec 3, 2024
4672f95
feat: removed geocoding API
lc-hd Dec 3, 2024
cced646
feat: updated region JSON file
lc-hd Dec 4, 2024
8a627f5
feat: map uses zoom level for specified region
lc-hd Dec 4, 2024
4b456a2
feat: map is displayed initially when page loads
lc-hd Dec 4, 2024
3a0e266
feat: added location and zoom data for the artic circle and antartica…
lc-hd Dec 4, 2024
c6c053a
feat: updated north american region location and zoom
lc-hd Dec 4, 2024
a8cb018
feat: map attempts to use user's location initially
lc-hd Dec 10, 2024
51f9d1d
feat: the expand button is visible by default
lc-hd Dec 10, 2024
12370a3
created expanded map modal scaffold
lc-hd Dec 10, 2024
94f7794
feat: updated syle of map modal
lc-hd Dec 11, 2024
8fc1d70
feat: map modal has title and exit button
lc-hd Dec 11, 2024
6c895e0
feat: elements are moved into modal
lc-hd Dec 13, 2024
35957a8
feat: updated expandedModal
lc-hd Dec 13, 2024
4cae638
feat: added skip button
lc-hd Dec 13, 2024
a56aa77
feat: skip and continue buttons are moved to and from the modal
lc-hd Dec 13, 2024
42d4329
feat: tools are displayed on map
lc-hd Dec 13, 2024
ed2be02
feat: user can draw on map
lc-hd Dec 17, 2024
413de40
feat: boundary is set on mouse up
lc-hd Dec 17, 2024
d0f02cc
feat: pencil icon is added to leaflet toolbar
lc-hd Dec 18, 2024
0a85585
feat: pencil icon toggles
lc-hd Dec 19, 2024
c012728
feat: refactor JS logic
lc-hd Dec 19, 2024
131d1f3
feat: removed code which disables zooming, panning, etc by default
lc-hd Dec 19, 2024
2644f98
feat: created eraser to remove boundary
lc-hd Dec 19, 2024
4fb04c1
feat: javascript and css is loaded locally
lc-hd Dec 19, 2024
88cf270
feat: drawing becomes a closed loop when first and last coordinates d…
lc-hd Dec 19, 2024
8525435
feat: draw-community-boundary view includes the community name in the…
lc-hd Dec 23, 2024
0fbbefb
feat: used correct name for attribute
lc-hd Dec 23, 2024
ae612ca
feat: button is enabled once user has drawn the boundary
lc-hd Dec 23, 2024
1b7e493
feat: boundary coordinates get sent to the backend
lc-hd Dec 23, 2024
9d2324d
feat: changed error message
lc-hd Dec 23, 2024
2b4944c
feat: increased readability of JS code
lc-hd Dec 23, 2024
493b9f4
feat: continue button shows spinner to indicate processesing after be…
lc-hd Dec 23, 2024
d8074a5
feat: updated error handling
lc-hd Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions communities/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
path('connect-community/', views.connect_community, name="connect-community"),
path('create-community/', views.create_community, name="create-community"),
path('community-boundary/', views.community_boundary, name="community-boundary"),
path('draw-community-boundary/', views.draw_community_boundary, name="draw-community-boundary"),
path('add-community-boundary/', views.add_community_boundary, name="add-community-boundary"),
path('upload-boundary-file/', views.upload_boundary_file, name="upload-boundary-file"),
path('registration-boundary', views.registration_boundary, name="registration-boundary"),
Expand Down
10 changes: 10 additions & 0 deletions communities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ def community_boundary(request):
return render(request, 'communities/community-boundary.html')


@has_new_community_id
@login_required(login_url='login')
def draw_community_boundary(request):
community = get_community(request.session.get('new_community_id'))
context = {
'community_name': community.community_name,
}
return render(request, 'communities/draw-community-boundary.html', context)


@has_new_community_id
@login_required(login_url='login')
def add_community_boundary(request):
Expand Down
2 changes: 2 additions & 0 deletions helpers/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import json
import os

from django.core.cache import cache
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, Http404, JsonResponse
from django.conf import settings
from django.views.decorators.clickjacking import xframe_options_sameorigin
from rest_framework.status import HTTP_500_INTERNAL_SERVER_ERROR

from communities.models import InviteMember, Community
from notifications.models import UserNotification
Expand Down
1 change: 1 addition & 0 deletions localcontexts/static/css/leaflet.toolbar.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions localcontexts/static/javascript/leaflet.toolbar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

160 changes: 160 additions & 0 deletions localcontexts/static/json/WorldRegions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
[
{
"region": "Northern Africa",
"lat_lon": [32.320583, 9.803229],
"zoom": 4
},
{
"region": "Southern Africa",
"lat_lon": [-32.274286, 22.011343],
"zoom": 5
},
{
"region": "Central Africa",
"lat_lon": [5.137965, 25.240858],
"zoom": 4
},
{
"region": "Eastern Africa",
"lat_lon": [-2.106169, 39.522977],
"zoom": 4
},
{
"region": "Western Africa",
"lat_lon": [12.101225, -14.780815],
"zoom": 4
},


{
"region": "Northern America",
"lat_lon": [44, -101.780213],
"zoom": 3
},
{
"region": "Central America",
"lat_lon": [13.989996, -87.375443],
"zoom": 4
},
{
"region": "Southern America",
"lat_lon": [-11.159831, -57.974516],
"zoom": 3
},


{
"region": "West Indies",
"lat_lon": [19.071591, -75.626407],
"zoom": 5
},


{
"region": "Northern Europe",
"lat_lon": [69.084788, 21.456927],
"zoom": 4
},
{
"region": "Central Europe",
"lat_lon": [48.781150, 13.870088],
"zoom": 5
},
{
"region": "Southeast Europe",
"lat_lon": [41.417291, 27.803158],
"zoom": 5
},
{
"region": "Southwest Europe",
"lat_lon": [36.707788, -5.865912],
"zoom": 5
},
{
"region": "Eastern Europe",
"lat_lon": [49.854485, 26.373646],
"zoom": 5
},
{
"region": "Western Europe",
"lat_lon": [48.917763, -0.900168],
"zoom": 5
},


{
"region": "Middle East",
"lat_lon": [32.638118, 36.134550],
"zoom": 5
},


{
"region": "Eastern Asia",
"lat_lon": [35.129720, 123.513141],
"zoom": 4
},
{
"region": "Central Asia",
"lat_lon": [33.687303, 94.133847],
"zoom": 5
},
{
"region": "Northern Asia",
"lat_lon": [59.039858, 81.647848],
"zoom": 3
},
{
"region": "Southeastern Asia",
"lat_lon": [10.749795, 106.802025],
"zoom": 5
},
{
"region": "Southwestern Asia",
"lat_lon": [9.257824, 77.473901],
"zoom": 4
},
{
"region": "Western Asia",
"lat_lon": [32.340462, 75.224219],
"zoom": 4
},

{
"region": "Northern Oceania",
"lat_lon": [10.855851, 145.875907],
"zoom": 5
},
{
"region": "Central Oceania",
"lat_lon": [-10.879485, 165.523154],
"zoom": 4
},
{
"region": "Southern Oceania",
"lat_lon": [-45.744602, 168.668840],
"zoom": 4
},
{
"region": "Southwestern Oceania",
"lat_lon": [-26.654914, 133.219582],
"zoom": 4
},
{
"region": "Southeastern Oceania",
"lat_lon": [-22.945764, -134.516414],
"zoom": 4
},


{
"region": "Arctic Circle",
"lat_lon": [81.351924, -108.655971],
"zoom": 3
},
{
"region": "Antarctica",
"lat_lon": [-74.338017, -48.890346],
"zoom": 3
}
]
2 changes: 1 addition & 1 deletion templates/boundary/upload-boundary-file.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h2 class="mt-0">Upload Shapefile</h2>
You can create shapefiles on third-party websites like ArcGIS and QGIS.
</p>
<div id="navigate-to-option">
Or <a class="default-a" href="{% url 'add-community-boundary' %}">search Native Land database</a>
Or <a class="default-a" href="{% url 'community-boundary' %}">Choose another option</a>
</div>

<div id="browse-files-container">
Expand Down
2 changes: 1 addition & 1 deletion templates/communities/add-community-boundary.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h2 class="mt-0">Search the Native Land Digital database</h2>
please contact <a class="default-a" href="https://native-land.ca/contact/" target="_blank">Native Land Digital</a>.
</p>
<div id="navigate-to-option">
Or <a class="default-a" href="{% url 'upload-boundary-file' %}">upload shapefile</a>
Or <a class="default-a" href="{% url 'community-boundary' %}">Choose another option</a>
</div>

<div id="region-container">
Expand Down
20 changes: 18 additions & 2 deletions templates/communities/community-boundary.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,23 @@ <h2 class="mt-0">Add community boundary</h2>
</i>
<p>
<form id="radio_btn_select">
<strong>Option 1: Search the Native Land Digital database </strong><br><br>
<strong>Option 1: Drawing boundaries </strong><br><br>
<fieldset>

<div class="communityBoundarySelect">
<input type="radio" name="selectBoundary" data-next="{% url 'draw-community-boundary' %}"/>
<div class="communityBoundaryLabel">
<strong>Drawing boundaries</strong>
</div>
<div class="communityBoundaryText">
Drawing community boundaries easily through our comprehensive mapping tool.
</div>
</div>

</fieldset>

<br>
<strong>Option 2: Search the Native Land Digital database </strong><br><br>
<fieldset>

<div class="communityBoundarySelect">
Expand All @@ -68,7 +84,7 @@ <h2 class="mt-0">Add community boundary</h2>
</fieldset>

<br>
<strong>Option 2: Upload a shapefile </strong><br><br>
<strong>Option 3: Upload a shapefile </strong><br><br>
<fieldset>

<div class="communityBoundarySelect">
Expand Down
Loading
Loading