Commit Graph

85 Commits

Author SHA1 Message Date
evazion
ea4daec58d posts: fix shift+e keyboard shortcut not working.
Broken in da6a61b4e.
2022-12-11 04:21:27 -06:00
evazion
f942768ce8 Fix #5347: Don't use exception template for post validation errors
Also fixes #5173: Parenting a post to itself using the "parent id" box leads to an error.
2022-11-13 02:01:18 -06:00
evazion
0d953e2492 related tags: add AI tags to related tags section.
Add a Suggested tags list to the Related Tags box. The suggested tags
are just the AI tags for the post.

Suggested tags are currently hidden in CSS for beta testing. Use custom
CSS to unhide them.
2022-07-02 05:29:59 -05:00
evazion
81bd86d202 posts: add "general" rating; rename "safe" rating to "sensitive".
* Add "general" rating.
* Rename "safe" rating to "sensitive".
* Change safe mode to include both rating:s and rating:g.
* Treat rating:safe as a synonym for rating:sensitive.
* Link "howto:rate" in the post edit form.
2022-05-22 13:38:45 -05:00
evazion
141044d352 posts: refactor hardcoded ratings.
Refactor ratings to not be hardcoded in various places. Make it so
all ratings are defined in Post::RATINGS.

Also make it so that you can search multiple ratings at once with `rating:q,e`.
2022-05-18 13:04:15 -05:00
evazion
126046cb69 posts: remove rating, note, and status locks.
Remove the ability for users to lock ratings, note, and post statuses.

Historically the majority of locked posts were from 10+ years ago when
certain users habitually locked ratings and notes on every post they
touched for no reason. Nowadays most posts have been unlocked. Only a
handful of locked posts are left, none of which deserve to be locked.

The is_rating_locked, is_note_locked, and is_status_locked columns still
exist in the database, but aren't used.
2021-09-27 22:32:30 -05:00
evazion
e1ef94faf7 sources: factor out 'Fetch source data' box into view component. 2021-02-26 01:24:30 -06:00
evazion
b8d95ace64 css: adjust form input box sizes.
Adjust input boxes to fit the screen better on mobile, and to use
consistent sizes throughout the site (no ad-hoc overrides to make
certain input boxes a bit bigger in random places).

On desktop, this makes most input boxes a bit taller and narrower. On
mobile, it makes input boxes the full width of the screen.

This most notably affects the tag edit box, the comment and forum
post box, the wiki page edit box, and the commentary box.
2021-02-16 09:28:38 -06:00
evazion
3f6e7ff6b5 Fix #4701: Odd behavior on older versions of Chrome.
Regression caused by the upgrade to Webpacker 6.0 in 90cd3293e. This
caused various Javascript errors in old versions of Chrome, which
somehow resulted in the keyboard shortcut for visiting the next page
being triggered when you pressed any key.

Specifically, the mobx library (used by the TagCounter component) called
`Object.entries`, which isn't available in Chrome 49, and for some
unknown reason this triggered the buggy shortcut behavior.

`Object.entries` is supposed to be automatically polyfilled by Babel to
support old browsers, but something changed in Webpacker 6 that broke
this and I couldn't get it working again. The probable cause is that
Webpacker 6 no longer transpiles code inside ./node_modules by default,
which means that any libraries we use that use new Javascript features
won't get transpiled down to support old browsers, but even after fixing
that it still didn't work. The workaround is to just drop mobx and
preact entirely to avoid the issue.
2021-02-07 05:53:32 -06:00
evazion
63e3b4b447 views: factor out FontAwesome icons.
Factor out FontAwesome icons into a set of helpers. This is so that it's
easier to keep track of which icons we're using and easier to change
icons globally.
2021-01-21 07:58:50 -06:00
evazion
6f93b77fc0 Add "Ctrl+Enter to submit" hint beneath tag box (#4661) 2021-01-06 14:42:08 -06:00
evazion
69cfa1696a html: disable browser spellcheck on all non-DText inputs.
Disable the browser's native spellchecking ability on all form inputs,
except for DText inputs. We do this by setting `spellcheck="false"` on
the <body> tag, and `spellcheck="true"` on DText <input> tags.

This fixes browsers displaying a red wavy underline beneath tags in the
tag search box, among other places. We disable spellchecking globally
because most form inputs, except for DText inputs, aren't meant for
natural English language.
2021-01-04 00:25:54 -06:00
Aaron Franke
6cdafdf136 Remove trailing space characters
Trailing space characters do nothing except take up disk space, they should be removed
2020-10-04 05:15:02 -04:00
evazion
ef9bc37d9e posts: show ratings in tag edit dialog box.
* Show the rating buttons in the tag edit dialog box.
* Fix the tag counter not showing up in the tag edit dialog box on the
  uploads page.
2020-08-05 12:28:24 -05:00
evazion
6b7cd7b972 posts: update tag counter icons. 2020-08-02 18:33:47 -05:00
evazion
b3a4c7aa43 posts: rewrite tag counter widget in React.
Rewrite the tag counter widget (the one above the tag edit box) to use
React. This is a trial run for using React elsewhere.

We actually use Preact instead of React because it's lighter weight.
We use Mobx for state management because it's cleaner than React's
setState or useState.

This incidentally fixes a couple bugs:

* The tag counter wasn't updated when deleting tags with backspace
* The tag counter wasn't updated when pasting in new tags.
2020-08-02 16:48:45 -05:00
evazion
f7f72e29b5 Fix #4458: Duplicate HTML IDs on post show page. 2020-06-26 14:59:30 -05:00
evazion
a5418abb31 pundit: convert posts to pundit. 2020-03-20 18:03:01 -05:00
evazion
c86c61c9a4 Fix #4162: Remove browser autocomplete from most inputs. 2020-01-10 16:08:34 -06:00
evazion
cde8ee64e1 Fix #4241: Approving a post then editing tags returns 404.
This is what happens:

* The post is approved.
* The approval action reloads the page by calling `location.reload()`.
* After the page is reloaded, the value of the hidden `_method` param in
  the post edit form is mysteriously overwritten with the value of the
  authenticity_token param from the previous page load.
* The post edit form is submitted, but the _method param isn't set to
  `patch`, so the form submission is treated as a POST request instead of
  a PUT request.
* The POST endpoint doesn't exist, so the form submission returns 404.

The cause appears to be buggy form autofill in Firefox 72. This only
happens in Firefox 72, not in Firefox 68 or in other browsers.
2020-01-10 12:54:12 -06:00
evazion
3ca4f4f32c posts: convert post edit form to simple form. 2020-01-10 12:08:28 -06:00
evazion
ccf32aa7a4 posts: remove 'Similar' button from post edit form.
Remove the 'Similar' button next to the source field in the post edit
form. Removed for multiple reasons:

* It doesn't make sense to have to open the edit form to do a reverse
  image search.

* The 'Similar' button tries to redownload the file from the source,
  which has various problems: the source might have been deleted, it
  might have been changed or revised, it might be a format that iqdb
  can't handle (ugoira/webm/mp4), or it might otherwise not match the
  the actual post.

* The 'Find similar' button already exists in the sidebar and it does
  the right thing by using the preview image from Danbooru, which
  avoids all the above issues.
2019-10-14 21:16:04 -05:00
evazion
f4512576a4 css: standardize width of fixed width pages.
Standardize various width-limited pages to 70em width.
2019-09-23 17:56:50 -05:00
Albert Yi
4fe7f5eff9 restyling 2019-01-23 17:40:58 -08:00
evazion
b24ccb0595 tag edit dialog: fix clicking button before handler is bound.
https://danbooru.donmai.us/forum_topics/9127?page=265#forum_post_153180:

> I'm not sure how to reproduce this, but sometimes on the upload page
> when I click the button to pop out the tag box, the screen scrolls up to
> the picture but the box doesn't pop out, and I have to scroll back down
> and click it again

https://danbooru.donmai.us/forum_topics/9127?page=266#forum_post_153183:

> Yes, this was brought up by Unbreakable on Discord a while back. It's
> due to the fact that the event handler that pops out the dialog box has
> not yet been bound by the time you click it. Since that clickable
> control has an empty anchor link of "#" which goes nowhere, it therefore
> redirects the user to the top of the page.
2018-12-18 19:10:23 -06:00
evazion
79ec053cef Fix #4009: Tag list is empty when editing tags, causing destructive changes. 2018-12-12 13:02:04 -06:00
Albert Yi
3893926048 add dynamic tag counts on upload form 2018-12-10 17:51:28 -08:00
evazion
39374a70d3 posts/show: rename tags params to q in various places.
Fixup for 011a6f1f7.
2018-10-30 11:32:07 -05:00
evazion
6d293dfde2 related tags: fix style issues. 2018-10-16 13:09:22 -05:00
evazion
6223f89a99 related tags: refactor /related_tags.js to avoid updating unchanged columns.
Refactor the /related_tags.js call so that when the "Related tags"
button is clicked, it only replaces the columns that actually changed,
not the entire related tags section.

This avoids rebuilding the Recent / Frequent / Translated Tags / Artist
columns every time the "Related tags" button is clicked.
2018-10-15 18:41:32 -05:00
evazion
5a05961bde related tags: factor partials out from post, upload edit forms. 2018-10-12 21:18:15 -05:00
evazion
739bb1270c TagSetPresenter: refactor tag string for post edit form.
Move PostPresenter#categorized_tag_groups to TagSetPresenter#split_tag_list_text.

This allows split_tag_list_text to reuse the same set of tags already
fetched by the tag set presenter for the sidebar.

This avoids a memcache call to get the tag categories when rendering the
tag string for the post edit form.
2018-09-30 21:52:24 -05:00
evazion
10ca4dd3ad artists: replace artist finder with fetch source data.
* On posts, automatically trigger "Fetch source data" when clicking the
  Edit tab, instead of triggering the artist finder button. This way we
  find both the artist and the translated tags in one ajax call.

* Remove the "Artist" finder button next to the source field. This isn't
  necessary given that "Fetch source data" finds the artist itself.

* Remove the /artists/finder.json API endpoint. This is no longer used
  after removing the "Artist" finder button.
2018-09-11 20:09:25 -05:00
evazion
bbaadda1e3 Convert keyboard shortcuts to use data-shortcut. 2018-08-12 12:09:58 -05:00
Albert Yi
cd88a8df9f fixes #3620 2018-04-12 13:00:48 -07:00
r888888888
4d279cd16a Revert "hide embedded notes option"
This reverts commit b361809489.
2017-12-15 13:53:03 -08:00
evazion
487fe9fb5d Fetch source data: list Danbooru artist tag; elim duplicated code.
* In the `Fetch source data` box, list the Danbooru artist tag(s) that
  were found beside the artist name.

* Unify `Fetch source data` code that was duplicated between the
  uploads page and the post show page.
2017-11-14 23:29:29 -06:00
BrokenEagle
6838901aac Moved non-config tag category info to its own class 2017-11-07 16:21:29 -08:00
BrokenEagle
1de8fd2bd6 Moved tag logic for Javascript to config file 2017-11-07 10:58:40 -08:00
r888888888
0985f929cc style buttons for upload/post edit pages 2017-09-14 16:56:40 -07:00
r888888888
b361809489 hide embedded notes option 2017-09-14 15:50:57 -07:00
evazion
3ecee91861 Fix #3061: Add "General" button for related tags on new/edit posts. 2017-05-26 12:49:59 -05:00
evazion
4631262374 Fix broken tag autocomplete on multiple pages.
Mark all tag <input>s with a `data-autocomplete` attribute, instead of
hardcoding a list of html IDs to autocomplete in javascript.

This way should be less error prone. It fixes autocomplete in several places:

* Autocomplete for the search box on /posts didn't work in the
  responsive layout. This was because /posts has two search boxes that
  both have the id `tags`: one in the normal sidebar, and one in the
  responsive tag list. $("#tags") only initialized autocomplete on the
  first one.

* Autocomplete didn't work on the aliases or implications pages. This
  was due to selecting the wrong html ids.
2017-04-22 15:24:03 -05:00
Albert Yi
7aab50f726 remove old iqdb code 2016-12-02 13:21:56 -08:00
Type-kun
a7d553038f Add "disable-with" to most edit forms (should fix #2264) 2016-08-30 22:54:38 +05:00
Toks
f3e4aa51f0 preserve favgroup_id 2015-06-25 10:45:26 -04:00
r888888888
ebe0c2e019 expose embed notes option 2015-02-09 18:26:55 -08:00
r888888888
dc0c03dce7 expose embedded note options to builders only 2015-02-02 20:10:49 -08:00
r888888888
9e505a0b84 * add new bit_flags column to posts
* conditionally enable embedded notes on a per post basis
2015-01-27 17:11:51 -08:00
Toks
9d47d7f7dd Support source fetching and translated tags while editing posts
(manual only)
2014-06-07 14:10:02 -04:00