diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 8f1920169..b7e1aa757 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -341,9 +341,11 @@ $("#image-resize-link").click(function(e) { var $link = $(e.target); var $image = $("#image"); + $image.removeAttr("src"); + $image.attr("src", "https://www.google.com") $image.attr("src", $link.attr("href")); $image.width($image.data("original-width")); - $image.height($image.data("original-height")); + $image.height($image.data("original-height")); Danbooru.Note.Box.scale_all(); $("#image-resize-notice").hide(); $image.data("scale_factor", 1); diff --git a/app/assets/stylesheets/specific/explore.css.scss b/app/assets/stylesheets/specific/explore.css.scss index 62b76e2d6..0e59e150d 100644 --- a/app/assets/stylesheets/specific/explore.css.scss +++ b/app/assets/stylesheets/specific/explore.css.scss @@ -1,3 +1,5 @@ +@import "../common/000_vars.css.scss"; + div#c-explore-posts { header { text-align: center; @@ -16,4 +18,10 @@ div#c-explore-posts { padding: 1em; margin-bottom: 2em; } + + div#a-intro { + width: 870px; + margin: 0 auto; + text-align: center; + } } diff --git a/app/assets/stylesheets/specific/reports.css.scss b/app/assets/stylesheets/specific/reports.css.scss new file mode 100644 index 000000000..e69de29bb diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index fe2cc88c0..694ddc6c6 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -1,5 +1,5 @@ class PostsController < ApplicationController - before_filter :member_only, :except => [:show, :show_seq, :index] + before_filter :member_only, :except => [:show, :show_seq, :index, :home] before_filter :builder_only, :only => [:copy_notes] after_filter :save_recent_tags, :only => [:update] respond_to :html, :xml, :json @@ -98,6 +98,14 @@ class PostsController < ApplicationController @error = x end + def home + if CurrentUser.user.is_anonymous? + redirect_to intro_explore_posts_path + else + redirect_to posts_path(:tags => params[:tags]) + end + end + private def tag_query params[:tags] || (params[:post] && params[:post][:tags]) diff --git a/app/logical/d_text.rb b/app/logical/d_text.rb index 67bfe6298..8f024028f 100644 --- a/app/logical/d_text.rb +++ b/app/logical/d_text.rb @@ -86,15 +86,22 @@ class DText def self.parse_list(str, options = {}) html = "" + current_item = "" layout = [] nest = 0 str.split(/\n/).each do |line| if line =~ /^\s*(\*+) (.+)/ + if nest > 0 + html += "
#{current_item}
" + end + nest = $1.size - content = parse_inline($2) + current_item = parse_inline($2) else - content = parse_inline(line) + current_item += parse_inline(line) end if nest > layout.size @@ -108,10 +115,10 @@ class DText html += "#{elist}>" end end - - html += "'
@@ -208,7 +215,7 @@ class DText
if stack.last == "expandable"
stack.pop
''
- end
+ end
else
if flags[:code]
diff --git a/app/logical/post_sets/intro.rb b/app/logical/post_sets/intro.rb
index c6517e9e7..4449cb957 100644
--- a/app/logical/post_sets/intro.rb
+++ b/app/logical/post_sets/intro.rb
@@ -6,7 +6,7 @@ module PostSets
def posts
@posts ||= begin
- temp = ::Post.tag_match("#{tag_string} favcount:>10").paginate(page, :search_count => nil, :limit => 6)
+ temp = ::Post.tag_match("#{tag_string} favcount:>3").paginate(page, :search_count => nil, :limit => 5)
temp.all
temp
end
diff --git a/app/logical/reports/user_promotions.rb b/app/logical/reports/user_promotions.rb
index 3fe16ae27..8885797f6 100644
--- a/app/logical/reports/user_promotions.rb
+++ b/app/logical/reports/user_promotions.rb
@@ -2,6 +2,19 @@ require 'statistics2'
module Reports
class UserPromotions
+ class User
+ attr_reader :user
+ delegate :name, :post_upload_count, :level_string, :level, :created_at, :to => :user
+
+ def initialize(user)
+ @user = user
+ end
+
+ def confidence_interval_for(n)
+ Reports::UserPromotions.confidence_interval_for(user, n)
+ end
+ end
+
def self.confidence_interval_for(user, n)
up_votes = Post.where("created_at >= ?", min_time).where(:uploader_id => user.id).where("fav_count >= ?", n).count
total_votes = Post.where("created_at >= ?", min_time).where(:uploader_id => user.id).count
@@ -23,7 +36,7 @@ module Reports
end
def users
- User.where("users.level < ? and users.post_upload_count >= 100", User::Levels::CONTRIBUTOR).order("created_at desc").limit(50)
+ ::User.where("users.level < ? and users.post_upload_count >= 100", ::User::Levels::CONTRIBUTOR).order("created_at desc").limit(50).map {|x| Reports::UserPromotions::User.new(x)}
end
end
end
diff --git a/app/models/janitor_trial.rb b/app/models/janitor_trial.rb
index 1ec3ab20c..5b6fba2b1 100644
--- a/app/models/janitor_trial.rb
+++ b/app/models/janitor_trial.rb
@@ -3,7 +3,6 @@ class JanitorTrial < ActiveRecord::Base
before_create :initialize_original_level
after_create :send_dmail
after_create :promote_user
- after_destroy :create_feedback
validates_presence_of :user
before_validation :initialize_creator
@@ -61,6 +60,7 @@ class JanitorTrial < ActiveRecord::Base
def demote!
user.update_column(:level, original_level)
+ self.create_feedback
destroy
end
end
diff --git a/app/models/tag.rb b/app/models/tag.rb
index baa234c7c..94f9eb6de 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -141,7 +141,12 @@ class Tag < ActiveRecord::Base
counts = counts.to_a.select {|x| x[1] > trending_count_limit}
counts = counts.map do |tag_name, recent_count|
tag = Tag.find_or_create_by_name(tag_name)
- [tag_name, recent_count.to_f / tag.post_count.to_f]
+ if tag.category == Danbooru.config.tag_category_mapping["artist"]
+ # we're not interested in artists in the trending list
+ [tag_name, 0]
+ else
+ [tag_name, recent_count.to_f / tag.post_count.to_f]
+ end
end
counts.sort_by {|x| -x[1]}.slice(0, 25).map(&:first)
diff --git a/app/views/comments/index_for_post.js.erb b/app/views/comments/index_for_post.js.erb
index c7643f94a..183fd1bb9 100644
--- a/app/views/comments/index_for_post.js.erb
+++ b/app/views/comments/index_for_post.js.erb
@@ -11,3 +11,4 @@ $("div.comments-for-post[data-post-id=<%= @post.id %>] div.list-of-comments").ht
Danbooru.Comment.initialize_reply_links();
Danbooru.Comment.initialize_edit_links();
+Danbooru.Comment.initialize_vote_links();
diff --git a/app/views/explore/posts/intro.html.erb b/app/views/explore/posts/intro.html.erb
index a77f0a25e..52b33da98 100644
--- a/app/views/explore/posts/intro.html.erb
+++ b/app/views/explore/posts/intro.html.erb
@@ -14,7 +14,7 @@
<% @presenter.each do |tag, post_set| %>
- <%= link_to tag, posts_path(:tags => tag), :class => "tag-type-3" %>
+ <%= link_to tag, posts_path(:tags => tag) %>
<%= post_set.presenter.post_previews_html(self) %>
diff --git a/app/views/reports/user_promotions.html.erb b/app/views/reports/user_promotions.html.erb
index db89f783f..26ba0d0e1 100644
--- a/app/views/reports/user_promotions.html.erb
+++ b/app/views/reports/user_promotions.html.erb
@@ -4,29 +4,45 @@
Binomial proportion confidence interval for how likely a user's uploads will achieve a fav count of at at least n with 95% confidence within the past 30 days.
- | User | -Level | -score:1+ | -score:5+ | -score:10+ | +User | +Level | +Uploads | +Age | +score:1+ | +score:5+ | +score:10+ |
|---|---|---|---|---|---|---|---|---|---|---|---|
| <%= link_to user.name, user_path(user) %> | -<%= user.level_string %> | -<%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 1), :precision => 0 %> | -<%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 5), :precision => 0 %> | -<%= number_to_percentage Reports::UserPromotions.confidence_interval_for(user, 10), :precision => 0 %> | +<%= link_to user.name, user_path(user.user) %> | +<%= user.level_string %> | +<%= user.post_upload_count %> | +<%= time_ago_in_words user.created_at %> | +<%= number_to_percentage user.confidence_interval_for(1), :precision => 0 %> | +<%= number_to_percentage user.confidence_interval_for(5), :precision => 0 %> | +<%= number_to_percentage user.confidence_interval_for(10), :precision => 0 %> |
a (http://test.com) b
', p('a (http://test.com) b')) end - + def test_old_syle_links assert_equal('', p('"test":http://test.com')) end @@ -125,6 +125,14 @@ class DTextTest < ActiveSupport::TestCase assert_equal('', p("* post #1").gsub(/\n/, "")) end + def test_lists_not_preceded_by_newline + assert_equal('ab
a