fixes #4006: Bring back the "edit tags" button to the sidebar
fixes #4011: Comment input field under posts is too big, goes slightly beyond view boundaries fixes #4010: Incorrect dynamic tag counts
This commit is contained in:
@@ -41,7 +41,7 @@ Post.initialize_all = function() {
|
|||||||
|
|
||||||
var $fields_multiple = $('[data-autocomplete="tag-edit"]');
|
var $fields_multiple = $('[data-autocomplete="tag-edit"]');
|
||||||
$fields_multiple.on("keypress.danbooru", Post.update_tag_count);
|
$fields_multiple.on("keypress.danbooru", Post.update_tag_count);
|
||||||
Post.update_tag_count();
|
$fields_multiple.on("click", Post.update_tag_count);
|
||||||
|
|
||||||
$(window).on('danbooru:initialize_saved_seraches', () => {
|
$(window).on('danbooru:initialize_saved_seraches', () => {
|
||||||
Post.initialize_saved_searches();
|
Post.initialize_saved_searches();
|
||||||
@@ -421,7 +421,7 @@ Post.initialize_excerpt = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Post.initialize_post_sections = function() {
|
Post.initialize_post_sections = function() {
|
||||||
$("#post-sections li a").on("click.danbooru", function(e) {
|
$("#post-sections li a,#side-edit-link").on("click.danbooru", function(e) {
|
||||||
if (e.target.hash === "#comments") {
|
if (e.target.hash === "#comments") {
|
||||||
$("#comments").show();
|
$("#comments").show();
|
||||||
$("#edit").hide();
|
$("#edit").hide();
|
||||||
@@ -432,6 +432,7 @@ Post.initialize_post_sections = function() {
|
|||||||
$("#post_tag_string").focus().selectEnd().height($("#post_tag_string")[0].scrollHeight);
|
$("#post_tag_string").focus().selectEnd().height($("#post_tag_string")[0].scrollHeight);
|
||||||
$("#recommended").hide();
|
$("#recommended").hide();
|
||||||
$(document).trigger("danbooru:open-post-edit-tab");
|
$(document).trigger("danbooru:open-post-edit-tab");
|
||||||
|
Post.update_tag_count({target: $("#post_tag_string")});
|
||||||
} else if (e.target.hash === "#recommended") {
|
} else if (e.target.hash === "#recommended") {
|
||||||
$("#comments").hide();
|
$("#comments").hide();
|
||||||
$("#edit").hide();
|
$("#edit").hide();
|
||||||
@@ -607,7 +608,7 @@ Post.update_tag_count = function(event) {
|
|||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
let tags = $(event.target).val().match(/\S+/g);
|
let tags = [...new Set($(event.target).val().match(/\S+/g))];
|
||||||
if (tags) {
|
if (tags) {
|
||||||
count = tags.length;
|
count = tags.length;
|
||||||
string = (count == 1) ? (count + " tag") : (count + " tags")
|
string = (count == 1) ? (count + " tag") : (count + " tags")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Uploads from './uploads';
|
import Uploads from './uploads';
|
||||||
import Utility from './utility';
|
import Utility from './utility';
|
||||||
|
import Post from './posts.js.erb';
|
||||||
|
|
||||||
let RelatedTag = {};
|
let RelatedTag = {};
|
||||||
|
|
||||||
@@ -121,6 +122,8 @@ RelatedTag.toggle_tag = function(e) {
|
|||||||
// The timeout is needed on Chrome since it will clobber the field attribute otherwise
|
// The timeout is needed on Chrome since it will clobber the field attribute otherwise
|
||||||
setTimeout(function () { $field.prop('selectionStart', $field.val().length);}, 100);
|
setTimeout(function () { $field.prop('selectionStart', $field.val().length);}, 100);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
Post.update_tag_count({ target: $field });
|
||||||
}
|
}
|
||||||
|
|
||||||
RelatedTag.show = function(e) {
|
RelatedTag.show = function(e) {
|
||||||
|
|||||||
@@ -343,10 +343,13 @@ div#c-posts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 0.25em;
|
margin-bottom: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#edit textarea {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#favlist {
|
#favlist {
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<% if CurrentUser.is_member? %>
|
<% if CurrentUser.is_member? %>
|
||||||
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :"data-shortcut" => "f", style: ("display: none;" if @post.is_favorited?) %></li>
|
<li><%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :"data-shortcut" => "f", style: ("display: none;" if @post.is_favorited?) %></li>
|
||||||
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites", :"data-shortcut" => "shift+f", style: ("display: none;" if !@post.is_favorited?) %></li>
|
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites", :"data-shortcut" => "shift+f", style: ("display: none;" if !@post.is_favorited?) %></li>
|
||||||
|
<li><%= link_to "Edit", "#edit", :id => "side-edit-link" %></li>
|
||||||
<li><%= link_to_if post.visible?, "Download", post.tagged_file_url + "?download=1", download: post.presenter.filename_for_download %></li>
|
<li><%= link_to_if post.visible?, "Download", post.tagged_file_url + "?download=1", download: post.presenter.filename_for_download %></li>
|
||||||
<li id="add-to-pool-list"><%= link_to "Add to pool", "#", :id => "pool" %></li>
|
<li id="add-to-pool-list"><%= link_to "Add to pool", "#", :id => "pool" %></li>
|
||||||
<% if post.is_note_locked? %>
|
<% if post.is_note_locked? %>
|
||||||
|
|||||||
Reference in New Issue
Block a user