fixes #3730
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
$("#related-tags-container").hide();
|
$("#related-tags-container").hide();
|
||||||
$("#artist-tags-container").hide();
|
$("#artist-tags-container").hide();
|
||||||
$("#upload_tag_string,#post_tag_string").keyup(Danbooru.RelatedTag.update_selected);
|
$("#upload_tag_string,#post_tag_string").keyup(Danbooru.RelatedTag.update_selected);
|
||||||
|
$("body").on("click", "#artist-related-tags-column a.del", Danbooru.RelatedTag.disable_artist_url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,19 +237,26 @@
|
|||||||
if (desc.length > 30) {
|
if (desc.length > 30) {
|
||||||
desc = desc.substring(0, 30) + "...";
|
desc = desc.substring(0, 30) + "...";
|
||||||
}
|
}
|
||||||
var $del = $("<del/>").text(desc);
|
$ul.append(
|
||||||
$ul.append($("<li/>").html($del));
|
$("<li>").append(
|
||||||
|
$("<del>").text(desc)
|
||||||
|
)
|
||||||
|
);
|
||||||
} else if (text.match(/^ http/)) {
|
} else if (text.match(/^ http/)) {
|
||||||
text = text.substring(1, 1000);
|
text = text.substring(1, 1000);
|
||||||
var $url = $("<a/>");
|
|
||||||
var desc = text.replace(/^https?:\/\//, "");
|
var desc = text.replace(/^https?:\/\//, "");
|
||||||
if (desc.length > 30) {
|
if (desc.length > 30) {
|
||||||
desc = desc.substring(0, 30) + "...";
|
desc = desc.substring(0, 30) + "...";
|
||||||
}
|
}
|
||||||
$url.text(desc);
|
$ul.append(
|
||||||
$url.attr("href", text);
|
$("<li>").append([
|
||||||
$url.attr("target", "_blank");
|
$("<a>").text(desc).attr("href", text).attr("target", "_blank"),
|
||||||
$ul.append($("<li/>").html($url));
|
" ",
|
||||||
|
$("<a>").attr("href", text).addClass("del").append(
|
||||||
|
$("<i>").addClass("fas fa-minus-circle")
|
||||||
|
)
|
||||||
|
])
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$ul.append($("<li/>").text(text));
|
$ul.append($("<li/>").text(text));
|
||||||
}
|
}
|
||||||
@@ -286,7 +294,9 @@
|
|||||||
var url = $("#upload_source,#post_source");
|
var url = $("#upload_source,#post_source");
|
||||||
var referer_url = $("#upload_referer_url");
|
var referer_url = $("#upload_referer_url");
|
||||||
$.get("/artists/finder.json", {"url": url.val(), "referer_url": referer_url.val()}, Danbooru.RelatedTag.process_artist);
|
$.get("/artists/finder.json", {"url": url.val(), "referer_url": referer_url.val()}, Danbooru.RelatedTag.process_artist);
|
||||||
e.preventDefault();
|
if (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.RelatedTag.process_artist = function(data) {
|
Danbooru.RelatedTag.process_artist = function(data) {
|
||||||
@@ -314,6 +324,28 @@
|
|||||||
$("#related-tags").hide();
|
$("#related-tags").hide();
|
||||||
$("#toggle-related-tags-link").text("»");
|
$("#toggle-related-tags-link").text("»");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Danbooru.RelatedTag.disable_artist_url = function(e) {
|
||||||
|
var url = e.currentTarget.href;
|
||||||
|
console.log("clicked %o", url);
|
||||||
|
$.each(Danbooru.RelatedTag.recent_artists[0].sorted_urls, function(k, v) {
|
||||||
|
if (v["normalized_url"] === url || v["url"] === url) {
|
||||||
|
if (!confirm("This will mark the URL as inactive. Continue?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax("/artist_urls/" + v["id"], {
|
||||||
|
method: "PUT",
|
||||||
|
data: {
|
||||||
|
artist_url: {
|
||||||
|
is_active: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).done(Danbooru.RelatedTag.find_artist);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ div.related-tags {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
margin-top: 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
min-width: 3em;
|
min-width: 3em;
|
||||||
}
|
}
|
||||||
|
|||||||
18
app/controllers/artist_urls_controller.rb
Normal file
18
app/controllers/artist_urls_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
class ArtistUrlsController < ApplicationController
|
||||||
|
respond_to :json
|
||||||
|
before_action :member_only
|
||||||
|
|
||||||
|
def update
|
||||||
|
@artist_url = ArtistUrl.find(params[:id])
|
||||||
|
@artist_url.update(artist_url_params)
|
||||||
|
respond_with(@artist_url)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def artist_url_params
|
||||||
|
permitted_params = %i[is_active]
|
||||||
|
|
||||||
|
params.fetch(:artist_url, {}).permit(permitted_params)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class ArtistsController < ApplicationController
|
class ArtistsController < ApplicationController
|
||||||
respond_to :html, :xml, :json
|
respond_to :html, :xml, :json, :js
|
||||||
before_action :member_only, :except => [:index, :show, :show_or_new, :banned]
|
before_action :member_only, :except => [:index, :show, :show_or_new, :banned]
|
||||||
before_action :builder_only, :only => [:destroy]
|
before_action :builder_only, :only => [:destroy]
|
||||||
before_action :admin_only, :only => [:ban, :unban]
|
before_action :admin_only, :only => [:ban, :unban]
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<% if @artist.is_active? %>
|
<% if @artist.is_active? %>
|
||||||
<li id="artist-delete"><%= link_to "Delete", artist_path(@artist), method: :delete, data: {confirm: "Are you sure you want to delete this artist?"} %></li>
|
<li id="artist-delete"><%= link_to "Delete", artist_path(@artist), method: :delete, data: {confirm: "Are you sure you want to delete this artist?"} %></li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li><%= link_to "Undelete", artist_path(@artist), method: :put, data: {confirm: "Are you sure you want to undelete this artist?", params: {"artist[is_active]" => true}} %></li>
|
<li><%= link_to "Undelete", artist_path(@artist, format: "js"), method: :put, data: {confirm: "Are you sure you want to undelete this artist?", params: "artist[is_active]=true"}, remote: true %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if CurrentUser.is_admin? %>
|
<% if CurrentUser.is_admin? %>
|
||||||
|
|||||||
1
app/views/artists/update.js.erb
Normal file
1
app/views/artists/update.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
location.reload();
|
||||||
@@ -81,6 +81,7 @@ Rails.application.routes.draw do
|
|||||||
get :finder
|
get :finder
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
resources :artist_urls, only: [:update]
|
||||||
resources :artist_versions, :only => [:index] do
|
resources :artist_versions, :only => [:index] do
|
||||||
collection do
|
collection do
|
||||||
get :search
|
get :search
|
||||||
|
|||||||
Reference in New Issue
Block a user