* poll rework
* forgot to do joinedload on comments
* Fix logic errors with voting, SQL syntax.
Kitchen sink commit from review of poll-rework changes:
1. Fix seed-db.sql syntax error.
2. Fix SQL patch file duplication of *submissions* tables rather
than one set of submissions and one for comments.
3. Start makeshift SQL patch folder, since this is a large change
that contributors may wish to apply to their local instances.
4. Fix checkbox (non-`exclusive`) polls being unable to be
unchecked. For consistency with `exclusive` polls, they should.
5. Fix changing the option of an `exclusive` poll when both
exclusive and non-exclusive options are present in one comment/
post causing the non-exclusive options to become unchecked.
(which, by my reading of SQLAlchemy `Query.one_or_none()`
really could break quite badly in some cases).
* link relationships with their counterparts
* small modification to poll unchecking
Co-authored-by: TLSM <duolsm@outlook.com>
Commit began by changing the duplicated SITE_NAME conditional in the
header to use a `has_logo` param, much like the recent `has_sidebar`.
From there, a need to include site-specific assets in assetcache was
revealed, adding the `asset_siteimg(...)` macro. This was applied
quite broadly, though not comprehensively.
The /submit frontend has special behavior to prevent the confirmation
prompt before navigation away onbeforeunload. This is to suppress the
prompt when navigating away via submitting the form as part of the
intended workflow. (otherwise pressing 'Post' looks like you're about
to lose your input.)
This has been extended to the /h/<sub>/submit pages also by correcting
the condition in the frontend logic.
The header dropdown menu's horizontal positioning depends on the
width of the user pfp/username/currency region to not overflow off
the right side of the page. Therefore, we enforce a minimum width.
There is presumably some way to fix this by right-aligning the right
side of the dropdown menu to the right side of the dropdown header.
I didn't want to risk it given the strange interplay of all of the
Bootstrap styling and the media queries. Also, it does visually
look better to be left-aligned.
Previously, Markdown ordered lists in user content (in posts,
comments, previews, etc) would display like this:
1.
Foo bar baz.
This is because sanitize populates them as <li><p>Foo bar baz.</p></li>
Rather than mess with the Markdown engine and still not have backwards
compatibility, this has been solved in the frontend using CSS to force
the <p> to display inline.
These are all minor and uncontroversial enough it just felt gross
making multiple commits.
- Adds marseymummified.
- Changes the new `raise ValueError(...)` in badge_grant to
an `assert`.
- Expands assetcache to a convenient grab bag of JS files.
Kitchen sink commit of semi-related things:
- `#profile--bio a` tags didn't properly wrap on mobile with some
browsers. Changing overflow-wrap may fix this.
- Userpage markup for mobile tried to place profile_bio inside a
<p> tag. Nesting paragraphs is invalid HTML. It has been made a
<div> to match desktop and even nearby sections on mobile.
- Fedi icon in mobile dropdown had the wrong classes, which broke
consistent styling with its neighbors.
- fa-square-share-nodes improperly wound up with the fa-share-nodes
character code when committed.
The sidebar previously did not prioritize information as well as
desired, and the proliferation of megathreads led to a number of
icons occupying frontpage visual space despite not often being
useful to frontpage use cases. Therefore, they have been moved to
a new page.
The /directory page is predominantly created with template logic,
and it should be within the ability of our semi-technical jannie
staff to maintain.
Despite being very fun, this fixes the recently discovered bug where
placing '#' or '!' within the 'pat:' suffix of a patted emoji causes
the enclosing <span> to not be given the proper CSS `display` or
`position`, leading to the hand being sized relative to the comment
bounding box rather than the emoji box.
This should be backward compatible. The only posts it wont fix are
existing ones with the giant hands. Main example being:
https://rdrama.net/h/slackernews/post/76302/
Previously, the three instances of 'Report[s]' and one instance of
'Coin[s]' in the UI templates were always pluralized, even when they
referred to a singular instance. This has been corrected by creating
a `plural` helper macro.
Additionally, this was used as impetus to create `utils/helpers.html`
to eventually move more recurring template logic into macros.
- Increment cache version on popover badges.
- Add comments+submission_listing.js to assetcache to support ^.
- Append new words to wordle list.
- Cache bust assorted assets for recent PRs.
Assetcache: now supports js/userpage.js & js/userpage_v.js.
The three userpage*.html templates now implement it.
Revising gift messages 16587cdf7cf5:
- routes/users.py: Deduplicate code, more descriptive var name.
- templates/userpage.html: Move post-tax gift line below reasons
box. Ultimately just an aesthetic change.
Also includes moving styles to main.css and reducing font size per
request of Carp.
Additionally: includes the modlog sidebar link that I forgot to stage
with the previous commit.
After the recent addition of the Lottershe, some narrow phone screens
caused the header to wrap to two lines. Prompted by this, a more
general rework of the header nav icons was initiated.
Notably: random user, random post, all comments has been moved to
sidebar on all sites, and a .sidebar-link CSS class was created to
support it. Additionally, on rDrama, links for Badges and Marseys
were added, since I believe these are presently inaccessible from
the UI. Further, a Modlog link was added to be more accessible.
Additionally, the icons in the header were rearranged on desktop and
mobile to better fit relative priority.
Assetcache macro improvement: to support assets in folders which are
dynamically referenced by e.g. ID or name, the `asset` macro now
accepts an optional second parameter to be included in the path but
not to be used for versioning the class of assets.
To support recent commits, assetcache now applies for:
- images/badges/*.webp
- js/: award_modal.js, bootstrap.js, header.js
For too long, we've Replace-All'd to increment site asset version
numbers. This is a task that has an obvious solution using the
templating engine. As such, we now have templates/util/assetcache.html
which contains a dict of version numbers and a macro to generate the
versioned name of an asset.
Going forward, it is recommended that all future replace-all uses
are used as opportunities to switch to the macro. Do remember to
import the macro in all top-level templates, if not already present.
Recommended form: {%- from 'util/assetcache.html' import asset -%}
Then add a key to CACHE_VER in util/assetcache.html.
Then replace the asset path in templates eg: {{asset('css/main.css')}}
For all future versions of those assets, one can simply increment
the value in util/assetcache.html instead. This will greatly reduce
git spam touching unrelated files and generally be clearer and easier.