Merge pull request #297 from Earlopain/misc-again

Misc again
This commit is contained in:
Zwagoth 2021-08-04 08:05:38 -04:00 committed by GitHub
commit 4b4afd0f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 37 additions and 179 deletions

2
Vagrantfile vendored
View File

@ -6,7 +6,7 @@ Vagrant.configure('2') do |config|
config.vm.provider 'virtualbox' do |v|
v.cpus = 2
v.memory = 1280
v.memory = 2048
if Vagrant::Util::Platform.windows?
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant", "1"]
end

View File

@ -1,5 +1,5 @@
class TagTypeVersionsController < ApplicationController
respond_to :html, :jso
respond_to :html, :json
def index
@tag_versions = TagTypeVersion.search(params[:search]).paginate(params[:page], limit: params[:limit])

View File

@ -740,7 +740,6 @@ Post.initialize_post_sections = function() {
} else if (e.target.hash === "#edit") {
$("#edit").show();
$("#comments").hide();
$("#post_tag_string").focus().selectEnd().height($("#post_tag_string")[0].scrollHeight);
$(document).trigger("danbooru:open-post-edit-tab");
Post.update_tag_count({target: $("#post_tag_string")});
} else {
@ -1044,7 +1043,7 @@ Post.vote = function (id, score, prevent_unvote) {
$(".post-vote-up-"+postID).removeClass(scoreClasses);
$(".post-vote-down-"+postID).removeClass(scoreClasses);
$('.post-score-'+postID).text(postScore);
$('.post-score-'+postID).attr('title', `${data.up_score} up/${data.down_score} down`);
$('.post-score-'+postID).attr('title', `${data.up} up/${data.down} down`);
$(".post-score-"+postID).addClass(scoreToClass(postScore));
$('.post-vote-up-'+postID).addClass(ourScore > 0 ? 'score-positive' : 'score-neutral');
$('.post-vote-down-'+postID).addClass(ourScore < 0 ? 'score-negative' : 'score-neutral');

View File

@ -34,6 +34,7 @@ RelatedTag.init_post_show_editor = function() {
setTimeout(function() {
// Work around that browsers seem to take a few frames to acknowledge that the element is there before it can be focused.
const el = app.$children[0].$refs['otherTags'];
el.style.height = el.scrollHeight + "px";
el.focus();
el.scrollIntoView();
}, 20);
@ -151,4 +152,3 @@ $(function() {
});
export default RelatedTag

View File

@ -71,7 +71,7 @@
<div class="col">
<label class="section-label" for="names">Artists</label>
<div><a href="/forum_topics/23553">How do I tag an artist?</a></div>
<div>Please don't use <a href="/wiki_pages/anonymous_artist">anonymous_artist</a> or <a href="unknown_artist">unknown_artist</a> tags unless they fall under those definitions on the wiki.</div>
<div>Please don't use <a href="/wiki_pages/anonymous_artist">anonymous_artist</a> or <a href="/wiki_pages/unknown_artist">unknown_artist</a> tags unless they fall under those definitions on the wiki.</div>
</div>
<div class="col2">
<div>

View File

@ -22,23 +22,23 @@
function create_tag_link(name, tagType) {
return h('a', {
staticClass: 'tag-type-' + tagType,
attrs: { href: "/wiki_pages/show_or_new?name=" + name, target: "_blank" }
attrs: { href: "/wiki_pages/show_or_new?title=" + name, target: "_blank" }
}, name);
}
var tag = ctx.props.tag;
switch (tag.type) {
default:
case 'tag':
return h('span', {staticClass: 'tag-preview'}, [create_tag_link(tag.a, tag.tagType)]);
return h('span', {staticClass: 'tag-preview'}, [create_tag_link(tag.a, tag.tagTypeA)]);
case 'alias':
return h('span', {staticClass: 'tag-preview tag-preview-alias'}, [
h('del', undefined, [
create_tag_link(tag.a, tag.tagType)
]), ' → ', create_tag_link(tag.b, tag.tagType)
create_tag_link(tag.a, tag.tagTypeA)
]), ' → ', create_tag_link(tag.b, tag.tagTypeB)
]);
case 'implication':
return h('span', {staticClass: 'tag-preview tag-preview-implication'}, [
create_tag_link(tag.a, tag.tagType), ' ⇐ ', create_tag_link(tag.b, tag.tagType)
create_tag_link(tag.a, tag.tagTypeA), ' ⇐ ', create_tag_link(tag.b, tag.tagTypeB)
]);
}
}

View File

@ -30,7 +30,7 @@
this.$emit('tag-active', tag[0], !this.tagActive(tag));
},
tagLink: function (tag) {
return '/wiki_pages/show_or_new?name=' + encodeURIComponent(tag[0]);
return '/wiki_pages/show_or_new?title=' + encodeURIComponent(tag[0]);
},
tagActive: function (tag) {
return this.tags.indexOf(tag[0]) !== -1;

View File

@ -1,6 +1,6 @@
<template>
<div>
<input type="text" size="50" v-model="realValue" @keyup.enter="add" class="upload-source-input"/>
<div class="upload-source-row">
<input type="text" size="50" v-model="realValue" @keyup.enter="add"/>
<button @click="remove" v-if="index !== 0">-</button>
<button @click="add" v-if="last && index < 9">+</button>
</div>

View File

@ -99,8 +99,14 @@ div#c-uploads {
float: none;
}
.upload-source-input {
margin-bottom: 2px;
.upload-source-row {
button {
width: 1.5em;
}
input {
margin-bottom: 2px;
}
}
@media only screen and (orientation: portrait), (max-width: 1100px) {

View File

@ -27,10 +27,11 @@ class TagsPreview
end
def tag_types
names = @tags.map { |tag| tag[:b] || tag[:a] }
names = @tags.map { |tag| [tag[:a], tag[:b]] }.flatten.compact.uniq
categories = Tag.categories_for(names)
@tags.map! do |tag|
tag[:tagType] = categories.fetch(tag[:b] || tag[:a], -1)
tag[:tagTypeA] = categories.fetch(tag[:a], -1)
tag[:tagTypeB] = categories.fetch(tag[:b], -1) if tag[:b]
tag
end
end

View File

@ -26,7 +26,10 @@ class TagImplication < TagRelationship
end
def descendants_with_originals(names)
active.where(antecedent_name: names).map { |x| [x.antecedent_name, x.descendant_names] }.uniq
active.where(antecedent_name: names).each_with_object({}) do |x, result|
result[x.antecedent_name] ||= Set.new
result[x.antecedent_name].merge x.descendant_names
end
end
end

View File

@ -14,8 +14,8 @@
<% counts.each do |uid, count| %>
<tr>
<td><%= link_to_user @results[:users][uid] %></td>
<td><%= count %></td>
<td><%= name.to_s.tr '_', ' ' %></td>
<td><%= count %></td>
<td><%= link_to "Show IP addresses", moderator_ip_addrs_path(:search => {:user_id => uid}) %></td>
</tr>
<% end %>

View File

@ -28,7 +28,7 @@
<% end %>
</select>
</form>
<select id="set-id"></select>
<select id="set-id" style="display: none; margin-top: 0.5em;"></select>
<% if CurrentUser.is_privileged? %>
<input id="tag-script-field" data-autocomplete="tag-edit" placeholder="Enter tag script" style="display: none; margin-top: 0.5em;"/>
<input id="quick-mode-reason" placeholder="Reason" style="display: none; margin-top: 0.5em;"/>

View File

@ -24,7 +24,6 @@
<li><h1>Post Events</h1></li>
<li><%= link_to("Changes", post_versions_path) %></li>
<li><%= link_to("Approvals", post_approvals_path) %></li>
<li><%= link_to("Appeals", post_appeals_path) %></li>
<li><%= link_to("Flags", post_flags_path) %></li>
<li><%= link_to("Replacements", post_replacements_path) %></li>
</ul>
@ -34,10 +33,13 @@
<li><%= link_to("Source Code", Danbooru.config.source_code_url) %></li>
<li><%= link_to("Keyboard Shortcuts", keyboard_shortcuts_path) %></li>
<li><%= link_to("API Documentation", help_page_path(id: "api")) %></li>
<li><%= link_to("Stats", stats_path) %></li>
<li><%= link_to("DB Export", "/db_export/") %></li>
</ul>
<ul>
<li><h1>Artists</h1></li>
<li><%= link_to("Listing", artists_path) %></li>
<li><%= link_to("Avoid Posting", help_page_path(id: "avoid_posting")) %></li>
<li><%= link_to("Changes", artist_versions_path) %></li>
<li><%= link_to("Help", help_page_path(id: "artists")) %></li>
</ul>
@ -59,7 +61,7 @@
</ul>
<ul>
<li><h1>Pools</h1></li>
<li><%= link_to("Listing", pools_path) %></li>
<li><%= link_to("Listing", gallery_pools_path) %></li>
<li><%= link_to("Changes", pool_versions_path) %></li>
<li><%= link_to("Help", help_page_path(id: "pools")) %></li>
</ul>
@ -122,6 +124,7 @@
<% end %>
<li><%= link_to("Mod Actions", mod_actions_path) %></li>
<li><%= link_to("Bulk Update Requests", bulk_update_requests_path) %></li>
<li><%= link_to("Takedowns", takedowns_path) %></li>
<li><%= link_to("Tickets", tickets_path) %></li>
</ul>
</section>

View File

@ -173,7 +173,7 @@
<div>
<p>Refreshed once a day. Click chart legend entries to turn them on/off. Charts by <a href='http://highcharts.com'>Highcharts</a></p>
<p>Refreshed once a day.</p>
<div class='stats-column' id='stats-column-1'>
<h2>Site</h2>
<table class='rounded'>
@ -440,162 +440,8 @@
</tr>
</table>
</div>
<div class='stats-chart-container'>
<div id='chart-users' class='stats-chart'></div>
<div id='chart-posts' class='stats-chart'></div>
<div id='chart-post-types' class='stats-chart'></div>
<div id='chart-tags' class='stats-chart'></div>
</div>
</div>
<%= javascript_tag nonce: true do -%>
$(function () {
Highcharts.setOptions({ // Set global options for all charts
chart: {
backgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
height:300,
width:300,
style: {
fontFamily: 'tahoma'
}
},
title: {
style: {
color: 'white'
}
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
tooltip: {
formatter: function(){
return '<b>' + this.point.name + '</b>: <b>' + this.point.y + '</b> (<b>' + this.point.percentage.toFixed(1) + '</b>%)';
},
hideDelay: 0
},
plotOptions: {
pie: {
borderColor: '#aaa',
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false,
},
showInLegend: true
}
},
legend: {
enabled: true,
align: 'center',
layout: 'horizontal',
padding: 8,
verticalAlign: 'bottom',
itemStyle: {
color: 'white'
},
itemHoverStyle: {
color: 'gold'
},
itemHiddenStyle: {
color: '#555'
}
},
});
$('#chart-users').highcharts({
title: {
text: 'User Types',
},
series: [{
type: 'pie',
name: 'User types',
data: [
{name: 'Unactivated',y: stats.users.unactivated, color: '#79796A'},
{name: 'Blocked', y: stats.users.blocked, color: '#9A1414'},
{name: 'Member', y: stats.users.member, color: '#2f7ed8'},
{name: 'Privileged', y: stats.users.privileged, color: '#a6c96a'},
{name: 'Contributor',y: stats.users.contributor, color: '#1D9E00'},
{name: 'Janitor', y: stats.users.janitor, color: '#FFFF00'},
{name: 'Mod', y: stats.users.mod, color: '#EF8412'},
{name: 'Admin', y: stats.users.admin, color: '#FFFFFF'},
]
}]
});
$('#chart-tags').highcharts({
title: {
text: 'Tag Types',
},
series: [{
type: 'pie',
name: 'Tag types',
data: [
{name: 'General', y: stats.tags.general, color: '#b4c7d9'},
{name: 'Artist', y: stats.tags.artist, color: '#f2ac08'},
{name: 'Copyright', y: stats.tags.copyright, color: '#D0D'},
{name: 'Character', y: stats.tags.character, color: '#0A0'},
{name: 'Species', y: stats.tags.species, color: '#ED5D1F'},
{name: 'Meta', y: stats.tags.meta },
{name: 'Invalid', y: stats.tags.invalid }
]
}]
});
$('#chart-post-types').highcharts({
title: {
text: 'Post Types',
},
series: [{
type: 'pie',
name: 'Post Types',
data: [
{name: 'JPG', y: stats.posts.jpg, color: '#1D9E00'},
{name: 'PNG', y: stats.posts.png, color: '#EF8412'},
{name: 'GIF', y: stats.posts.gif, color: '#9A1414'},
{name: 'SWF', y: stats.posts.swf, color: '#2f7ed8'},
{name: 'WebM', y: stats.posts.webm, color: '#FFFF00'},
]
}]
});
$('#chart-posts').highcharts({
title: {
text: 'Post Statuses',
},
series: [{
type: 'pie',
name: 'Post Statuses',
data: [
{name: 'Normal', y: stats.posts.active, color: '#1D9E00'},
{name: 'Deleted', y: stats.posts.deleted, color: '#EF8412'},
{name: 'Destroyed', y: stats.posts.destroyed, color: '#9A1414'},
]
}]
});
});
<% end -%>
<% content_for(:page_title) do %>
Stats
<% end %>

View File

@ -559,7 +559,7 @@ fart'
"slice" => 0,
"exclusion" => %w(avoid_posting conditional_dnp),
"regexmap" => //,
"formatstr" => "drawn by %s"
"formatstr" => "created by %s"
},
"mod_only" => false,
"relatedbutton" => "Artists",