fixes #1495
This commit is contained in:
@@ -565,6 +565,7 @@ Danbooru.Note = {
|
|||||||
$("#image").unbind("click", Danbooru.Note.Box.toggle_all);
|
$("#image").unbind("click", Danbooru.Note.Box.toggle_all);
|
||||||
$("#image").bind("mousedown", Danbooru.Note.TranslationMode.Drag.start);
|
$("#image").bind("mousedown", Danbooru.Note.TranslationMode.Drag.start);
|
||||||
$(window).bind("mouseup", Danbooru.Note.TranslationMode.Drag.stop);
|
$(window).bind("mouseup", Danbooru.Note.TranslationMode.Drag.stop);
|
||||||
|
$("#mark-as-translated-section").show();
|
||||||
|
|
||||||
Danbooru.notice('Translation mode is on. Drag on the image to create notes. <a href="#">Turn translation mode off</a> (shortcut is <span class="key">n</span>).');
|
Danbooru.notice('Translation mode is on. Drag on the image to create notes. <a href="#">Turn translation mode off</a> (shortcut is <span class="key">n</span>).');
|
||||||
$("#notice a:contains(Turn translation mode off)").click(function(e) {
|
$("#notice a:contains(Turn translation mode off)").click(function(e) {
|
||||||
@@ -581,6 +582,7 @@ Danbooru.Note = {
|
|||||||
$(window).unbind("mouseup", Danbooru.Note.TranslationMode.Drag.stop);
|
$(window).unbind("mouseup", Danbooru.Note.TranslationMode.Drag.stop);
|
||||||
$(document.body).removeClass("mode-translation");
|
$(document.body).removeClass("mode-translation");
|
||||||
$("#close-notice-link").click();
|
$("#close-notice-link").click();
|
||||||
|
$("#mark-as-translated-section").hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
create_note: function(e, x, y, w, h) {
|
create_note: function(e, x, y, w, h) {
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ class PostsController < ApplicationController
|
|||||||
redirect_to post_path(@post, :tags => params[:tags])
|
redirect_to post_path(@post, :tags => params[:tags])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mark_as_translated
|
||||||
|
@post = Post.find(params[:id])
|
||||||
|
@post.mark_as_translated(params[:post])
|
||||||
|
respond_with(@post)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def tag_query
|
def tag_query
|
||||||
params[:tags] || (params[:post] && params[:post][:tags])
|
params[:tags] || (params[:post] && params[:post][:tags])
|
||||||
|
|||||||
@@ -1566,6 +1566,32 @@ class Post < ActiveRecord::Base
|
|||||||
def strip_source
|
def strip_source
|
||||||
self.source = source.try(:strip)
|
self.source = source.try(:strip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mark_as_translated(params)
|
||||||
|
tags = self.tag_array.dup
|
||||||
|
|
||||||
|
if params["check_translation"] == "1"
|
||||||
|
tags << "check_translation"
|
||||||
|
elsif params["check_translation"] == "0"
|
||||||
|
tags -= ["check_translation"]
|
||||||
|
end
|
||||||
|
if params["partially_translated"] == "1"
|
||||||
|
tags << "partially_translated"
|
||||||
|
elsif params["partially_translated"] == "0"
|
||||||
|
tags -= ["partially_translated"]
|
||||||
|
end
|
||||||
|
|
||||||
|
if params["check_translation"] == "1" || params["partially_translated"] == "1"
|
||||||
|
tags << "translation_request"
|
||||||
|
tags -= ["translated"]
|
||||||
|
else
|
||||||
|
tags << "translated"
|
||||||
|
tags -= ["translation_request"]
|
||||||
|
end
|
||||||
|
|
||||||
|
self.tag_string = tags.join(" ")
|
||||||
|
save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Post.connection.extend(PostgresExtensions)
|
Post.connection.extend(PostgresExtensions)
|
||||||
|
|||||||
@@ -47,6 +47,26 @@
|
|||||||
<%= @post.presenter.image_html(self) %>
|
<%= @post.presenter.image_html(self) %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section id="mark-as-translated-section" style="display: none;">
|
||||||
|
<%= form_tag(mark_as_translated_post_path(@post), :class => "simple_form", :method => :put) do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<label for="post_check_translation">
|
||||||
|
<%= check_box "post", "check_translation", :checked => @post.has_tag?("check_translation") %>
|
||||||
|
Check translation
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label for="post_partially_translated">
|
||||||
|
<%= check_box "post", "partially_translated", :checked => @post.has_tag?("partially_translated") %>
|
||||||
|
Partially translated
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<div class="input">
|
||||||
|
<%= submit_tag "Mark as translated" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</section>
|
||||||
|
|
||||||
<% if @post.artist_commentary && @post.artist_commentary.any_field_present? %>
|
<% if @post.artist_commentary && @post.artist_commentary.any_field_present? %>
|
||||||
<div id="artist-commentary">
|
<div id="artist-commentary">
|
||||||
<%= render "artist_commentaries/show", :artist_commentary => @post.artist_commentary %>
|
<%= render "artist_commentaries/show", :artist_commentary => @post.artist_commentary %>
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ Rails.application.routes.draw do
|
|||||||
put :copy_notes
|
put :copy_notes
|
||||||
get :show_seq
|
get :show_seq
|
||||||
put :unvote
|
put :unvote
|
||||||
|
put :mark_as_translated
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :post_appeals
|
resources :post_appeals
|
||||||
|
|||||||
Reference in New Issue
Block a user