Support source fetching and translated tags while editing posts
(manual only)
This commit is contained in:
@@ -4,11 +4,12 @@
|
|||||||
Danbooru.Upload.initialize_all = function() {
|
Danbooru.Upload.initialize_all = function() {
|
||||||
if ($("#c-uploads,#c-posts").length) {
|
if ($("#c-uploads,#c-posts").length) {
|
||||||
this.initialize_enter_on_tags();
|
this.initialize_enter_on_tags();
|
||||||
|
this.initialize_info_manual();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#c-uploads").length) {
|
if ($("#c-uploads").length) {
|
||||||
this.initialize_image();
|
this.initialize_image();
|
||||||
this.initialize_info();
|
this.initialize_info_bookmarklet();
|
||||||
this.initialize_similar();
|
this.initialize_similar();
|
||||||
$("#related-tags-button").trigger("click");
|
$("#related-tags-button").trigger("click");
|
||||||
$("#find-artist-button").trigger("click");
|
$("#find-artist-button").trigger("click");
|
||||||
@@ -55,16 +56,20 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Upload.initialize_info = function() {
|
Danbooru.Upload.initialize_info_bookmarklet = function() {
|
||||||
$("#source-info ul").hide();
|
$("#source-info ul").hide();
|
||||||
$("#fetch-data-bookmarklet").click(function(e) {
|
$("#fetch-data-bookmarklet").click(function(e) {
|
||||||
$.get(e.target.href).success(Danbooru.Upload.fill_source_info);
|
$.get(e.target.href).success(Danbooru.Upload.fill_source_info);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
$("#fetch-data-bookmarklet").trigger("click");
|
$("#fetch-data-bookmarklet").trigger("click");
|
||||||
|
}
|
||||||
|
|
||||||
|
Danbooru.Upload.initialize_info_manual = function() {
|
||||||
|
$("#source-info ul").hide();
|
||||||
|
|
||||||
$("#fetch-data-manual").click(function(e) {
|
$("#fetch-data-manual").click(function(e) {
|
||||||
var source = $("#upload_source").val();
|
var source = $("#upload_source,#post_source").val();
|
||||||
if (!/\S/.test(source)) {
|
if (!/\S/.test(source)) {
|
||||||
Danbooru.error("Error: You must enter a URL into the source field to get its data");
|
Danbooru.error("Error: You must enter a URL into the source field to get its data");
|
||||||
} else if (!/^https?:\/\//.test(source)) {
|
} else if (!/^https?:\/\//.test(source)) {
|
||||||
|
|||||||
@@ -373,6 +373,22 @@ div#c-posts {
|
|||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#source-info {
|
||||||
|
margin: 1em 0;
|
||||||
|
padding: 1em;
|
||||||
|
border: 1px solid gray;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
a {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div#quick-edit-div {
|
div#quick-edit-div {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "sources/info_for_post" %>
|
||||||
|
|
||||||
<%= form_for(post, :html => {:class => "simple_form", :id => "form"}) do |f| %>
|
<%= form_for(post, :html => {:class => "simple_form", :id => "form"}) do |f| %>
|
||||||
<%= hidden_field_tag :tags_query, params[:tags] %>
|
<%= hidden_field_tag :tags_query, params[:tags] %>
|
||||||
<%= hidden_field_tag :pool_id, params[:pool_id] %>
|
<%= hidden_field_tag :pool_id, params[:pool_id] %>
|
||||||
|
|||||||
14
app/views/sources/_info_for_post.html.erb
Normal file
14
app/views/sources/_info_for_post.html.erb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!--
|
||||||
|
- source
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div id="source-info">
|
||||||
|
<p><%= link_to "Fetch source data", source_path(:format => "json"), :id => "fetch-data-manual" %></p>
|
||||||
|
<p><%= content_tag "span", "Loading source data...", :id => "loading-data", :style => "display: none;" %></p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><strong>Artist</strong>: <span id="source-artist"></span></li>
|
||||||
|
<li><strong>Tags</strong>: <span id="source-tags"></span></li>
|
||||||
|
<li><strong>Record</strong>: <span id="source-record"></span></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user