From 63d3cb337a8faacd63e16485160c6300fd5e8460 Mon Sep 17 00:00:00 2001 From: albert Date: Sun, 18 Sep 2011 17:59:20 -0400 Subject: [PATCH] Fixes #82: Notes do not hide when clicking image --- app/assets/javascripts/notes.js | 17 +++++++++++++++++ app/assets/stylesheets/application.css.scss | 1 + app/models/upload.rb | 2 +- app/models/user.rb | 4 ++-- app/views/note_versions/index.html.erb | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 3b4115560..f8ecf0560 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -29,6 +29,7 @@ Danbooru.Note = { Danbooru.Note.dragging = true; Danbooru.Note.clear_timeouts(); Danbooru.Note.Body.hide_all(); + e.stopPropagation(); } ) @@ -37,6 +38,7 @@ Danbooru.Note = { function(e) { var $note_box_inner = $(e.currentTarget); Danbooru.Note.Box.resize_inner_border($note_box_inner); + e.stopPropagation(); } ); @@ -44,6 +46,7 @@ Danbooru.Note = { "dragstop resizestop", function(e) { Danbooru.Note.dragging = false; + e.stopPropagation(); } ); @@ -60,6 +63,8 @@ Danbooru.Note = { } else if (e.type === "mouseout") { Danbooru.Note.Body.hide($note_box_inner.data("id")); } + + e.stopPropagation(); } ); }, @@ -126,6 +131,10 @@ Danbooru.Note = { $(".note-box").each(function(i, v) { Danbooru.Note.Box.descale($(v)); }); + }, + + toggle_all: function() { + $(".note-box").toggle(); } }, @@ -219,18 +228,25 @@ Danbooru.Note = { $note_body.mouseover(function(e) { var $note_body_inner = $(e.currentTarget); Danbooru.Note.Body.show($note_body_inner.data("id")); + e.stopPropagation(); }); $note_body.mouseout(function(e) { var $note_body_inner = $(e.currentTarget); Danbooru.Note.Body.hide($note_body_inner.data("id")); + e.stopPropagation(); }); if (Danbooru.meta("current-user-name") !== "Anonymous") { $note_body.click(function(e) { var $note_body_inner = $(e.currentTarget); Danbooru.Note.Edit.show($note_body_inner); + e.stopPropagation(); }) + } else { + $note_body.click(function(e) { + e.stopPropagation(); + }); } } }, @@ -457,5 +473,6 @@ $(function() { $("#note-container").width($("#image").width()).height($("#image").height()); $(document).bind("keydown", "ctrl+n", Danbooru.Note.TranslationMode.start); Danbooru.Note.load_all(); + $("#note-container").click(Danbooru.Note.Box.toggle_all); } }); diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 5c9a15f22..d66f4ff7a 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -1048,6 +1048,7 @@ div#c-moderator-post-dashboards { /*** Note Container ***/ div#note-container { position: absolute; + z-index: 500; div.note-body { position: absolute; diff --git a/app/models/upload.rb b/app/models/upload.rb index 840235122..2a8c158c3 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -126,7 +126,7 @@ class Upload < ActiveRecord::Base module ResizerMethods def generate_resizes(source_path) - generate_resize_for(Danbooru.config.small_image_width, Danbooru.config.small_image_width, source_path, 80) + generate_resize_for(Danbooru.config.small_image_width, Danbooru.config.small_image_width, source_path, 85) generate_resize_for(Danbooru.config.medium_image_width, nil, source_path) generate_resize_for(Danbooru.config.large_image_width, nil, source_path) end diff --git a/app/models/user.rb b/app/models/user.rb index d49b9f22b..5419ccd98 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -15,7 +15,7 @@ class User < ActiveRecord::Base attr_accessor :password, :old_password attr_accessible :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr, :time_zone, :default_image_size - validates_length_of :name, :within => 2..20, :on => :create + validates_length_of :name, :within => 2..1000, :on => :create validates_format_of :name, :with => /\A[^\s:]+\Z/, :on => :create, :message => "cannot have whitespace or colons" validates_uniqueness_of :name, :case_sensitive => false, :on => :create validates_uniqueness_of :email, :case_sensitive => false, :on => :create, :if => lambda {|rec| !rec.email.blank?} @@ -122,7 +122,7 @@ class User < ActiveRecord::Base vowels = "aeiou" pass = "" - 4.times do + 6.times do pass << consonants[rand(21), 1] pass << vowels[rand(5), 1] end diff --git a/app/views/note_versions/index.html.erb b/app/views/note_versions/index.html.erb index 78adcd579..00e283e58 100644 --- a/app/views/note_versions/index.html.erb +++ b/app/views/note_versions/index.html.erb @@ -1,6 +1,6 @@
- +