Giter Site home page Giter Site logo

shift-org / shift-docs Goto Github PK

View Code? Open in Web Editor NEW
22.0 9.0 17.0 171.19 MB

Shift2Bikes: website and calendar for shift and pedalpalooza

Home Page: https://shift2bikes.org

License: Other

HTML 25.48% JavaScript 49.63% Shell 1.84% CSS 22.80% Nunjucks 0.25%
bikes calendar bikefun shift2bikes

shift-docs's Introduction

Overview

The purpose of the Shift/Pedalpalooza Calendar is to empower citizens to create and view bike events and to spread bike fun.

You can see the production site here: https://www.shift2bikes.org

Software

The calendar is split into two main parts: a frontend, and a backend. The frontend is what most people think of the as the Shift website: it includes all of the webpages and static content. The backend holds all of the user submitted rides, and sends emails to users when they create new rides.

The frontend uses:

The backend uses:

Contributing

Frontend development with Netlify

While creating a pull request does automatically deploy a preview of the frontend to Netlify, you can also create previews manually: this could help you do things like theme development in your own repository before submitting your pr.

  1. fork repo
  2. read the comments in the netlify.toml file around changing the build command in the [context.production] section and make changes if needed.
  3. deploy on Netlify by linking your forked repo. Included configuration file netlify.toml should mean 0 additional configuration required to get the site running. If you get a build failure around access denied for ssh, you probably need the advice in step 2 just above this!

If you have trouble with it please file an issue to let us know what you tried and what happened when you did.

Local development with Docker

The production backend is run in several docker containers; including nginx, mysql, and the node server.

The docker configuration also supports running your own frontend and backend server locally. The following steps assume a Linux, or MacOs development environment. On Windows, you'll need something like the Windows Subsystem for Linux.

  1. Install Docker: https://docs.docker.com/get-docker/
  2. Download source code: git clone https://github.com/shift-org/shift-docs.git
  3. Start shift site: cd shift-docs ; ./shift up
  4. If you're standing up the site for the first time, add database tables with the setup script: ./shift mysql-pipe < services/db/seed/setup.sql.
  5. Visit https://localhost:4443/ . If this leads to an SSL error in chrome, you may try flipping this flag: chrome://flags/#allow-insecure-localhost

Note that no changes to the filesystems inside the container should ever be needed; they read from your local filesystem so updating the local FS will show up in the container (perhaps after a restart). Updating, changing branches, etc can be done with git commands outside of the container (git checkout otherbranch or git pull).

So - now you can hopefully access the site. But a real end-toend test of yoursetup, would be creating an event:

  1. visit https://localhost:4443/addevent/
  2. fill out all required fields (ones marked with an asterisk), for a date a day or two in the future.
  3. save the event (fix any validation errors around missing fields to ensure it saves)
  4. In production, we send you an email with a link to confirm the ride listing; we also write a copy of that email to the file services/node/shift-mail.log. For local development, we don't actually send the email, so get the confirmation link from that mail log, visit it, and hit publish event
  5. hopefully see your event on the https://localhost:4443/calendar page!

Important Project Files

  • docker-compose.yml

    • docker container settings
    • The defined containers (db, nginx, etc) become pingable host names from the other running containers. For example, attached to the nginx container, you can "ping db"
    • Contains the container specific mappings between host and docker container persistent volumes.
  • shift

    • This is the convenience wrapper that sets up the environment and has various convenience sub-commands to connect to the environment and manipulate it as well. This is how you'll start the project, connect to the database, etc!
    • contains environment variables that get loaded and are then available for docker to import. Docker environment variables that will be important are defined separately for each container (see: docker-compose.yml). Run env inside an attached docker container to see the variables that made it into the running container.
  • secrets and secrets.override

    • these are the credentials to connect to your local instance. You should change them if you host your site allowing public connections!
  • shift.overrides and shift.overrides.production

    • these are the local (potential) configuration overrides, that aren't secret

Shift subcommands of interest

  • ./shift attach node
    • node is a reference to the named docker container. Note that you want just nginx, db or node not the full image name (shift_nginx_1)
    • Attaches to the running docker container in the shift stack
  • ./shift up
    • If necessary, first builds, and then starts up the docker containers (will also restart if run while the environment is already running.)
  • ./shift logs nginx
    • Will start tailing the logs for the specified container (nginx in this case)
    • multiple container names can be mentioned
  • ./shift down
    • stops the docker containers

Docker Daemon commands of interest

  • docker ps
    • lists all of the running process and port information from docker (ex: you can see the postgres service port)
  • docker volume ls
    • This will show the persistent volumes that docker knows about. The shift project volumes are prefixed with shift_
    • The "shift_" docker namespace comes from the shift file: export COMPOSE_PROJECT_NAME="shift"

Local development with Node.js

You can also do local development with node. These steps will setup a local node server which, by default, acts as both frontend and backend.

After cloning the repo, install node (currently Node.js v20). Then, open a command prompt or terminal window, change to some useful directory for development, and do the following:

  1. cd shift-docs
  2. npm install
  3. optionally, create some placeholder events with: npm run -w tools make-fake-events
  4. npm run dev
  5. browse to http://localhost:3080, and you should see the site running locally.

When you new create events, the link for activating those events will be written to the terminal. ( In this mode, Sqlite is used instead of MySQL. )

Node tests

If you are writing javascript code in the node backend, you can test everything is working as expected using npm test.

Local previews using production data

As an alternative to npm run dev, you can preview a local frontend with the actual production backend by using: npm run -w tools preview.

NOTE: any events you create while previewing this way will be seen by the world!

Ethereal email

Before executing npm run dev, you can configure email debugging using npm run -w tools new-ethereal-cfg. It will generate a shift-email.cfg file in your bin directory which will be used when adding new events. Use the username and password listed in that file to check for emails here: https://ethereal.email/login.

No actual emails are sent when running this way.

shift-docs's People

Contributors

austingil avatar carrythebanner avatar crowmagnumb avatar dduugg avatar dependabot[bot] avatar designosaur avatar ejfinneran avatar ejpevents avatar fool avatar ionous avatar jongarrison avatar keneucker avatar onehwang avatar onewheelskyward avatar pappasilenus avatar sdobz avatar stephaniecp avatar stevensawtelle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shift-docs's Issues

update pedalpalooza content on calendar (per request from Meghan S)

The following are requests from the social and pedalpalooza planning teams. These are changes needed to the new calendar/fun-view rather than the legacy site. They were communicated via email thread a few weeks ago to Josh and I, but not added here in a place where the team could see them, so here we go:

  1. Add 2018 to the Archive: http://www.shift2bikes.org/fun2/pedalpaloozaArchive
  2. Update the 2017 image to the 2017 image, not the 2018 here: http://www.shift2bikes.org/cal/viewpp2017.php (done)
  3. Make a new landing page for 2019 "classic cal" view. Here's the 2018 one: http://shift2bikes.org/cal/viewpp2018.php (won't fix, since this is a legacy page.)
  4. Replace the banner image on http://www.shift2bikes.org/fun2/pedalpalooza with this image until we have a 2019 image: https://drive.google.com/file/d/1MejV45nLapnjoAps6I9ArD7BGkrrDJ-X/view?usp=sharing
  5. Remove the card images beneath the Paypal Donate button so it just says "Donate" here: http://www.shift2bikes.org/fun2/pedalpalooza
  6. Update http://www.shift2bikes.org/fun2/pedalpalooza to have 2019 language. Below is the requested update:

Pedalpalooza!

About

Pedalpalooza is a month of bikey fun. With hundreds of different events, most organized by individuals, bikers of all persuasions are likely to find many events of interest. Nearly all events are free.

Add your events for 2019 now! Seeking inspiration? View the Pedalpalooza archives of past bike fun events. If you need help creating or editing an event, contact the calendar crew

Donate

calendar: Replace raster icons with SVGs

SVGs are resolution independent and will look good on any screen at any zoom level. They can also inherit CSS colors so they are more easily adapted and re-used. There are some accessibility advantages as well (such as automatic re-coloring in Windows High Contrast mode, whereas PNG icons won't). Lastly, the visual style of the existing icons is a bit inconsistent, so a visual refresh would be nice.

Some of the calendar icons have already been done (location pin, organizer, expand/collapse arrow) but there are still more to do (start time, website, etc.).

fix 404 page for netlify

need to route netlify's static/404.html to our "real, editable by CMS 404 page" in content/pages/404.md

fix outgoing emails

Sometime in the past week email from api.shift2bikes.org stopped working. Need to diagnose and fix

calendar: ability to go back in time

Overview

There's no good way to scroll back a few days from today, or to go directly back to a prior time period outside of an old pedalpalooza archive.

Requested by

Requested by community members Johnny and Meghan

content: Review http://old.shift2bikes.org/allbike.php to see if any of that info needs to come over

Should probably work with the communications committee on this. In there we have:

calendar: Add Event - choosing Cancel > Discard Event doesn't do anything

  1. Navigate to Calendar > Add Event
  2. Choose Cancel button
  3. In the confirmation prompt, choose Discard Event

Result: The confirmation prompt is dismissed, but otherwise nothing happens.

We could either:

  • Make "Discard Event" redirect to the regular Calendar page.
  • Just get rid of the Cancel button. People can just abandon the page if they want to discard an in-progress submission.

calendar: create iCalendar feed for "all future event data"

Overview

We got so involved in remaking the web calendar that we forgot that most people would rather use their own calendar (usually google or apple calendars) :P. Supporting this standard should give us both: https://en.wikipedia.org/wiki/ICalendar

We have fixed the pedalpalooza ical feed in early June 2021, and just need to port this to a "general calendar" version now!

Related

Might be able to reuse some code from RSS implementation: #61 or the legacy codebase that had this: Shift2Bikes/shiftcal@b053a31

Requested by:

Requested by community member Johnny. fool would like it too, and at pedalpalooza time it would be cool++;

remove dates from (almost all) frontmatter

we don't need to show last updated on anything except the playbooks, IMNSHO. If we do this we will also have to:

  • reconfigure the CMS to not require the date field,
  • and make sure hugo doesn't barf if we take it out.

sync netlify.toml settings with UI

from netlify build logs. fool can sync these up here: https://app.netlify.com/sites/shift-docs/settings/deploys

2:10:34 PM: Different publish path detected, going to use the one specified in the toml file: 'site/public/' versus 'public' in the site
2:10:35 PM: Different build command detected, going to use the one specified in the toml file: 'hugo' versus 'mkdir public && hugo' in the site
2:10:35 PM: Different base path detected, going to use the one specified in the toml file: 'site/' versus '' in the site

calendar: "send email to creator with the edit link" button for each event, in expanded view.

Someone who created their recurring event on the old calendar wanted to edit the event. I had to make them a password (I did this in the DB directly) and construct the edit link for them. This worked but it required me to ssh into the server and understand the table layout and know SQL.

I think there should be a button for "resend edit information" in the calendar that would send to the event creator an email:

  1. if a password is already set, it would just contain a reminder of the existing edit link
  2. otherwise, it would create and save a password, and send the edit link using it

This would let people self-serve on getting a "reminder" of their calendar password editing link (the single most frequent help request outside of bugs)

calendar: Improve contrast of link color

I love the continuation of the classic site's orange theme on the new site. But there are a couple of places where orange is used for text on a white background, and it be a little difficult to read. It looks OK whe sitting on a laptop in a well-lit room, but it gets tougher when you are looking at the site on a mobile device in direct sunlight, etc. We expect people to use the site when out & about, so this is a likely scenario.

The usual standard for text color contrast is 4.5:1. When the current #FF8D00 orange is on a white background, the contrast is 2.3:1. (The exact meaning behind the ratio isn't particularly important, there are tools that do the math for you.)

There are numerous ways we could solve this and it comes down to which one we prefer aesthetically:

  • Darken the current orange until it meets 4.5:1. Orange and yellow are notoriously difficult for color contrast, though. By the time you make them dark enough to meet the recommendation, they are more of a muddy brown than orange or yellow (e.g. #B36100).
  • Use a different color already in use somewhere else on the site, such as the #0066BB blue used for some links on the calendar.
  • Stick with the existing orange, but use it as a background highlight color behind the link text instead. (We would need to use a relatively dark text color for this to work.) This can look a little busy on pages with lots of links, but if we want orange above all then it is an option.
  • Use another color entirely that we're not using anywhere right now, like green.

theme: do not show date listing from posts

Several beta testers' feedback mentioned that the dates showing on every page seemed useless or misleading. So I updated the CMS to not require the date and removed it from frontmatter on all pages except a couple where it seemed relevant.

Now all pages show "January 01 0001" as the date:

image

Could we get the theme updated so it doesn't automatically show the date? It's ok if it shows dates that are in the content (so: https://www.shift2bikes.org/playbooks/technology-playbook/ is ok if it stays) or if it doesn't, either way is fine.

Assigning @stephaniecp but she can turn me down if she wants :)

get legacy editing tools working in docker

@sdobz gave some notes that we're going to see if fool can decipher following the docs.

  • find mapping for files into php
  • update nginx configuration for php file location
  • takes URL tells php where the URL is on the filesystem

Starting in docker-compose.yml and mounts from filesystem

calendar: Document Calendar API

We need to document the calendar API used by the back end. Most important is the read-only events endpoint, but documenting the full CRUD cycle would be useful. This should be in the form of API.md in the docs folder of this repo.

This is a necessary precursor to writing some kind of tests to run against it, so we can be confident that we're not going to break it when we make changes.

calendar: reimpliment the pedalpalooza "month-long archive" view using the new codebase

on the old site, http://www.shift2bikes.org/cal/viewpp2017.php looked like the below screenshot. I couldn't capture a long enough shot but at the bottom should be a day-by-day ride listing. @sdobz suggested that we could "remake" it using the new codebase since it's basically 3 things:

  1. static: poster image for $year + header info which talks about dates and number of rides
  2. dynamic: month-long calendar view
  3. dynamic & existing already: long calendar listing by day

image

These are mostly linked from and used from the archive page (docs.shift2bikes.org/archive/pedal-palooza-archives/) and is more important than simply a record of what happened - it's also an inspiration to future ride creators to browse what happened last year and in the more distant past.

fix CMS editing

at present whenever anyone tries to edit in the CMS they get an API_ERROR: failed to persist entry.

Footer should not say copyright

The footer says "Copyright (c) 2018, Shift2Bikes; all rights reserved." This information should be removed as there is no copyright, and the web development team is operating under the MIT license.

theme: document how menus on site are built and how theme is used

@carrythebanner and I had some trouble debugging a collision in page names that causes hugo to error out like this:

Error: Error building site: "/Users/jhetrick/Documents/z_etc/shift-docs/site/content/pages/pedalpalooza.md:1:1": duplicate menu entry with identifier "Pedalpalooza" in menu "main"

We were at a bit of a loss to figure out:

  • what file was conflicting
  • why it mattered (the same-named files were in different directories and shouldn't have conflicted).

What this issue requests is:

  • an explanation of how the menu layout is created (we think it's largely based on frontmatter that exists in only SOME markdown files?). I'd suggest this belongs somewhere in the docs/ directory so people follow the intended pattern when creating new content. Maybe includes a "best practices for using/modifying this theme" too?
  • some suggestions of how to debug problems like that. We never actually "solved it" - just worked around by renaming his page to something different.

Thanks for your help!

Adding a mailing list page

All throughout the site, there are external links to riseup.net for the Shift email list. Notably, there's one in the top-level nav (under Community).

There should be a static content page for the mailing list which explains what it is, how to join, etc, with links out to riseup.net. Most or all of our content should then link to this mailing list page.

calendar: Create tests for API and front-end

It would be helpful to have a suite of tests that we can run to verify that important functionality still works. They should at least be available to run manually in your local dev environment; bonus points for automatically running on PRs, etc.

There are two main classes of tests needed:

  • API
  • website front-end

Conventional wisdom is to write tests in the same language as the application, so the dev environment and dev knowledge can be maximized. (So, PHP or Javascript in our case.) In practice, the best tests are the ones you actually run, so whatever we can reliably maintain is best. A lot of test frameworks use custom DSLs anyway, so aside from some syntax familiarity there may not be a ton of efficiency either way.

Fix logo alignment on mobile layout

When viewing the site on a mobile device/small screen, the Shift logo is right-aligned and can interfere with the hamburger menu. I might have caused this back when I switched the logo to SVG (#22).

calendar: save event submission data before trying to process it

when people get a "server error" for saving their event, we can't tell what they did, and their description/partial repro data often doesn't show the problem again. So then we can't debug :|

It'd be awful cool if we could somehow save the data before trying to "do whatever might lead to a server error". I don't even know if that makes sense, but it would help us help them get it re-entered, and also letus debug whatever caused that...

theme: Update shortcut icons

On some platforms, there are additional icon files beyond the standard favicon for home screen shortcuts, bookmarks, etc. These icons may also be used for share links (see also #94).

For example, on my phone my bookmark for the Calendar page now shows an underlined "U" (which I guess is a default Hugo thing?).

bookmark_icon

content: link to hugo pages for pedalpalooza/etc

This is a feature request.

Now that we have the CMS working on all the content under /pages, it would be great if some of the other not-exactly-calendar content that is currently embedded in the calendar lived there too:

hamburger/nav menu doesn't work on iphone

site nav does nothing (no links are ever shown/available on the iphone: the hamburger menu doesn't do anything if clicked.

Even without an iDevice, you can repro in safari using dev tools -> "responsive design mode":

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.