disable tos redirect

This commit is contained in:
albert
2013-02-24 11:43:24 -05:00
parent bb3508a536
commit 65a87941e6
8 changed files with 14 additions and 17 deletions

View File

@@ -49,14 +49,6 @@
if (loc.match(/^http/)) {
loc = loc.replace(/^https?:\/\/[^\/]+/, "")
}
if (!loc.match(/\/static\/terms_of_service/) && this.get("tos") != "1") {
// Setting location.pathname in Safari doesn't work, so manually extract the domain.
var domain = location.href.match(/^(https?:\/\/[^\/]+)/)[0];
location.href = domain + "/static/terms_of_service";
this.put("toc", "1", 365)
return;
}
if (this.get("hide-upgrade-account") != "1") {
$("#upgrade-account").show();

View File

@@ -8,7 +8,7 @@ div#page {
overflow: visible;
margin: 0 30px;
div#upgrade-account-notice, div#sign-up-notice {
div#upgrade-account-notice, div#sign-up-notice, div#tos-notice {
margin: 1em 0;
padding: 1em;
text-align: center;

View File

@@ -37,6 +37,10 @@ class Tag < ActiveRecord::Base
def counts_for(tag_names)
select_all_sql("SELECT name, post_count FROM tags WHERE name IN (?)", tag_names)
end
def fix_post_count
update_column(:post_count, Post.tag_match("#{name} status:any").count)
end
end
module ViewCountMethods

View File

@@ -105,7 +105,7 @@ class TagAlias < ActiveRecord::Base
end
def update_posts
Post.tag_match(antecedent_name).find_each do |post|
Post.tag_match("#{antecedent_name} status:any").find_each do |post|
escaped_antecedent_name = Regexp.escape(antecedent_name)
fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{consequent_name} ").strip

View File

@@ -119,7 +119,7 @@ class TagImplication < ActiveRecord::Base
end
def update_posts
Post.tag_match(antecedent_name).find_each do |post|
Post.tag_match("#{antecedent_name} status:any").find_each do |post|
escaped_antecedent_name = Regexp.escape(antecedent_name)
fixed_tags = post.tag_string.sub(/(?:\A| )#{escaped_antecedent_name}(?:\Z| )/, " #{antecedent_name} #{descendant_names} ").strip
CurrentUser.scoped(creator, creator_ip_addr) do

View File

@@ -43,6 +43,10 @@
<%= render "users/upgrade_notice" %>
<% end %>
<% if !CurrentUser.is_privileged? && CurrentUser.user.created_at > 2.weeks.ago %>
<%= render "users/tos" %>
<% end %>
<%- if flash[:notice] -%>
<div class="ui-corner-all ui-state-highlight" id="notice"><%= flash[:notice] %></div>
<%- else -%>

View File

@@ -52,11 +52,5 @@
<p>The Site will not disclose the IP address, email address, password, or DMails of any user except to the staff.</p>
<p>The Site is allowed to make public everything else, including but not limited to: uploaded posts, favorited posts, comments, forum posts, wiki edits, and note edits.</p>
</div>
<div>
<h4>Agreement</h4>
<p>By clicking on the "I Agree" link, you have read all the terms and have agreed to them.</p>
<p><%= link_to("I Agree", params[:url] || "/", :onclick => "Danbooru.Cookie.put('tos', '1')") %> | <%= link_to("Cancel", "/") %></p>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<div class="ui-corner-all ui-state-highlight" id="tos-notice">
<h1><%= link_to "Read the rules before proceeding!", terms_of_service_path %></h1>
</div>