moved some donmai-specific stuff out of default config

This commit is contained in:
albert
2010-11-19 13:44:11 -05:00
parent 190beedb7a
commit a156cc8c62
11 changed files with 89 additions and 43 deletions

View File

@@ -182,18 +182,7 @@ module Danbooru
# Any custom code you want to insert into the default layout without
# having to modify the templates.
def custom_html_header_content
%{
<script type="text/javascript">
//var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
//document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
//var pageTracker = _gat._getTracker("UA-86094-4");
//pageTracker._trackPageview();
} catch(err) {}
</script>
}.html_safe
nil
end
# The number of posts displayed per page.
@@ -202,11 +191,11 @@ module Danbooru
end
def is_post_restricted?(post)
post.has_tag?("loli") || post.has_tag?("shota")
false
end
def is_user_restricted?(user)
!user.is_privileged? || user.name == "ppayne"
!user.is_privileged?
end
def can_user_see_post?(user, post)
@@ -218,7 +207,7 @@ module Danbooru
end
def select_posts_visible_to_user(user, posts)
posts.select {|x| !is_user_restricted?(user) || !is_post_restricted?(x)}
posts.select {|x| can_user_see_post?(x)}
end
end
end

View File

@@ -8,5 +8,28 @@ module Danbooru
def posts_per_page
1
end
def is_user_restricted?(user)
!user.is_privileged? || user.name == "ppayne"
end
def is_post_restricted?(post)
post.has_tag?("loli") || post.has_tag?("shota")
end
def custom_html_header_content
%{
<script type="text/javascript">
//var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
//document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
//var pageTracker = _gat._getTracker("UA-86094-4");
//pageTracker._trackPageview();
} catch(err) {}
</script>
}.html_safe
end
end
end

View File

@@ -1,7 +1,3 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'

View File

@@ -1,12 +1,7 @@
Danbooru::Application.routes.draw do
namespace :admin do
resources :users
resources :posts do
collection do
get :mass_edit
put :mass_update
end
end
match 'users/edit' => 'users#edit', :via => :get
match 'users' => 'users#update', :via => :put
end
resources :advertisements
resources :advertisement_hits