Commit Graph

12 Commits

Author SHA1 Message Date
evazion
c1805cc4e0 views: factor out paginator component.
* Refactor the paginator into a ViewComponent.
* Fix inconsistent spacing between paginator items.
* Fix a bug where the sequential paginator generated the wrong next /
  previous page links in the <link rel="{next|prev}"> tags in the <head>.
* Always include the final page as a hidden html element, so that it can
  be unhidden with custom CSS.
* Make it easier to change the pagination window.
2021-02-18 02:47:21 -06:00
evazion
42f0112c38 seo: increase sitemap coverage.
Rework sitemaps to provide more coverage of the site. We want every
important page on the site - including every post, tag, and wiki page -
to be indexed by Google. We do this by generating sitemaps and sitemap
indexes that contain links to every important page on the site.
2020-07-10 00:18:30 -05:00
evazion
f97c62c71d search: fix search timeout error page not appearing.
Bug: when a search timed out we got the generic failbooru page instead
of the search timeout error page.

Cause: when rendering the <link rel="next"> / <link rel="prev"> tags in
the header, we may need to evaluate the search to determine the next or
previous page, but if the searches times out then this fails, which
caused Rails to throw a ActionView::Template::Error because an exception
was thrown while rendering the template.

Likewise, rendering the attributes for the <body> tag could fail with an
ActionView::Template::Error because the call to `current_item.present?`
forced evaluation of the search.
2020-07-03 13:08:49 -05:00
evazion
ad02b26f3d pagination: fix exception on empty pages in seq. pagination.
Fix exception when the page is empty during sequential pagination.
Caused because the paginator can't figure out the next or previous page
when the current page is empty.

* https://danbooru.donmai.us/posts?page=b0
* https://danbooru.donmai.us/posts?page=a10000000
2020-06-28 02:57:48 -05:00
evazion
8299c969fb Fix #2061: <Link> elements for pools.
Add <link rel="prev"> and <link rel="next"> tags to the forum topic show
page, the pool show page, and the favgroup show page.

This is kind of useless now since Google hasn't used these tags for SEO
for years ([1]), and userscripts can use `#paginator-next` and
`#paginator-prev` to find the next/prev pages, but whatever.

[1]: https://yoast.com/google-doesnt-use-rel-prev-next-for-pagination
2020-04-30 19:57:06 -05:00
BrokenEagle
e23ee170f5 Add alternate comparison types to versions
- The types are:
-- Previous: The default and the previously used type
-- Subsequent: Compares against the next version
-- Current: Compares against the current version
- Allow switching between comparison types in index and diff views
-- Have links vary depending upon current comparison type
2020-03-17 18:31:20 +00:00
evazion
90b94adee8 /wiki_page_versions/diff: use SetDiff to diff other_names.
Use SetDiff instead of DiffBuilder to generate diffs for wiki page other
names. SetDiff is what we use for artist other names.
2020-01-12 16:31:23 -06:00
evazion
31ebfa0a82 css: standardize styling of fineprint text.
Fineprint text was variously styled with `.info`, `.tn`, `.hint`, or
`.cost-footnote` css classes. Standardize on `.fineprint` instead. Use
`.hint` only for form hints and `.tn` only for <tn> tags in translation
notes.

Incidentally changes the font size of form hints to 0.8em (was 0.7em)
and the color of fineprint to #888 (was #AAA or #666).
2019-09-17 00:28:41 -05:00
evazion
b283281e5e comments: minimize sql queries.
Certain parts of comment rendering triggered sql queries that we didn't
really need to do. Rework things to avoid this.

* Preload comment creators in order to display commenter names with link_to_user.

* Preload comment votes in order to display "undo vote" links. Only preload
  votes for members since anonymous users can't vote and don't have "undo
  vote" links.

* Rework various conditionals to do the filtering in Ruby so that we
  avoid issuing any extra queries in sql.

* Avoid issuing any queries at all when the post doesn't have any
  comments (when last_commented_at is blank).
2019-08-20 21:55:25 -05:00
Albert Yi
a66f9837ec Merge pull request #4003 from evazion/fix-3946
Artist versions: improve diffing of urls and other names (#3946)
2018-12-08 20:43:27 -08:00
evazion
d213173d3d Fix #4002: Always include "updated by" line when creator != updater 2018-12-08 11:30:11 -06:00
evazion
e25e8d564a artist versions: refactor diffs. 2018-12-07 12:45:51 -06:00