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

v7.16.0 #3395

Merged
merged 135 commits into from
Sep 29, 2023
Merged

v7.16.0 #3395

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
b8781bb
Add alt text to images
kevinjxc Jul 7, 2023
8f2619c
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
kevinjxc Jul 7, 2023
1ac5810
Add alt text for homepage video
kevinjxc Jul 7, 2023
ada861a
added reset button to the gallery page
tanayaxsharma Jul 24, 2023
5c151e5
3292-3293-neighborhood-name-and-cluster-size-properties
kevinjxc Jul 27, 2023
9cc656a
Update collaborator images and other bugs
Aug 9, 2023
2cd9383
added language translations
tanayaxsharma Aug 10, 2023
938a7ac
Adds clusterSize to shapefiles and fixes other bugs
Aug 12, 2023
751aa83
Adds people nudge logo to collaborators
Aug 13, 2023
58f4862
Commits People Nudge Logo
Aug 17, 2023
5c2f430
Adds responsiveness for logo translations in alt-text
Aug 17, 2023
9ebf6a9
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Aug 17, 2023
cc63ecc
inital edits to add source column
dylanbun Aug 17, 2023
6586506
adding labels to source column
dylanbun Aug 17, 2023
fbd3d45
merging
dylanbun Aug 17, 2023
adfc3ad
spacing fix
dylanbun Aug 17, 2023
f1b5868
new sql file for source
dylanbun Aug 17, 2023
6d8e5d9
fixing 198.sql again
dylanbun Aug 17, 2023
b4f8777
undoing excess column adding
dylanbun Aug 17, 2023
4f837c5
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Aug 18, 2023
7213090
Merge branch 'develop' into 3292-3293-neighborhood-name-and-cluster-s…
misaugstad Aug 18, 2023
048854d
fixed gallery reset button for label type
tanayaxsharma Aug 18, 2023
7be1aaf
Updates bugs in naming conventions
Aug 18, 2023
d3ec12c
Improves if-statement structure and renames cityName to cityId in if-…
Aug 19, 2023
abf4226
updated gallery page sidebar
tanayaxsharma Aug 19, 2023
4dda089
ignore
Aug 19, 2023
33cc559
Adds translations for alt text in logos
Aug 19, 2023
8f5cee6
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Aug 21, 2023
5ab1473
renames Show header to Label Type in Gallery
misaugstad Aug 21, 2023
168fc08
adjusts initial tutorial camera heading
misaugstad Aug 22, 2023
77cefb3
adds a Crosswalk label at the beginning of tutorial
misaugstad Aug 22, 2023
5f66115
refactors Explore tutorial to automate progress bar
misaugstad Aug 23, 2023
bce22f5
removes 2 curb ramps from the Explore tutorial
misaugstad Aug 23, 2023
25c3476
adds pedestrian signal label to the tutorial
misaugstad Aug 23, 2023
10a954d
fixes label showing up in the upper left of the gsv view
tanayaxsharma Aug 24, 2023
843211c
trying to finalize source column
dylanbun Aug 25, 2023
6b8c3b0
commented out excess code
dylanbun Aug 25, 2023
47ac63a
finished adding all sources
dylanbun Aug 25, 2023
7c488c4
Fixes Taipei CityID
Aug 28, 2023
f47e96c
adds a box around the pedestrian signal that we're labeling
misaugstad Aug 29, 2023
79e4c28
fixes tutorial instruction locations (in English)
misaugstad Aug 29, 2023
f05cb6d
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Aug 29, 2023
0321b61
checking for null instead
tanayaxsharma Aug 29, 2023
6a2b09c
checking for null instead for gsv issue
tanayaxsharma Aug 29, 2023
71e7e99
updated per PR
tanayaxsharma Aug 30, 2023
398ce11
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Aug 30, 2023
fb76621
adds 2nd crosswalk to Explore tutorial
misaugstad Aug 30, 2023
f49c22f
adds ability to draw static labels and have annotations persist in tu…
misaugstad Aug 30, 2023
b8581ae
adds a step in tutorial where 2 ramps and ped signal are auto-labeled
misaugstad Aug 30, 2023
7511551
fixes crosswalk label context menu auto-closing
misaugstad Aug 31, 2023
0ea9475
adds 3rd crosswalk to tutorial
misaugstad Aug 31, 2023
ceeda91
static tutorial labels now shown on mini map as well
misaugstad Aug 31, 2023
f5146da
fixes performance issue with tutorial labels on mini map
misaugstad Aug 31, 2023
558cd9b
end of tutorial now shows all 5 labels that should be there
misaugstad Aug 31, 2023
11ebd8f
adds final missing label to tutorial
misaugstad Aug 31, 2023
3643a64
fixes arrows showing up in tutorial after deleting label
misaugstad Aug 31, 2023
290503b
updating translations from recent tutorial updates
misaugstad Aug 31, 2023
2d5514c
text updates for the Explore tutorial with new label types
misaugstad Sep 1, 2023
6c9d01a
merge conflict
dylanbun Sep 1, 2023
ff5b080
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
dylanbun Sep 1, 2023
1dd29ce
updated sql file number
dylanbun Sep 1, 2023
08608cb
removed mobile column
dylanbun Sep 1, 2023
6015db4
final checks, please check comments @mikey
dylanbun Sep 1, 2023
12c7347
Aligns translations with new naming conventions, adds translations an…
Sep 1, 2023
b4a4cb3
redid source column. preexisitng mobile validations are marked
dylanbun Sep 1, 2023
f195aee
updates no curb ramp translation in Mandarin
misaugstad Sep 5, 2023
634d8cf
adds bolded phrases to a few more tutorial dialogs
misaugstad Sep 6, 2023
38e9f64
removes some fluff from onboarding code
misaugstad Sep 6, 2023
82fc93d
removes outdated tutorial translations
misaugstad Sep 6, 2023
feb8ea4
reorganizes tutorial translations when misplacing a label
misaugstad Sep 6, 2023
c81c166
simplifies dev env setup instructions
misaugstad Sep 6, 2023
a3bc2d5
preparing to add translations to updated tutorial
misaugstad Sep 6, 2023
1da725b
adds en-NZ translations for updated Explpore tutorial
misaugstad Sep 7, 2023
fe0eff4
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Sep 7, 2023
b0b34e3
Merge pull request #3373 from ProjectSidewalk/3336-fixed-label-showin…
misaugstad Sep 7, 2023
99e4e9a
Merge branch 'develop' into 2704-add-reset-button-to-gallery-page
misaugstad Sep 7, 2023
545aead
final tweaks
misaugstad Sep 7, 2023
58ff61c
Merge pull request #3350 from ProjectSidewalk/2704-add-reset-button-t…
misaugstad Sep 7, 2023
a964873
Merge branch 'develop' into 2522-alt-text-for-images
misaugstad Sep 7, 2023
0637646
minor tweaks and code style updates
misaugstad Sep 7, 2023
4df1a10
Merge pull request #3285 from ProjectSidewalk/2522-alt-text-for-images
misaugstad Sep 7, 2023
6ed4ee4
Fixes merge conflicts
Sep 9, 2023
5a8690e
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Sep 11, 2023
5f386d2
finished updating validatedesktop query. removed is_mobile
dylanbun Sep 11, 2023
ea9d40c
Merge branch 'develop' into 3164-source-col
dylanbun Sep 11, 2023
6e52a0e
fixes cluster size field for /attributes API shapefiles
misaugstad Sep 11, 2023
7f47d7d
reordering /attributes API fields
misaugstad Sep 11, 2023
02a5486
adds neighborhood ID to AccessScoreStreets API
misaugstad Sep 11, 2023
f63e06e
fixes field name for neighborhoods shapefile API
misaugstad Sep 11, 2023
e0c62e2
Merge pull request #3323 from ProjectSidewalk/3292-3293-neighborhood-…
misaugstad Sep 11, 2023
2f8a63b
Merge branch 'develop' into 3164-source-col
misaugstad Sep 11, 2023
e7719b6
most maps are now translated to Spanish, German, or Chinese
misaugstad Sep 11, 2023
f291f97
RouteBuilder map now translates into Chinese, German, and Spanish
misaugstad Sep 12, 2023
d72ba64
Merge pull request #3383 from ProjectSidewalk/3371-translate-maps
misaugstad Sep 12, 2023
575828a
finished removing comments, updating names for source, fixing query
dylanbun Sep 12, 2023
73bee85
Merge branch '3164-source-col' of https://github.com/ProjectSidewalk/…
dylanbun Sep 12, 2023
c524748
Merge branch 'develop' into 3164-source-col
dylanbun Sep 12, 2023
8adcaa3
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
dylanbun Sep 12, 2023
78fd233
202.sql did not like that last commit...
dylanbun Sep 12, 2023
7463926
Merge branch '3164-source-col' of https://github.com/ProjectSidewalk/…
dylanbun Sep 12, 2023
47f4030
fixed column, added old data label for source column
dylanbun Sep 12, 2023
3ae5f1b
Fixes bugs with code removal for all cities
Sep 13, 2023
62557f3
Merge pull request #3358 from ProjectSidewalk/3340-people-nudge-logo
misaugstad Sep 13, 2023
b62974c
Merge branch 'develop' into 3164-source-col
dylanbun Sep 13, 2023
cf58f08
fixed downs
dylanbun Sep 13, 2023
37523f7
Merge branch '3164-source-col' of https://github.com/ProjectSidewalk/…
dylanbun Sep 13, 2023
92d991d
Merge pull request #3380 from ProjectSidewalk/3164-source-col
misaugstad Sep 13, 2023
ea0c237
adds translations of city, state, and country names
misaugstad Sep 19, 2023
2e1e792
redoing how we translate city, state, country names
misaugstad Sep 20, 2023
0b52171
adds convenience case class for city configs
misaugstad Sep 20, 2023
8f50b8b
fixes navbar city list for non-US servers
misaugstad Sep 20, 2023
afee1b7
now using abbreviated city names at appropriate times
misaugstad Sep 20, 2023
2b982fc
list of cities now grouped by country
misaugstad Sep 20, 2023
2197abe
removes old state-abbreviation config
misaugstad Sep 20, 2023
4513b72
finishes migration to storing city names in translation files
misaugstad Sep 21, 2023
580d2f4
moves city name formatting to Configs.scala
misaugstad Sep 21, 2023
1652eaf
translating city names now working again
misaugstad Sep 21, 2023
ebc2299
fixes mapathon links in Chinese
misaugstad Sep 21, 2023
977ca40
now sorting city lists alphabetically instead of reversed
misaugstad Sep 21, 2023
934bbb4
Merge pull request #3387 from ProjectSidewalk/3377-translate-city-names
misaugstad Sep 21, 2023
1af957c
Merge branch 'develop' of https://github.com/ProjectSidewalk/Sidewalk…
misaugstad Sep 21, 2023
e4cf057
adds translations for new tutorial content
misaugstad Sep 21, 2023
3f66e90
adding comments, removing print statements
misaugstad Sep 22, 2023
d0f2e0a
Merge pull request #3388 from ProjectSidewalk/2846-tutorial-add-cross…
misaugstad Sep 22, 2023
1cbe75e
Updated README to include WSL shutdown instructions
davphan Sep 25, 2023
71cb7d4
fixes city name translations when using a lang not in our list
misaugstad Sep 25, 2023
88e01f0
now linking to PDF for Chinese labeling guide in Taiwan servers
misaugstad Sep 25, 2023
721f587
trimming down length of Docker/WSL shut down instructions
misaugstad Sep 25, 2023
8b0666a
Merge pull request #3389 from ProjectSidewalk/readme-stop-wsl
misaugstad Sep 25, 2023
3d8075a
adds configs for new Walla Walla server
misaugstad Sep 27, 2023
9f50b97
fixes zoom in Validate page
misaugstad Sep 27, 2023
7f37982
fixes more zoom bugs in Validate page
misaugstad Sep 27, 2023
196ce61
Merge pull request #3391 from ProjectSidewalk/3309-bug-zoom-in-validate
misaugstad Sep 27, 2023
6495a51
Merge pull request #3393 from ProjectSidewalk/3382-walla-walla-configs
misaugstad Sep 28, 2023
e220032
7.15.6 -> 7.16.0
misaugstad Sep 29, 2023
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
42 changes: 29 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,34 @@ If you run into any problems during setup, check the [Docker troubleshooting wik
</details>

<details><summary>Windows (WSL2)</summary>

There are two methods to setup your Docker dev environment with Windows: with WSL2 and without. We recommend and only support the *WSL2* installation process.

##### First time setup

There are two methods to set up your Docker dev environment with Windows: with WSL2 and without. We recommend and only support the *WSL2* installation process.

WSL2 provides an actual Linux kernel running within a lightweight VM, unlike the older WSL which tried to emulate a linux kernel within the Windows kernel—see [Docker's official WSL2 overview](https://docs.docker.com/desktop/windows/wsl/). WSL2 offers faster compile times and is better supported by Docker.

1. [Install Docker Desktop](https://www.docker.com/get-started). Follow the official [Docker Windows Install Guide](https://docs.docker.com/desktop/windows/install/). When prompted, ensure the **Use WSL 2** instead of Hyper-V option on the Configuration page is selected
1. [Install WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10) using the default Linux distribution (Ubuntu). Open PowerShell in **administrator** mode by right-clicking and selecting "Run as adminstrator" then enter `wsl --install`, which will use **WSL 2** to install **Ubuntu** by default (see [Microsoft's WSL instructions](https://learn.microsoft.com/en-us/windows/wsl/install)). We recommend pinning Ubuntu to your taskbar to open up the shell easily but you can easily find it in the future by searching "Ubuntu" from the Windows Start menu.
1. Make sure you are also running the latest version of WSL. Again, in PowerShell, run `wsl --update`
1. Enter the Docker Dashboard and click the settings gear icon in the top right. From there, click the "General" tab and select the "Use the WSL 2 based engine" check box (this will be grayed out and pre-checked if you're running Windows Home).
1. Proceed by clicking **Resources &rarr; WSL Integration** and making sure the "Enable integration with my default WSL distro" is checked. If you have multiple Linux distros, then select your Linux VM of choice under "Enable integration with additional distros:". Here is some extra [documentation](https://docs.docker.com/docker-for-windows/wsl/) from Docker that may help out with this process.
1. Proceed by clicking **Resources &rarr; WSL Integration** and making sure that "Enable integration with my default WSL distro" and "Ubuntu" are checked.
1. Open your Linux VM shell and navigate to where you would like to set up your Project Sidewalk repository. For me, that's `/home/jonf/projects/`.
1. From your Linux VM shell, run `git clone https://github.com/ProjectSidewalk/SidewalkWebpage.git`.

##### Starting/Shutting down WSL2 and Docker when you're done working

WSL and Docker can take up lots of memory in the background. If you aren't working on Project Sidewalk, you can shut down Docker and WSL to prevent unnecessary memory consumption on your computer by following the steps below. If you shut them down, you will need to start them back up again before working on Project Sidewalk!

###### Shut down Docker/WSL
1. **Close any apps using Docker or WSL.** Make sure to shut down Project Sidewalk and any other apps that might be using Docker or WSL. If you don't, WSL will start up again automatically.
1. **Shut down Docker.** Open the hidden icons button on the toolbar, right-click the Docker symbol, and click "Quit Docker Desktop".
1. **Shut down WSL.** Run `wsl --shutdown`.

###### Start Docker/WSL
1. **Start WSL.** From the terminal, run `wsl -d Ubuntu`. Starting an IDE using WSL will also automatically boot it up.
2. **Start Docker.** Search for Docker Desktop in the start menu and run the app. You can then freely run `make dev` to begin development.

##### Transferring files from Windows to Linux VM
One issue you may encounter when setting up your dev environment within the Linux VM is transferring files (like the database dump) into the VM itself.

Expand Down Expand Up @@ -64,9 +79,9 @@ On Windows, we recommend [Windows Powershell](https://docs.microsoft.com/en-us/p
1. If your computer has an Apple Silicon (M1 or M2) chip, then you should modify the `platform` line in the `docker-compose.yml`, changing it to `linux/arm64`.
1. If your computer has less than 16 GB of RAM, I'd recommend modifying `-mem 12288` to `-mem 8192` or lower in the `package.json` file so that you don't fill up your computer's memory.
1. Modify the `MAPBOX_API_KEY`, `GOOGLE_MAPS_API_KEY`, and `GOOGLE_MAPS_SECRET` lines in the `docker-compose.yml` using the keys and secret you've acquired.
1. Modify the `SIDEWALK_CITY_ID` line in the `docker-compose.yml` to use the ID of the appropriate city. You can find the list of IDs for the cities starting at line 7 of `conf/cityparams.conf`.
1. Modify the `DATABASE_URL` line in the `docker-compose.yml`, replacing "sidewalk" with "sidewalk-\<city-name\>", where the `<city-name>` comes from the city ID you found in the previous step. Note that if a state abbreviation comes after, you'll remove that. So if the `city-id` is "newberg-or", your db URL will contain "sidewalk-newberg". And if your `city-id` is "cdmx" then your URL will contain "sidewalk-cdmx".
1. Rename the database dump file that you got from Mikey to "sidewalk-\<city-name\>-dump" (same name as prev step) and put it in the `db/` directory (other files in this dir include `init.sh` and `schema.sql`).
1. Modify the `SIDEWALK_CITY_ID` line in the `docker-compose.yml` to use the ID of the appropriate city, listed [here](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).
1. Modify the `DATABASE_URL` line in the `docker-compose.yml`, replacing "sidewalk" with the database name from the table [linked above](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).
1. Rename the database dump file that you got from Mikey to "\<database-name\>-dump" (using the name from the prev step) and put it in the `db/` directory (other files in this dir include `init.sh` and `schema.sql`).
1. From the root SidewalkWebpage dir, run `make dev`. This will take time (20-30 mins or more depending on your Internet connection) as the command downloads the docker images, spins up the containers, and opens a Docker shell into the webpage container in that same terminal. The containers (running Ubuntu Stretch) will have all the necessary packages and tools so no installation is necessary. This command also initializes the database, though we still need to import the data. Successful output of this command will look like:

```
Expand All @@ -77,11 +92,11 @@ On Windows, we recommend [Windows Powershell](https://docs.microsoft.com/en-us/p
root@[container-id]:/opt#
```

1. In a separate terminal, run the commands below. In the second command, replace `<city-name>` with the one used above. There is one outlier: `pittsburg` (pittsburgh is missing the 'h', but it's a typo we're stuck with; the typo is only relevant for this one command).
1. In a separate terminal, run the commands below. In the second command, replace `<database-user>` with the appropriate user from [this table](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).

```
docker exec -it projectsidewalk-db psql -c "CREATE ROLE saugstad SUPERUSER LOGIN ENCRYPTED PASSWORD 'sidewalk';" -U postgres -d postgres
docker exec -it projectsidewalk-db psql -c "CREATE ROLE sidewalk_<city-name> SUPERUSER LOGIN ENCRYPTED PASSWORD 'sidewalk';" -U postgres -d postgres
docker exec -it projectsidewalk-db psql -c "CREATE ROLE <database-user> SUPERUSER LOGIN ENCRYPTED PASSWORD 'sidewalk';" -U postgres -d postgres
```

1. Run `make import-dump db=sidewalk-<city-name>` (needs to be the same thing you put in the `DATABASE_URL`) from the root project directory outside the Docker shell (from a new Ubuntu terminal). This may take a while depending on the size of the dump. Don't panic if this step fails :) and consult the [Docker Troubleshooting wiki](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting). Check the output carefully. If it looks like there are errors, do not skip to the next step, check the wiki and ask Mikey if you don't find solutions in there.
Expand All @@ -108,14 +123,15 @@ On Windows, we recommend [Windows Powershell](https://docs.microsoft.com/en-us/p
(Server started, use Ctrl+D to stop and go back to the console...)
```

1. Head on over to your browser and navigate to `127.0.0.1:9000` (or try localhost:9000). This should display the Project Sidewalk webpage. It might take time to load initially.
1. Head on over to your browser and navigate to `localhost:9000` (or try `127.0.0.1:9000`). This should display the Project Sidewalk webpage. It might take time to load initially.

### Setting up another database or city
1. Acquire another database dump and rename it `[db-name]-dump`. I would suggest naming it `sidewalk-seattle-dump` if it is a Seattle database, for example. Just make sure it does not conflict with the name of any databases you already have set up.
1. Run `make import-dump db=[db-name]` from the root project directory outside the Docker shell. Using the example from step 1., this would be `make import-dump db=sidewalk-seattle`.
1. Update the `DATABASE_URL` variable in the `docker-compose.yml` to be `jdbc:postgresql://db:5432/[db-name]`.
1. If the database is for a city other than DC, modify the `SIDEWALK_CITY_ID` line in `docker-compose.yml` to use the appropriate ID. You can find the list of IDs for the cities starting at line 7 of `conf/cityparams.conf`.
1. Acquire another database dump, put it in the `db/` directory, and rename it to "\<database-name\>-dump", using the appropriate database name from [this table](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).
1. Run `make import-dump db=<db-name>` (using the name from the prev step) from the root project directory outside the Docker shell.
1. Update the `DATABASE_URL` variable in the `docker-compose.yml` to be `jdbc:postgresql://db:5432/<db-name>`.
1. Modify the `SIDEWALK_CITY_ID` line in `docker-compose.yml` to use the appropriate ID from [this table](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).
1. Rerun `make dev`.
1. To switch back and forth between databases going forward, you will need to close the Docker shell (if you ran `make dev`, that just means running `exit` in that terminal), update the `DATABASE_URL` and `SIDEWALK_CITY_ID`, and rerun `make dev`.

### Additional tools
1. SSH into containers: To ssh into the containers, run `make ssh target=[web|db]`. Note that `[web|db]` is not a literal syntax, it specifies which container you would want to ssh into. For example, you can do `make ssh target=web`.
Expand Down
25 changes: 12 additions & 13 deletions app/controllers/ApplicationController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import models.audit.AuditTaskInteractionTable
import models.daos.slick.DBTableDefinitions.UserTable
import models.label.TagTable.selectTagsByLabelType
import models.street.StreetEdgePriorityTable
import models.utils.Configs
import models.utils.{CityInfo, Configs}
import models.attribute.ConfigTable
import play.api.Play
import play.api.Play.current
import play.api.i18n.Messages
import play.api.i18n.{Lang, Messages}
import java.util.Calendar
import play.api.mvc._
import scala.concurrent.Future
Expand Down Expand Up @@ -129,17 +129,16 @@ class ApplicationController @Inject() (implicit val env: Environment[User, Sessi
WebpageActivityTable.save(WebpageActivity(0, user.userId.toString, ipAddress, "Visit_Index", timestamp))
// Get city configs.
val cityStr: String = Play.configuration.getString("city-id").get
val cityName: String = Play.configuration.getString("city-params.city-name." + cityStr).get
val stateAbbreviation: String = Play.configuration.getString("city-params.state-abbreviation." + cityStr).get
val cityShortName: String = Play.configuration.getString("city-params.city-short-name." + cityStr).get
val mapathonLink: Option[String] = ConfigTable.getMapathonEventLink
// Get names and URLs for other cities so we can link to them on landing page.
val otherCityUrls: List[(String, String, String, String)] = Configs.getAllCityInfo(excludeCity = cityStr)
val lang: Lang = request.cookies.get("PLAY_LANG").map(l => Lang(l.value))
.getOrElse(Lang.preferred(request.acceptLanguages))
val cityUrls: List[CityInfo] = Configs.getAllCityInfo(lang)
// Get total audited distance. If using metric system, convert from miles to kilometers.
val auditedDistance: Float =
if (Messages("measurement.system") == "metric") StreetEdgePriorityTable.auditedStreetDistanceUsingPriority * 1.60934.toFloat
else StreetEdgePriorityTable.auditedStreetDistanceUsingPriority
Future.successful(Ok(views.html.index("Project Sidewalk", Some(user), cityName, stateAbbreviation, cityShortName, mapathonLink, cityStr, otherCityUrls, auditedDistance)))
Future.successful(Ok(views.html.index("Project Sidewalk", Some(user), mapathonLink, cityUrls, auditedDistance)))
}
case None =>
if(qString.isEmpty){
Expand Down Expand Up @@ -374,10 +373,10 @@ class ApplicationController @Inject() (implicit val env: Environment[User, Sessi
val timestamp: Timestamp = new Timestamp(Instant.now.toEpochMilli)
val ipAddress: String = request.remoteAddress

// Get current city.
val cityStr: String = Play.configuration.getString("city-id").get
// Get names and URLs for cities to display in Gallery dropdown.
val cityUrls: List[(String, String, String, String)] = Configs.getAllCityInfo()
val lang: Lang = request.cookies.get("PLAY_LANG").map(l => Lang(l.value))
.getOrElse(Lang.preferred(request.acceptLanguages))
val cityInfo: List[CityInfo] = Configs.getAllCityInfo(lang)
val labelTypes: List[(String, String)] = List(
("Assorted", Messages("gallery.all")),
("CurbRamp", Messages("curb.ramp")),
Expand All @@ -403,7 +402,7 @@ class ApplicationController @Inject() (implicit val env: Environment[User, Sessi
val activityStr: String = s"Visit_Gallery_LabelType=${labType}_Severity=${severityList}_Tags=${tagList}_Validations=$valOptions"
WebpageActivityTable.save(WebpageActivity(0, user.userId.toString, ipAddress, activityStr, timestamp))

Future.successful(Ok(views.html.gallery("Gallery", Some(user), cityStr, cityUrls, labType, labelTypes, severityList, tagList, valOptions)))
Future.successful(Ok(views.html.gallery("Gallery", Some(user), cityInfo, labType, labelTypes, severityList, tagList, valOptions)))
case None =>
// Send them through anon signup so that there activities on sidewalk gallery are logged as anon.
// UTF-8 codes needed to pass a URL that contains parameters: ? is %3F, & is %26
Expand Down Expand Up @@ -474,8 +473,8 @@ class ApplicationController @Inject() (implicit val env: Environment[User, Sessi

WebpageActivityTable.save(WebpageActivity(0, user.userId.toString, ipAddress, "Visit_Map", timestamp))
val cityStr: String = Play.configuration.getString("city-id").get
val cityShortName: String = Play.configuration.getString("city-params.city-short-name." + cityStr).get
Future.successful(Ok(views.html.accessScoreDemo("Project Sidewalk - Explore Accessibility", Some(user), cityShortName)))
val cityNameShort: Option[String] = Play.configuration.getString(s"city-params.city-short-name.$cityStr")
Future.successful(Ok(views.html.accessScoreDemo("Project Sidewalk - Explore Accessibility", Some(user), cityStr, cityNameShort)))
case None =>
Future.successful(Redirect("/anonSignUp?url=/demo"))
}
Expand Down
Loading