Migrate assets to use Webpacker

This commit is contained in:
Albert Yi
2018-07-06 16:41:08 -07:00
parent 95b72f5f5c
commit 6fa0ae2cf1
175 changed files with 11518 additions and 3726 deletions

View File

@@ -1,5 +1,5 @@
<% if @bulk_update_request.errors.any? %>
Danbooru.error(<%= j @bulk_update_request.errors.full_messages.join(',') %>);
$(window).trigger("danbooru:error", <%= j @bulk_update_request.errors.full_messages.join(',') %>);
<% else %>
$("#request-status-for-<%= @bulk_update_request.id %>").html("queued");
<% end %>

View File

@@ -1,7 +1,7 @@
<% if @error %>
Danbooru.error("<%= j @error.to_s %>");
$(window).trigger("danbooru:error", "<%= j @error.to_s %>");
<% elsif @comment_vote.errors.any? %>
Danbooru.error("<%= j @comment_vote.errors.full_messages.join('; ') %>");
$(window).trigger("danbooru:error", "<%= j @comment_vote.errors.full_messages.join('; ') %>");
<% elsif @comment_vote.is_negative? %>
$(".comment[data-comment-id=<%= @comment.id %>]").remove();
<% end %>

View File

@@ -1,5 +1,5 @@
<% if @error %>
Danbooru.error("<%= j @error.to_s %>");
$(window).trigger("danbooru:error", "<%= j @error.to_s %>");
<% else %>
$("#comment-vote-up-link-for-<%= @comment.id %>").show();
$("#comment-vote-down-link-for-<%= @comment.id %>").show();

View File

@@ -2,15 +2,4 @@ $("#hidden-comments-notice-for-<%= @post.id %>").hide();
var current_comment_section = $("div.comments-for-post[data-post-id=<%= @post.id %>] div.list-of-comments");
current_comment_section.html("<%= j(render(:partial => 'comments/partials/show/comment', :collection => @comments))%>");
<% if params[:include_below_threshold] %>
$("#threshold-comments-notice-for-<%= @post.id %>").hide();
Danbooru.Comment.highlight_threshold_comments(<%= @post.id %>);
<% else %>
Danbooru.Comment.hide_threshold_comments(<%= @post.id %>);
<% end %>
Danbooru.Comment.initialize_reply_links(current_comment_section);
Danbooru.Comment.initialize_edit_links(current_comment_section);
Danbooru.Comment.initialize_vote_links(current_comment_section);
Danbooru.Dtext.initialize_expandables(current_comment_section);
$(window).trigger("danbooru:index_for_post", <%= @post.id %>, current_comment_section, <%= ActiveModel::Type::Boolean.new.cast(params[:include_below_threshold]) %>);

View File

@@ -1,2 +1,2 @@
Danbooru.notice("Message marked as not spam");
$(window).trigger("danbooru:notice", "Message marked as not spam");
$("#spam-links").hide();

View File

@@ -1,2 +1,2 @@
Danbooru.notice("Message marked as spam");
$(window).trigger("danbooru:notice", "Message marked as spam");
$("#spam-links").hide();

View File

@@ -1,2 +1,2 @@
Danbooru.notice("Added post to favorite group <%= escape_javascript(@favorite_group.pretty_name) %>");
$(window).trigger("danbooru:notice", "Added post to favorite group <%= escape_javascript(@favorite_group.pretty_name) %>");
$("#add-to-favgroup-dialog").dialog("close");

View File

@@ -1,5 +1,5 @@
<% if @error_msg %>
Danbooru.error("<%= @error_msg %>");
$(window).trigger("danbooru:error", "<%= @error_msg %>");
<% else %>
$("#add-to-favorites").hide();
$("#add-fav-button").hide();
@@ -13,5 +13,5 @@
$("#show-favlist-link").show();
}
<% end %>
Danbooru.notice("You have favorited this post");
$(window).trigger("danbooru:notice", "You have favorited this post");
<% end %>

View File

@@ -10,4 +10,4 @@ $("#favcount-for-post-<%= @post.id %>").html(<%= @post.fav_count %>);
$("#show-favlist-link, #hide-favlist-link, #favlist").hide();
<% end %>
<% end %>
Danbooru.notice("You have unfavorited this post");
$(window).trigger("danbooru:notice", "You have unfavorited this post");

View File

@@ -1,7 +1,7 @@
<% if @forum_post_vote.invalid? %>
Danbooru.error(<%= raw @forum_post_vote.errors.full_messages.join("; ").to_json %>);
$(window).trigger("danbooru:error", <%= raw @forum_post_vote.errors.full_messages.join("; ").to_json %>);
<% else %>
Danbooru.notice("Voted");
$(window).trigger("danbooru:notice", "Voted");
var code = <%= raw render(partial: "forum_post_votes/list", locals: {forum_post: @forum_post, votes: @forum_post.votes}).to_json %>;
$("#forum-post-votes-for-<%= @forum_post.id %>").html(code);
<% end %>

View File

@@ -1,3 +1,3 @@
Danbooru.notice("Unvoted");
$(window).trigger("danbooru:notice", "Unvoted");
var code = <%= raw render(partial: "forum_post_votes/list", locals: {forum_post: @forum_post, votes: @forum_post.votes}).to_json %>;
$("#forum-post-votes-for-<%= @forum_post.id %>").html(code);

View File

@@ -6,9 +6,6 @@
<link rel="top" title="<%= Danbooru.config.app_name %>" href="/">
<%= csrf_meta_tag %>
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
<%= stylesheet_link_tag "application", :media => "screen" %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<%= javascript_include_tag "application" %>
<%= raw Danbooru.config.custom_html_header_content %>
<%= yield :html_header %>
</head>

View File

@@ -28,23 +28,12 @@
<meta name="disable-post-tooltips" content="<%= CurrentUser.disable_post_tooltips? %>">
<%= content_tag(:meta, nil, name: "disable-mobile-gestures", content: CurrentUser.disable_mobile_gestures?) %>
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
<% if Rails.env.production? %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" integrity="sha256-rByPlHULObEjJ6XQxW/flG2r+22R5dKiAoef+aXWfik=" crossorigin="anonymous" />
<% else %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" integrity="sha256-p6xU9YulB7E2Ic62/PX+h59ayb3PBJ0WFTEQxq0EjHw=" crossorigin="anonymous" />
<% end %>
<%= stylesheet_link_tag "application", :media => "screen" %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<%= javascript_pack_tag "application" %>
<%= stylesheet_pack_tag "application" %>
<% if CurrentUser.user.custom_style.present? %>
<%= stylesheet_link_tag custom_style_users_path, :media => "screen" %>
<% end %>
<% if Rails.env.production? %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha256-KM512VNnjElC30ehFwehXjx1YCHPiQkOPmqnrWtpccM=" crossorigin="anonymous"></script>
<% else %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.js" integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
<% end %>
<%= javascript_include_tag "application" %>
<%= raw Danbooru.config.custom_html_header_content %>
<%= yield :html_header %>
<% if Danbooru.config.twitter_site %>

View File

@@ -1,9 +1,9 @@
<% if @api_key.errors.any? %>
Danbooru.error("<%= j @api_key.errors.full_messages.join(', ') %>");
$(window).trigger("danbooru:error", "<%= j @api_key.errors.full_messages.join(', ') %>");
<% else %>
$("#api-key").text("<%= j @api_key.key %>");
$("#api-key-created").html("<%= j compact_time @api_key.created_at %>");
$("#api-key-updated").html("<%= j compact_time @api_key.updated_at %>");
Danbooru.notice("API key regenerated.");
$(window).trigger("danbooru:notice", "API key regenerated.");
<% end %>

View File

@@ -1,8 +1,8 @@
<% if @approval.errors.any? %>
Danbooru.error("Error: " + <%= @approval.errors.full_messages.join("; ").to_json.html_safe %>);
$(window).trigger("danbooru:error", "Error: " + <%= @approval.errors.full_messages.join("; ").to_json.html_safe %>);
<% else %>
Danbooru.notice("Post was approved");
Danbooru.ModQueue.increment_processed();
$(window).trigger("danbooru:notice", "Post was approved");
$(window).trigger("danbooru:modqueue_increment_processed");
<% end %>
$("#c-posts #approve").hide();

View File

@@ -1,8 +1,8 @@
<% if @post_disapproval.errors.any? %>
Danbooru.error("Error: " + <%= @post_disapproval.errors.full_messages.join("; ").to_json.html_safe %>);
$(window).trigger("danbooru:error", "Error: " + <%= @post_disapproval.errors.full_messages.join("; ").to_json.html_safe %>);
<% else %>
Danbooru.notice("Post was hidden");
Danbooru.ModQueue.increment_processed();
$(window).trigger("danbooru:notice", "Post was hidden");
$(window).trigger("danbooru:modqueue_increment_processed");
<% end %>
$("#c-posts #approve").hide();

View File

@@ -1,7 +1,7 @@
<% if @post.errors.any? %>
Danbooru.error("<%= j @post.errors.full_messages.join('; ') %>");
$(window).trigger("danbooru:error", "<%= j @post.errors.full_messages.join('; ') %>");
<% elsif @error %>
Danbooru.error("<%= j @error.to_s %>");
$(window).trigger("danbooru:error", "<%= j @error.to_s %>");
<% else %>
Danbooru.notice("Post was permanently deleted");
$(window).trigger("danbooru:notice", "Post was permanently deleted");
<% end %>

View File

@@ -1,3 +1,3 @@
$("#c-posts #delete").show();
$("#c-posts #undelete").hide();
Danbooru.notice("Post was undeleted");
$(window).trigger("danbooru:notice", "Post was undeleted");

View File

@@ -1,5 +1,5 @@
<% if @error %>
Danbooru.error("<%= j @error.to_s %>");
$(window).trigger("danbooru:error", "<%= j @error.to_s %>");
<% else %>
location.reload();
<% end %>

View File

@@ -1,6 +1,6 @@
var errors = "<%= j @post_appeal.errors.full_messages.join("; ") %>";
if (errors.length > 0) {
Danbooru.error(errors);
$(window).trigger("danbooru:error", errors);
} else {
Danbooru.notice("Post appealed");
$(window).trigger("danbooru:notice", "Post appealed");
}

View File

@@ -1,8 +1,8 @@
var errors = <%= @post_flag.errors.full_messages.to_json.html_safe %>;
if (errors.length > 0) {
Danbooru.error(errors.join("; "));
$(window).trigger("danbooru:error", errors.join("; "));
} else {
Danbooru.notice("Post flagged");
$(window).trigger("danbooru:notice", "Post flagged");
$("a#approve").show();
$("a#disapprove").show();
}

View File

@@ -1,7 +1,7 @@
<% if @error %>
Danbooru.notice("<%= j @error.to_s %>");
$(window).trigger("danbooru:notice", "<%= j @error.to_s %>");
<% else %>
Danbooru.notice("Vote saved");
$(window).trigger("danbooru:notice", "Vote saved");
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
<% end %>

View File

@@ -1,7 +1,7 @@
<% if @error %>
Danbooru.notice("<%= j @error.to_s %>");
$(window).trigger("danbooru:notice", "<%= j @error.to_s %>");
<% else %>
Danbooru.notice("Unvoted successfully");
$(window).trigger("danbooru:notice", "Unvoted successfully");
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
<% end %>
$("#vote-links-for-post-<%= @post.id %>").show();

View File

@@ -19,7 +19,7 @@
<% content_for(:html_header) do %>
<script>
$(function() {
/*$(function() {
$("#tags").on("keypress autocompleteclose", function(e) {
if (!$(this).data("fakeWidth")) {
$(this).data("fakeWidth", $('<span>').hide().appendTo(document.body));
@@ -29,6 +29,6 @@
$(this).width(width);
}
});
});
});*/
</script>
<% end %>

View File

@@ -1,5 +1,5 @@
<% if @saved_search.errors.any? %>
Danbooru.error("<%= j @saved_search.errors.full_messages.join(', ') %>");
$(window).trigger("danbooru:error", "<%= j @saved_search.errors.full_messages.join(', ') %>");
<% else %>
Danbooru.notice("Search '<%= j @saved_search.query %>' was saved");
$(window).trigger("danbooru:notice", "Search '<%= j @saved_search.query %>' was saved");
<% end %>

View File

@@ -1,4 +1,4 @@
Danbooru.notice("Search '<%= j @saved_search.query %>' was deleted");
$(window).trigger("danbooru:notice", "Search '<%= j @saved_search.query %>' was deleted");
$("#saved-searches-nav").html("<%= j render('saved_searches/interface', :saved_searches => CurrentUser.user.saved_searches) %>");
Danbooru.Post.initialize_saved_searches();
$(window).trigger("danbooru:initialize_saved_searches");
$("#saved-search-<%= @saved_search.id %>").remove();