* Additional effects

* Fixed flash pngs
* Fixed dmail search links
This commit is contained in:
albert
2011-11-03 17:42:40 -04:00
parent f6367aab49
commit c478eb33b6
13 changed files with 26 additions and 24 deletions

View File

@@ -35,18 +35,19 @@
Danbooru.Comment.initialize_expand_links = function() {
$(".comment-section form").hide();
$(".comment-section input.expand-comment-response").click(function() {
$(".comment-section input.expand-comment-response").click(function(e) {
var post_id = $(this).closest(".comment-section").data("post-id");
$(".comment-section[data-post-id=" + post_id + "] form").show();
$(this).hide();
$(".comment-section[data-post-id=" + post_id + "] form").slideDown("fast");
e.preventDefault();
});
}
Danbooru.Comment.initialize_response_link = function() {
$("a.expand-comment-response").click(function(e) {
e.preventDefault();
$(e.target).closest("div.new-comment").find("form").show();
$(e.target).hide();
$(e.target).closest("div.new-comment").find("form").slideDown("fast");
e.preventDefault();
});
$("div.new-comment form").hide();

View File

@@ -16,7 +16,7 @@
success: function(data) {
$button.val("Edit");
$input.hide();
$preview.html(data).show();
$preview.html(data).fadeIn("fast");
}
});
}
@@ -24,7 +24,7 @@
Danbooru.Dtext.call_edit = function(e, $button, $input, $preview) {
$button.val("Preview");
$preview.hide();
$input.show();
$input.slideDown("fast");
}
Danbooru.Dtext.click_button = function(e) {

View File

@@ -17,7 +17,7 @@
$("#mode-box select").val(Danbooru.Cookie.get("mode"));
}
$("#mode-box select").click(Danbooru.PostModeMenu.change);
$("#mode-box select").change(Danbooru.PostModeMenu.change);
}
Danbooru.PostModeMenu.initialize_preview_link = function() {
@@ -27,7 +27,7 @@
Danbooru.PostModeMenu.initialize_edit_form = function() {
$("#quick-edit-div").hide();
$("#quick-edit-form input[value=Cancel]").click(function(e) {
$("#quick-edit-div").hide();
$("#quick-edit-div").slideUp("fast");
e.preventDefault();
});
@@ -49,14 +49,14 @@
});
}
Danbooru.PostModeMenu.change = function() {
$("#quick-edit-div").hide();
Danbooru.PostModeMenu.change = function(e) {
$("#quick-edit-div").slideUp("fast");
var s = $("#mode-box select").val();
var $body = $(document.body);
$body.removeClass();
$body.addClass("mode-" + s);
Danbooru.Cookie.put("mode", s, 7);
Danbooru.Cookie.put("mode", s, 1);
if (s === "edit-tag-script") {
var script = Danbooru.Cookie.get("tag-script");
script = prompt("Enter a tag script", script);
@@ -68,15 +68,15 @@
$("#mode-box select").val("view");
}
Danbooru.PostModeMenu.change();
Danbooru.PostModeMenu.change(e);
}
}
Danbooru.PostModeMenu.open_edit = function(post_id) {
var $post = $("#post_" + post_id);
$("#quick-edit-div").show();
$("#quick-edit-div").slideDown("fast");
$("#quick-edit-form").attr("action", "/posts/" + post_id + ".json");
$("#post_tag_string").val($post.data("tags"));
$("#post_tag_string").val($post.data("tags")).focus();
}
Danbooru.PostModeMenu.click = function(e) {

View File

@@ -2,9 +2,8 @@
Danbooru.Upload = {};
Danbooru.Upload.initialize_all = function() {
this.initialize_image();
if ($("#c-uploads").length) {
this.initialize_image();
this.initialize_info();
this.initialize_similar();
}

View File

@@ -4,11 +4,11 @@
}
Danbooru.notice = function(msg) {
$('#notice').html(msg).addClass("ui-state-highlight").removeClass("ui-state-error").slideDown("fast");
$('#notice').html(msg).addClass("ui-state-highlight").removeClass("ui-state-error").fadeIn("fast");
}
Danbooru.error = function(msg) {
$('#notice').html(msg).removeClass("ui-state-highlight").addClass("ui-state-error").slideDown("fast");
$('#notice').html(msg).removeClass("ui-state-highlight").addClass("ui-state-error").fadeIn("fast");
}
Danbooru.ajax_start = function(target) {

View File

@@ -16,6 +16,7 @@ class Dmail < ActiveRecord::Base
scope :active, where(["is_deleted = ?", false])
scope :deleted, where(["is_deleted = ?", true])
scope :search_message, lambda {|query| where(["message_index @@ plainto_tsquery(?)", query])}
scope :unread, where("is_read = false and is_deleted = false")
module AddressMethods
def to_name

View File

@@ -136,7 +136,7 @@ class Post < ActiveRecord::Base
def medium_file_url
if has_medium?
if is_flash?
"/images/480x150-flash.png"
"/images/480x200-flash.png"
else
"/data/medium/#{file_path_prefix}#{md5}.jpg"
end
@@ -235,7 +235,7 @@ class Post < ActiveRecord::Base
def medium_image_height
if is_flash?
return 204
return 200
end
ratio = Danbooru.config.medium_image_width.to_f / image_width.to_f

View File

@@ -37,6 +37,7 @@ class User < ActiveRecord::Base
has_one :ban
has_many :subscriptions, :class_name => "TagSubscription", :foreign_key => "creator_id"
has_many :note_versions, :foreign_key => "updater_id"
has_many :dmails, :foreign_key => "owner_id", :order => "dmails.id desc"
belongs_to :inviter, :class_name => "User"
scope :named, lambda {|name| where(["lower(name) = ?", name])}
scope :admins, where("is_admin = TRUE")

View File

@@ -8,4 +8,3 @@ $("div.comments-for-post[data-post-id=<%= @post.id %>] div.list-of-comments").ht
<% else %>
Danbooru.Comment.hide_threshold_comments(<%= @post.id %>);
<% end %>

View File

@@ -1,7 +1,7 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Received", dmails_path(:search => {:to_id_eq => CurrentUser.id}) %></li>
<li><%= link_to "Sent", dmails_path(:search => {:from_id_eq => CurrentUser.id}) %></li>
<li><%= link_to "Received", dmails_path(:search => {:owner_id_eq => CurrentUser.id, :to_id_eq => CurrentUser.id}) %></li>
<li><%= link_to "Sent", dmails_path(:search => {:owner_id_eq => CurrentUser.id, :from_id_eq => CurrentUser.id}) %></li>
<li><%= link_to "New", new_dmail_path %></li>
<li><%= link_to "Search", search_dmails_path %></li>
</menu>

View File

@@ -6,6 +6,7 @@
<% if @user.id == CurrentUser.id %>
<li><%= link_to "Settings", edit_user_path(CurrentUser.user) %></li>
<li><%= link_to "Profile", user_path(CurrentUser.user) %></li>
<li><%= link_to "Messages (#{CurrentUser.dmails.unread.count})", dmails_path(:search => {:owner_id_eq => CurrentUser.id, :to_id_eq => CurrentUser.id}) %></li>
<% else %>
<li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
<% end %>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

BIN
public/images/480x200-flash.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB