Giter Club home page Giter Club logo

muncie-events3's Introduction

Build Status Test Coverage Code Climate Issue Count

Muncie Events

This is the repository for the Muncie Events website, developed with the CakePHP web development framework. Note: this is an in-progress upgrade from CakePHP 2.x to CakePHP 3.x.

muncie-events3's People

Contributors

ericadeefox avatar phantomwatson avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

muncie-events3's Issues

Event Form Datepicker

The datepicker on the event form isn't actually inputting any data. While the actual js works, looks good, does all the front-end things it's supposed to do, it doesn't communicate at all with the app itself.

private function __prepareDatePicker() { // Prepare date picker if ($this->request->action == 'add' || $this->request->action == 'edit_series') { $dateFieldValues = []; if (empty($event['date'])) { $defaultDate = 0; // Today $preselectedDates = '[]'; } else { $dates = explode(',', $event['date']); foreach ($dates as $date) { list($year, $month, $day) = explode('-', $date); if (!isset($defaultDate)) { $defaultDate = "$month/$day/$year"; } $dateFieldValues[] = "$month/$day/$year"; } $datesForJs = []; foreach ($dateFieldValues as $date) { $datesForJs[] = "'".$date."'"; } $datesForJs = implode(',', $datesForJs); $preselectedDates = "[$datesForJs]"; } $this->set([ 'defaultDate' => $defaultDate, 'preselectedDates' => $preselectedDates ]); $event['date'] = implode(',', $dateFieldValues); } elseif ($this->action == 'edit') { list($year, $month, $day) = explode('-', $event['date']); $event['date'] = "$month/$day/$year"; } }

A forethought: this was written in Cake2, initially, so basing all of this off of $event['date'] made sense because $event['date] just represented $this->request->data['Event']['date']. With Cake3, it doesn't do that, and so any form data like that has to be passed back to functions like __prepareDatePicker().

Something to try, then, is passing $event from the add() or edit() actions.

Delete buttons on hair-trigger alert

Accidentally deleted an event because I was clicking and not paying attention. Better add some front-end validation to make sure admins can't do that.

Moderation feedback

There are enhancements that we could consider giving the moderation process to help correct user misbehavior and hopefully shift the burden of ensuring content quality from administrators to users even more:

  • When an administrator edits an event, a message gets sent to the original poster describing what corrections were made
  • The composition of this message could be largely automated with a client-side script that listens for input field changes and adds lines like "Edited event title" to a list of changes, with a text field for optional admin elaboration, like "Edited event title (removed location name)", "Edited event title (fixed typo)", or "Edited event title (all caps? seriously?)".
  • If an event is deleted, the moderation-action-explanation section could show a list of rules that could simply be selected to automatically compose a "SHAME ON YOU" message

Uploading images

Expected flow:

  1. User uploads an image.
  2. Image comes and can be reordered as needed.

Actual flow:

  1. User uploads an image.
  2. Image ends up in "Select a previously uploaded image" area.
    3. User can select the image from there.
    4. Image comes and can be reordered as needed.
    3. That's it.
  3. User can select the image from there.
  4. Image comes and can be reordered as needed.

So images still get uploaded and can be used, joined, etc. but there's extra steps for no reason.
EDIT: Just kidding, images aren't being joined either. They get uploaded but they just don't do anything beyond that.

List of dates in the header calendar not displaying

Expected behavior:

In the header, in the calendar with the datepicker, there's supposed to be a list of the next seven dates that have events on them.

Actual behavior:

There isn't that list? It's not displaying.

Pagination formatting issues

For the pagination.ctp element

  • I recommend only displaying "first", "prev", "next", and "last" elements when they can be interacted with. I now think that my old idea of displaying those useless elements as kind of a visual placeholder is probably dumb.
  • The old pagination element bizarrely used single-quotes for some of its HTML element attributes, which should be fixed. But this only applies to the elements that I recommend removing, so *shruuuug*
  • The new line that reads "showing X records out of Y total" is a bit weird to me. I recommend one or more of these:
    • Take out "page X of Y" because the <select> element already provides that information
    • Take out "showing X records out of Y total" because it's low-priority information that can already be basically discerned from everything else on the screen
    • Change "record(s)" to a string that actually reflects what model is being shown and whether it should be singular or plural. Bonus points for making this automatic! ๐Ÿ˜€

As always, feel free to debate any of my recommendations. ๐Ÿ˜ƒ

Upgrade library in tag manager

We're using extjs 2.0.1 for our tag manager, when we really ought to be upgrading to 6. The tag manager currently also uses presentation images that are not either marked with role="presentation" or alt-text.

"#" selector for alphabetized tags & locations lists not working.

Note: it's like this in the 2.x version as well.

If you click the "#" selector in the tags breakdown by letter, or the new locations breakdown by letter, you won't get any of the tags or locations that start with numbers. I think with how it's written, it's looking for tags & locations that literally start with the hash symbol.

Custom tags

Users need to be able to add custom tags when creating/editing events.

Mailing List/Categories confusion with new ORM

Suppose one is trying to save some Categories/Mailing List data to the join table, by creating $this->MailingList->Categories->link($mailingListWeekly, [$general]);

Due to the fact that there's a field in mailing_list called categories, the ORM perceives this to be an attempt to modify a string rather than join data. However, suppose you try to save to the categories field, doing something like $this->MailingList->categories = 13, you'll receive an error for trying to save an integer or a string as a whole new object in a join table.

The long & short is that, now, fields in MySQL cannot share names with tables. It confuses the ORM.

URI Character Confusion

Routing/URLS not accepting %2F as a URI character. Sometimes apache rejects %2F & %5C (which is the \ slash) but it weirdly accepts %5C... and every other URI character I tried.

Therefore, tags or locations with symbols in their names cannot be indexed.

Big Official 2.x to 3.x Upgrade List of Issues

  • The month method URL reads /month/MM/YYYY. However, due to weird counting or whatever is happening there, advancing past December into January reads not as /01/YYYY, but rather /13/YYYY of the previous year. e.g. if you want to check out January 1992, you can put /01/1992 into the URL, but you can also put /25/1990 into the URL.

  • Month widgets only show the current month; using the prev & next buttons take you to month pages. Clicking prev & next buttons does not open the in-widget month.

  • Feed widgets show all the events at once, rather than a couple weeks at a time with a "More Events" button.

  • Clicking events in the feed widgets opens the event page, rather than the in-widget event.

  • Locations & custom tags don't autocomplete in the event form.

  • The mailing list might work? I don't know if it does and I don't know how to test it.

  • "More Events" button appears 100% of the time in indexes, even if there are literally no events to index.

  • The paginator buttons are ugly & awkward.

  • The index breaks if the events are more than two weeks apart.

BOLD INDICATES HIGH PRIORITY

Exporting events

The ability to export events from iCal, Google, Outlook, and Yahoo!* needs rebuilt still from Cake2 to Cake3.

*I am totally okay with not giving anyone the ability to export to Yahoo!

Restore old frequency interface for mailing list signup form

In /mailing-list/join, under "frequency", the current site's weekly/daily radio buttons are missing and only the checkboxes for the "custom" option are shown.

Here are my arguments for why the "custom" part of the form was originally designed how it was:

  • By default, the most common option (weekly) is already selected
    (this requires one click in the new version)
  • The second most common option (daily) is one click away
    (this requires seven clicks in the new version)
  • The form explicitly says what the content of a daily or weekly email is, so the difference between a "daily email every Thursday" and a "weekly email every Thursday" is clear
    (this might be ambiguous to some people in the new version)
  • Inputs that won't be relevant to most users are hidden by default, reducing visual clutter

New features for user images

In the Cake3 version of Muncie Events, users will be able to upload images for their profiles, awesome! Here are some new features to be added:

  • Expand the user images when you click on them, just like how you can do that on the events images.
  • Show thumbnails of users' previously uploaded images.
  • Allow the user to select from their previously uploaded images which one they'll feature on their profile.

Rebuild widgets controller

What the widgets controller can do:

Create a page showing where the widgets ought to go.

What the widgets controller cannot do:

Actually show the widgets. Or customize them. Or do anything else.

A list of what needs done to build the widgets controller & related actions is forthcoming.

$this->request->data is deprecated.

$this->request->data is a deprecated method, to be replaced with $this->request->getData(). However, the two are not analogous. The method for setting custom tags in the Events Controller is dependent upon $this->request->data, it works perfectly with that method, but the method is deprecated.

Everything needs paginated

Every index except for the main upcoming events index is supposed to be paginated.

Number of indexes currently paginated: 0.

Cannot add tags to events

Time to figure out why tags & events aren't linking this time.

$event is coming through as an array as opposed to an object. That's a bad sign?

Session stuff.

1.) Login redirects do not actually redirect to the location set in the URL. The user is just redirected to /
2.) Users are logged in for 15-30mins before being logged out. Need to set that longer.

Images can't be deleted or moved

Here's where we're at with the events images:

  • Users can upload images for events.
  • Those images get resized twice into a small & thumbnail version, and all three images get loaded into /img/events & subfolders.
  • The filename for the main image is then echoed so that, using ajax, the front-end plugin/image uploader can get the image data. The user can then add captions, change the order the images will be displayed in, etc.
  • When the event is submitted, a link is created between the event & the image, with data stored in the EventsImages table.

All we need is to join the two tables and create these links. Then the events will have full image functionality.

Convert everything to UTC

So, this is going to be a multiple-step process that changes how things are stored in the database. We currently have date, time_start & time_end fields which store data as DATETIME objects in the form of, respectively, date('Y-m-d') and date('h:i:s').

Our objective will be to consolidate these fields to start and end, and convert their values to UTC. That way, we can create an API for Muncie Events.

Step 1: Migrating everything in the database

  • 1.) The field start will need to be created in the events table, as a non-null string field.
  • 2.) For each row in the table, the start field will be populated by merging date and time_start, and converting to UTC.
  • 3.) Then, the field end will need created as a null string field.
  • 4.) Most rows will just be null, but rows that aren't null will need to have end populated by merging date and time_end.

Step 2: Create a model method for converting to UTC

  • 0.) A lot of the legwork for this has been done already in the events element actions.ctp.
  • 1.) Create a model method whose job is to take form data from the add() and edit() events methods, and convert the current date, time_start, and time_end fields to start and end UTC fields.
  • 2.) Add this method to any controller methods which store events date & time data, or date & time data for series.
  • 3.) This method should also be used to create links for actions.ctp.

Step 3: Create a model method for converting from UTC

  • 1.) Create a model method whose job is to take data and convert it from UTC to easy-to-print date() formats.
  • 2.) Go into all the controller methods to do with viewing, indexing etc. events and create view variables with the model method.

Step 4: Final steps

  • 1.) Change the name of "Daylight Savings" to "Daylight Saving".
  • 2.) Everything work right? Everything look OK? 5.) After all the rows have been populated successfully and the data can be accessed properly, date, time_start, and time_end will be deleted.

Hopefully this will prevent us from having to touch the front-end at all. Thoughts?

Main events index is being populated by literally every event

Expected behavior:

The events index is populated by roughly 10-20 events (or 5-10 days of events, what have you), then a "More events..." link or button sits at the bottom of the page and, when clicked, loads 10-20 more events--until there are no more events to load and a flash message saying so comes up.

Actual behavior:

Right off the jump, the events index is populated by all of the events from all of the upcoming days. The "More events..." link still sits at the bottom but, when clicked, displays an error message.

I'm sure this just has to do with renaming variables for the js files that control the index.

X:00 time should read X AM or X PM

Event times at the top of the hour ought to have :00 removed when they display. e.g. if an event is at 9pm, it should read 9 PM rather than 9:00 PM.

Routing for new categories

Current routing system doesn't allow for any future, unnamed and un-slugged categories to have their own indexes. Need to set it so that there's a global variable that gets populated based on what the categories are.

Tag Manager: none of it is functional

Here's all the sections of the tag manager:

  • Arrange
  • Add
  • Remove
  • Edit
  • Merge
  • Find
  • Fix

These will be checked off as they are completed and fully functional.

Front-end overhaul issues

These issues are strictly for the 3.x version of Muncie Events, although the 3.x version shares some with the 2.x version. Those issues are noted in the 2.x repository.

  • In /events/add, there is no warning for if the user is not logged in.
  • There is no Recaptcha for the /register page, nor is there an option for the user to join the mailing list.
  • Tomorrow's events in the event accordion read as "This (whatever the next day is)" rather than "Tomorrow".
  • Tags still needs paginated and divided by past & upcoming events.
  • Locations still needs paginated and divided by past & upcoming events.
  • For mailing list signup, there are no non-custom frequency options. The header also reads "Join Our Mailing List" when it should read "Join Muncie Events Mailing List".
  • People who are not logged in can add images in /events/add. They shouldn't get to do that.
  • The Recaptcha disclaimer in /events/add has been removed and needs put back.
  • The dates for moderation aren't printing properly.
  • Age restrictions don't display in the events accordion.
  • In /account, it reads "Your" when it should read "My" in the header.
  • After logging out, users are just redirected, instead of being taken to some kind of thank-you window.

Fix CreateUtcTimes migration

Remove commented-out code from the CreateUtcTimes migration and move it to a RemoveTimeColumns migration, to be committed once nothing needs those columns anymore.

Sidenote: Despite earlier reckonings, all things considered, I think we should keep the date field as-is. It should make filtering by date way simpler than converting timezone-adjusted Cake\I18n\Time objects into and out of 'YYYY-MM-DD' strings.

Location correction-suggester

I suggest this, to help reduce the rate of users entering variations on the names of locations (despite the location name field providing automatic suggestions) and administrators needing to manually correct for that:

Location correction-suggester:

  • Triggered when the location name field's value is changed and is nonempty
  • Displays a limited number of suggestions, ordered by similarity, if
    • The location name is not found in the database (or rather, in the JS variable eventForm.previousLocations)
    • One or more similar location names are found (according to some threshold)
  • Allows the user to dismiss the suggestion(s) or click on one to change the value of the location name field

Tag auto-complete & whitespace

Tag auto-complete is activated when someone enters just a space. It's unlikely that a user will begin entry with a space, but it's certain that they'd reach a point when entering two tags when they've entered one, then a comma, then a space, at which point they'd get an arbitrary set of autocomplete suggestions.

Also, for some reason, the FBRLH URL is appearing in the tag auto-complete field, because the FBRLH is like my picture of Dorian Gray.

The big fancy list of Facebook features!

The Cake2 version of the site had a really easy-to-develop but sort of limited plugin for using Facebook's API. With the new plugin, here's all the things we're going to do with Facebook's API:

  • Allow users to create an account using their Facebook profile.
  • Allow users to log in using their Facebook profile.
  • Allow users to upload images to events using their Facebook profile.
  • Allow users to upload images to their user profiles using Facebook.
  • Share events on Facebook.
  • Import events from Facebook.
  • Export events to Facebook.

Create a new admin namespace

All of the admin methods and section of the site need moved into a new Admin namespace. So there'll be Controller\Admin and Template\Admin.

Convert character encoding to utf8mb4

All of our text stuff should be converted from utf8 to utf8mb4. @ericadeefox reports in issue #18 that this has been done, but I think we need a migration and a step-by-step plan so we can easily apply the change to all dev machines and the production server.

Bonus: We can refer to these steps when applying these changes to other sites, too.

Steps:

CakePHP

  • Set $config['Datasources']['default']['encoding'] and $config['Datasources']['test']['encoding'] to 'utf8mb4'
  • Search for strpos(), stripos(), and strlen() and replace with mb_strpos(), mb_stripos() and mb_strlen()

Database:

  • ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
    (not sure if there's a more elegant way to put this in a migration, other than $this->execute('ALTER DATABASE...'))

Table columns:

  • ALTER TABLE table_name CHANGE column_name column_name VARCHAR(???) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    (here's an example of how to make this a migration, though I think their change() should actually be a set of up() and down() methodsto make it reversible)

Tables:

  • ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; utf8_general_ci columns:
    (here's an example migration)
  • REPAIR TABLE table_name;
  • OPTIMIZE TABLE table_name;

Notes:

  • This will change the maximum character size from 3 bytes to 4 bytes, so VARCHAR data can reach their size limits with only (size / 4) characters. VARCHAR column lengths should be changed to 4 ร— the intended character limit, and this character limit enforced with CakePHP validation rules.
  • Advice taken from https://mathiasbynens.be/notes/mysql-utf8mb4

Notify Slack when events need moderation

Send a notification to Slack (perhaps in a new #muncieevents channel) when new events get posted in order to reduce the time between posting and moderator actions.

Bonus points: Divide up moderators by days of the week and mention who's currently on duty in the messages, e.g.

Graham: The event "Competitive Pantomime Regional Championships" has been posted by M. Goldman

User validation

  • Emails need to be emails.
  • Emails need to be unique.
  • Emails need to be validated and display error message if they're not emails or unique.

App is missing proper SMTP settings

Not really an issue, more of a reminder: when I started doing this, I never actually got the proper SMTP settings and thus I can't add them to the dotenv and also the mailing list, contact form, and password reset don't work.

Unable to delete tags from events

When a tag is deleted from $selectedTags in the Events controller, it must also be deleted from $previousTags, which are all the tags that have already been run through the Tag Helper and turned into real Tag Entities from their IDs.

Add time validation

Add validation rules in EventsTable for Events.start_time and Events.end_time.

Export options in actions.ctp

  1. The dropdown needs converted to Bootstrap, both here and on the Cake2 version of the site.
  2. The iCal is saving dates in UTC, not UTC-5.
  3. More export options are necessary, perhaps using Facebook to export as an event.

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.