Commit Graph

641 Commits

Author SHA1 Message Date
evazion
f27a85e879 Merge pull request #5092 from NamelessContributor/issue-5084
Add auto theme preference (fix #5084)
2022-04-09 03:48:39 -05:00
NamelessContributor
91a9153764 css: prevent acidentally opening spoilered links
A small delay on the pointer-events property prevents accidentally
opening a link inside a spoiler when tapping to reveal the spoiler on
mobile.
2022-04-07 11:43:17 +02:00
NamelessContributor
8ea514ad1c css: add auto theme preference. fixes #5084
This is the new default. Users who previously used the light theme will
be migrated to the auto setting.
2022-04-03 18:05:34 +02:00
NamelessContributor
db5918a783 css: rename base/040_colors.css -> scss 2022-04-03 17:39:30 +02:00
evazion
6ad7df0ded news updates: fix updates not being visible. 2022-04-02 18:19:50 -05:00
evazion
10e3416c95 related tags: better tag name selector.
Cherry-picked April Fool's day fix.
2022-04-02 18:19:46 -05:00
evazion
8705b8ec89 Merge pull request #5053 from NamelessContributor/fix-5052
posts: fix sidebar min-width on small screens (fix #5052)
2022-03-22 03:42:41 -05:00
NamelessContributor
3b05abc012 posts: fix sidebar min-width on small screens
fix #5052
2022-03-20 03:09:07 +01:00
NamelessContributor
c3a5ce9019 simple_form: Don't hide hints on mobile. Fix #4997
Hints are displayed below their fields on small screens.
2022-03-15 14:39:37 +01:00
NamelessContributor
3b63174525 post_mode_menu: update preview link selector
Fixes the post-score link triggering the mode menu action as well as
all three score links getting the blue border on hover.
2022-03-09 10:01:09 +01:00
evazion
ca98e218a1 users: don't bold usernames in comments and forum posts.
Make usernames in comments and forum posts take up less space.
2022-03-01 21:23:21 -06:00
NamelessContributor
a43291018a Limit the width of usernames in tables
Fixes the layout issues caused very long usernames in the forum and elsewhere.
2022-03-01 14:59:58 +01:00
evazion
8ef05ec69b Fix #5021: Downvoting/upvoting a revealed hidden comment will hide it again.
Fix it so that upvoting or downvoting a revealed thresholded comment
doesn't hide it again.

The fix is to explicitly store a `data-show-thresholded` flag on the
comment, instead of manually hiding elements with jQuery, and to morph
the comment HTML instead of replacing it so that the state isn't lost
after voting. Alpine.js is used for this, which isn't strictly necessary,
but is useful to test the library before adopting it on a wider scale.

https://alpinejs.dev/start-here
2022-02-28 20:11:22 -06:00
evazion
68ba447494 uploads: remove batch upload page.
* Make /uploads/batch redirect to /uploads/new.
* Remove /uploads/image_proxy.
2022-02-21 00:03:43 -06:00
evazion
3da9c1574f Merge pull request #5010 from nonamethanks/add-mod-report-link
Moderation Reports: add link for moderators to navbar
2022-02-20 22:45:30 -06:00
evazion
202dfe5d87 uploads: allow uploading multiple files from your computer at once.
Allow uploading multiple files from your computer at once.

The maximum limit is 100 files at once. There is still a 50MB size limit
that applies to the whole upload. This limit is at the Nginx level.

The upload widget no longer shows a thumbnail preview of the uploaded
file. This is because there isn't room for it in a multi-file upload,
and because the next page will show a preview anyway after the files are
uploaded.

Direct file uploads are processed synchronously, so they may be slow.

API change: the `POST /uploads` endpoint now expects the param to be
`upload[files][]`, not `upload[file]`.
2022-02-19 00:00:56 -06:00
evazion
77515915a4 uploads: change loading indicator for upload widget.
Change the loading indicator from a progress bar to a spinner. Fixes
issue with the <progress> element having a different appearance on
different browsers.
2022-02-18 03:39:08 -06:00
evazion
093a808a36 Fix #4986: Add ability to filter images in /media_assets and /uploads depending on if they have become posts 2022-02-18 03:39:08 -06:00
evazion
f54fac74c8 Add image icon next to thumbnail size dropdown menu. 2022-02-17 20:31:59 -06:00
evazion
0b8d042c06 uploads: allow changing thumbnail size on My Uploads / All Uploads pages.
* Add a "Size" menu to the My Uploads / All Uploads pages to allow
  changing the thumbnail size.
* Make the My Uploads / All Uploads pages use the same thumbnail size as
  the post index page.
* Change the "Gallery | Table" links on the My Uploads page to icons.
2022-02-16 16:39:28 -06:00
evazion
a14cd3cd8b uploads: increase upload status polling frequency. 2022-02-15 20:45:28 -06:00
evazion
16b8d4b607 uploads: consider uploads as failed when all assets fail.
Make the "completed" status for an upload mean "at least one file in the
upload successfully completed". The "error" status means "all files in
the upload failed".

This means that when an upload has multiple assets and some succeed and
some fail, the whole upload is considered completed. This can happen
when uploading multiple files and some files are over the size limit,
for example. The upload is considered failed only if all files in the
upload fail.

This fixes an issue where, if uploading a single file and that file
failed because it was over the size limit, then the upload wouldn't be
marked as failed.
2022-02-15 17:12:02 -06:00
evazion
e0ed6391f5 uploads: fix related tags error on multi-file upload page.
Fix the related tags Javascript trying to run on the multi-file upload
page. It should only run on the single-file upload page.
2022-02-15 01:00:06 -06:00
evazion
36265dbff0 uploads: autorefresh thumbnails on multi-file uploads page.
Automatically refresh thumbnails on the multi-file upload page as images
are processed in the background.
2022-02-15 00:59:30 -06:00
evazion
02edb52569 uploads: enable multi-file uploads when uploading from source.
Make the upload page automatically detect when a source URL has multiple images
and let the user choose which images to post.

For example, when uploading a Twitter or Pixiv post with more than one image, we
direct the user to a page showing a thumbnail for each image and letting
them choose which ones to post.

This is similar to the batch upload page, except we actually download each image
in the background, instead of just hotlinking or proxying the thumbnails through
our servers. This avoids various problems with proxying and makes new features
possible, like showing which images in the batch have already been posted.
2022-02-14 16:13:55 -06:00
nonamethanks
9ff01c1a4b Moderation Reports: add link for moderators to navbar 2022-02-14 17:22:03 +01:00
evazion
879363b585 media assets: show placeholder thumbnail when image is missing.
Make media assets show a placeholder thumbnail when the image is
missing. This can happen if the upload is still processing, or if the
media asset's image was expunged, or if the asset failed during upload
(usually because of some temporary network failure when trying to
distribute thumbnails to the backend image servers).

Fixes a problem where new images on the My Uploads or All Uploads pages
could have broken thumbnails if they were still in the uploading phase.
2022-02-14 00:41:07 -06:00
evazion
d4b251a079 css: fix site name flickering black on page load.
Fix regression in 7bbe6e9d. Caused by CSS specificity conflict.
2022-02-09 01:04:11 -06:00
evazion
7bbe6e9d22 artists: make artist pages less shit.
* Group URLs by site.
* List most important URLs first and dead URLs last.
* Add site icons next to URLs.
* Put other names and group name beneath the artist name, instead of beneath the wiki.
2022-02-08 22:20:01 -06:00
evazion
ef0d8151d8 js: reorganize Javascript file structure.
Move Javascript files from app/components/**/*.js back to app/javascript/src/javascripts/*.js.
This way Javascript files are in one place, which simplifies import paths and makes it
easier to see all Javascript at once.
2022-02-08 14:15:35 -06:00
evazion
5ba03ba359 replacements: fix submit button not working in Chrome.
Fix the submit button in the post replacement dialog doing nothing in Chrome.

When the submit button in a dialog box is clicked, we tried to fire a 'submit' event on
the form to submit it. Apparently this no longer works in Chrome. `requestSubmit` is the
modern way to programmatically submit a form, but it's not supported by Safari, or by
versions of Firefox or Chrome released before 2019-2020.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit
https://caniuse.com/mdn-api_htmlformelement_requestsubmit
2022-02-07 22:24:54 -06:00
evazion
a5b92dc9e6 css: fix disabled buttons appearing clickable.
Fix buttons appearing to be clickable when in the disabled state.

Submit buttons are normally disabled after a form is submitted. Before
these buttons would still look clickable. Now disabled buttons are greyed
out instead of looking the same as normal buttons.
2022-02-07 21:02:30 -06:00
evazion
fd25cd6868 Fix #4993: IQDB broken on upload page. 2022-02-04 11:12:16 -06:00
evazion
92a4d045e2 media assets: add thumbnail view to /media_assets page.
Add a thumbnail view to the /media_assets page. This page lets you see
all images uploaded to Danbooru by all users (although you can't see who
the uploader is). Also add a link to this page in the subnav bar on the
upload page.
2022-02-02 01:12:56 -06:00
evazion
4ad554e28b uploads: show videos and ugoiras on upload page.
* On the upload page, show the video when uploading a video or ugoira.
* On the upload page, show the filesize and resolution beneath the
  image, instead of above it.
* On the media asset show page, show the full video or ugoira instead of
  just the thumbnail.
2022-01-30 22:39:54 -06:00
evazion
5d2996d0c2 media assets: add media asset preview component.
Add a view component for rendering thumbnails for media assets.

This lets us properly show thumbnails on the upload listing page and the
media assets listing page, including support for high pixel density thumbnails
and video length icons for videos.

Fixes not being able to see thumbnails on the /media_assets page.

This is mostly copy/pasted from the post preview component. FIXME: don't duplicate code.
2022-01-30 22:39:54 -06:00
evazion
09d6c602be uploads: fix long filenames not word-wrapping.
Fix a bug where, when uploading a file from disk, if the filename was
too long, it wouldn't get word-wrapped and could break out of the
containing element.
2022-01-29 05:14:49 -06:00
evazion
5d0c14d2bd uploads: fix file upload component colors in dark mode.
Fix the file upload component blending into the background in dark mode.
2022-01-28 21:15:08 -06:00
evazion
21dcf53dcb uploads: show similar images for disk uploads.
Fix the upload page so that it shows similar images (IQDB matches) for
files uploaded from your computer. Before this only worked for files
uploaded from a source.
2022-01-28 21:07:06 -06:00
evazion
abdab7a0a8 uploads: rework upload process.
Rework the upload process so that files are saved to Danbooru first
before the user starts tagging the upload.

The main user-visible change is that you have to select the file first
before you can start tagging it. Saving the file first lets us fix a
number of problems:

* We can check for dupes before the user tags the upload.
* We can perform dupe checks and show preview images for users not using the bookmarklet.
* We can show preview images without having to proxy images through Danbooru.
* We can show previews of videos and ugoira files.
* We can reliably show the filesize and resolution of the image.
* We can let the user save files to upload later.
* We can get rid of a lot of spaghetti code related to preprocessing
  uploads. This was the cause of most weird "md5 confirmation doesn't
  match md5" errors.

(Not all of these are implemented yet.)

Internally, uploading is now a two-step process: first we create an upload
object, then we create a post from the upload. This is how it works:

* The user goes to /uploads/new and chooses a file or pastes an URL into
  the file upload component.
* The file upload component calls `POST /uploads` to create an upload.
* `POST /uploads` immediately returns a new upload object in the `pending` state.
* Danbooru starts processing the upload in a background job (downloading,
  resizing, and transferring the image to the image servers).
* The file upload component polls `/uploads/$id.json`, checking the
  upload `status` until it returns `completed` or `error`.
* When the upload status is `completed`, the user is redirected to /uploads/$id.
* On the /uploads/$id page, the user can tag the upload and submit it.
* The upload form calls `POST /posts` to create a new post from the upload.
* The user is redirected to the new post.

This is the data model:

* An upload represents a set of files uploaded to Danbooru by a user.
  Uploaded files don't have to belong to a post. An upload has an
  uploader, a status (pending, processing, completed, or error), a
  source (unless uploading from a file), and a list of media assets
  (image or video files).

* There is a has-and-belongs-to-many relationship between uploads and
  media assets. An upload can have many media assets, and a media asset
  can belong to multiple uploads. Uploads are joined to media assets
  through a upload_media_assets table.

  An upload could potentially have multiple media assets if it's a Pixiv
  or Twitter gallery. This is not yet implemented (at the moment all
  uploads have one media asset).

  A media asset can belong to multiple uploads if multiple people try
  to upload the same file, or if the same user tries to upload the same
  file more than once.

New features:

* On the upload page, you can press Ctrl+V to paste an URL and immediately upload it.
* You can save files for upload later. Your saved files are at /uploads.

Fixes:

* Improved error messages when uploading invalid files, bad URLs, and
  when forgetting the rating.
2022-01-28 04:13:22 -06:00
evazion
6fbca01a23 css: make footer sticky. 2022-01-28 04:13:22 -06:00
evazion
0213f8d76a css: remove image-rendering: smooth.
Contrary to its name, `image-rendering: smooth` resulted in pixelated
edges when images were downscaled to fit the browser window. This only
affected Firefox because other browsers don't support `smooth`.
2022-01-22 22:04:30 -06:00
evazion
f02f3fcc6f css: fix text sizes in desktop mode on mobile.
Disable font boosting on mobile. By default, when desktop mode is
enabled on mobile, mobile browsers will automagically increase the size
of text. Usually they do so poorly, making things like headers smaller
than body text, which breaks the layout.

Fixes regression in d6b1302e0.
2022-01-22 21:33:34 -06:00
evazion
893fa1e948 css: fix <input> margins.
Fix regression in d6b1302e0. Fixes the related tags list having extra
space between tags because of default margins around the <input> checkboxes.
2022-01-22 18:29:33 -06:00
evazion
a4279ceff2 css: hide "*" next to required form fields.
Fix regression in d6b1302e.
2022-01-22 00:08:14 -06:00
evazion
2fff563027 css: fix <li> line-height. 2022-01-20 21:50:48 -06:00
evazion
57a7b19180 css: fix <ul>, <menu> margins. 2022-01-20 01:43:50 -06:00
evazion
d6b1302e0b css: clean up css reset stylesheet.
Remove all unnecessary rules from our CSS reset stylesheet.

Our CSS reset was based on a combination of Eric Meyer's CSS reset [1]
and Nicholas Gallagher's normalize.css [2]. Neither had been updated in
over 10 years, so they both contained a lot of unnecessary cruft. This
included workarounds for bugs in ancient versions of IE, and rules for
elements we don't use. Some of these rules had already been removed
upstream, but we never synchronized our copy of normalize.css with it.

This fixes some minor issues with vertical alignment of form inputs,
caused by unnecessary `vertical-align: middle` rules.

[1]: https://meyerweb.com/eric/tools/css/reset/
[2]: https://nicolasgallagher.com/about-normalize-css/
2022-01-19 18:05:36 -06:00
evazion
f39b0bacf4 dtext: adjust space between headers and paragraphs.
Adjust heading tags (h1, h2, h3, h4, h5, h6) to use margins instead of
padding so that margins collapse together. Adjust margin sizes to reduce
gaps between headers and paragraphs, and headers and subheaders.

Also adjust paragraph margins so that there's slightly less space
between paragraphs.
2022-01-19 17:02:01 -06:00
evazion
d0ce511465 css: fix stylelint errors. 2022-01-17 11:58:19 -06:00