Merge pull request #3957 from evazion/fix-related-tags

Related tags: build html server-side, eliminate cookies
This commit is contained in:
Albert Yi
2018-10-24 17:34:14 -07:00
committed by GitHub
24 changed files with 282 additions and 426 deletions

View File

@@ -1,6 +1,5 @@
import Utility from './utility'
import Hammer from 'hammerjs'
import RelatedTag from './related_tag.js.erb'
import Cookie from './cookie'
import Note from './notes'
import SavedSearch from './saved_searches'
@@ -83,11 +82,6 @@ Post.initialize_edit_dialog = function() {
Post.open_edit_dialog();
e.preventDefault();
});
$("#toggle-related-tags-link").on("click.danbooru", function(e) {
RelatedTag.toggle();
e.preventDefault();
});
}
Post.open_edit_dialog = function() {
@@ -99,14 +93,11 @@ Post.open_edit_dialog = function() {
$("#comments").hide();
$("#post-sections li").removeClass("active");
$("#post-edit-link").parent("li").addClass("active");
$("#related-tags-container").show();
var $tag_string = $("#post_tag_string,#upload_tag_string");
$("div.input").has($tag_string).prevAll().hide();
$("#open-edit-dialog").hide();
$("#toggle-related-tags-link").show().click();
var dialog = $("<div/>").attr("id", "edit-dialog");
$("#form").appendTo(dialog);
dialog.dialog({
@@ -158,17 +149,18 @@ Post.open_edit_dialog = function() {
$tag_string.css({"resize": "none", "width": "100%"});
$tag_string.focus().selectEnd().height($tag_string[0].scrollHeight);
$(document).trigger("danbooru:open-post-edit-dialog");
}
Post.close_edit_dialog = function(e, ui) {
$("#form").appendTo($("#c-posts #edit,#c-uploads #a-new"));
$("#edit-dialog").remove();
RelatedTag.show();
$("#toggle-related-tags-link").hide();
var $tag_string = $("#post_tag_string,#upload_tag_string");
$("div.input").has($tag_string).prevAll().show();
$("#open-edit-dialog").show();
$tag_string.css({"resize": "", "width": ""});
$(document).trigger("danbooru:close-post-edit-dialog");
}
Post.initialize_similar = function() {
@@ -434,9 +426,8 @@ Post.initialize_post_sections = function() {
$("#edit").show();
$("#comments").hide();
$("#post_tag_string").focus().selectEnd().height($("#post_tag_string")[0].scrollHeight);
$("#related-tags-button").trigger("click");
$("#fetch-data-manual").trigger("click");
$("#recommended").hide();
$(document).trigger("danbooru:open-post-edit-tab");
} else if (e.target.hash === "#recommended") {
$("#comments").hide();
$("#edit").hide();