Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add location alert fields to homepage widget
** Why are these changes being introduced: * There is an upcoming closure to the Hayden library, and we want to enable UXWS staff to be able to add alerts to the homepage for cases like this without asking for EngX to modify static templates. * After discussing the needed feature among themselves, UX has decided that a separate field for homepage alerts was preferrable, because that space frequently needs a single line of text that does not replicate the uses of the existing title and body fields for the current alert information. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/pw-93 ** How does this address that need: * First, we add a new field to the Location Attributes fieldset, named alert_frontpage. This field appears next to the other location alert fields (alert_title and alert_content), with help text advising that this new field should only have links added to it. * Second, we add a function to hte homepage locations widget (part of the hours plugin, for Reasons) to check each location's record to see if this new field is populated. If content is found, it is included in the page below that location's entry. * The styling for this display is taken from the former styles for the Hayden renovation alert, which was statically added to this partial. ** Document any side effects to this change: * The use of a function in the template for the homepage hours widget is a bit of a code smell, but I'm not able to wrap my head around how to write this as a method on the widget class. * This ticket is validating our choice to go with a monorepo for our WordPress application - as the changes being made might have spanned across several repositories in our previous infrastructure (one for the hours widget, one for the parent theme to change the styling, and potentially a third for the data model change - although that may have just been a configuration and not a code change before). * This does not get us entirely away from mixing code and content, as the homepage hours widget still has hard-coded values for other location information (location names, which locations are shown, and in what order, their phone numbers, etc).
- Loading branch information