fixes #848
This commit is contained in:
@@ -161,6 +161,10 @@ class AnonymousUser
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def enable_sequential_post_navigation
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
%w(member banned privileged builder platinum contributor janitor moderator admin).each do |name|
|
%w(member banned privileged builder platinum contributor janitor moderator admin).each do |name|
|
||||||
define_method("is_#{name}?") do
|
define_method("is_#{name}?") do
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
attr_accessor :password, :old_password
|
attr_accessor :password, :old_password
|
||||||
attr_accessible :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :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, :as => [:moderator, :janitor, :contributor, :privileged, :member, :anonymous, :default, :builder, :admin]
|
attr_accessible :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :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, :enable_sequential_post_navigation, :as => [:moderator, :janitor, :contributor, :privileged, :member, :anonymous, :default, :builder, :admin]
|
||||||
attr_accessible :level, :as => :admin
|
attr_accessible :level, :as => :admin
|
||||||
validates_length_of :name, :within => 2..100, :on => :create
|
validates_length_of :name, :within => 2..100, :on => :create
|
||||||
validates_format_of :name, :with => /\A[^\s:]+\Z/, :on => :create, :message => "cannot have whitespace or colons"
|
validates_format_of :name, :with => /\A[^\s:]+\Z/, :on => :create, :message => "cannot have whitespace or colons"
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class PostPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_nav_links?(template)
|
def has_nav_links?(template)
|
||||||
(template.params[:tags].present? && template.params[:tags] !~ /order:/) || @post.pools.active.any?
|
(CurrentUser.user.enable_sequential_post_navigation && template.params[:tags].present? && template.params[:tags] !~ /order:/) || @post.pools.active.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_footer_for_pool_html(template)
|
def post_footer_for_pool_html(template)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<% if (position == "bottom" && CurrentUser.user.new_post_navigation_layout) || (position == "top" && !CurrentUser.user.new_post_navigation_layout) %>
|
<% if (position == "bottom" && CurrentUser.user.new_post_navigation_layout) || (position == "top" && !CurrentUser.user.new_post_navigation_layout) %>
|
||||||
<div id="nav-links" class="ui-corner-all nav-notice">
|
<div id="nav-links" class="ui-corner-all nav-notice">
|
||||||
<% if params[:tags].present? && params[:tags] !~ /order:/ %>
|
<% if CurrentUser.user.enable_sequential_post_navigation && params[:tags].present? && params[:tags] !~ /order:/ %>
|
||||||
<%= render "posts/partials/show/search_seq", :post => post %>
|
<%= render "posts/partials/show/search_seq", :post => post %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<%= f.input :default_image_size, :hint => "Show original image or show resampled #{Danbooru.config.large_image_width} pixel version", :label => "Image size", :collection => %w(large original), :include_blank => false %>
|
<%= f.input :default_image_size, :hint => "Show original image or show resampled #{Danbooru.config.large_image_width} pixel version", :label => "Image size", :collection => %w(large original), :include_blank => false %>
|
||||||
<%= f.input :enable_post_navigation, :as => :select, :include_blank => false, :label => "Enable keyboard shortcuts" %>
|
<%= f.input :enable_post_navigation, :as => :select, :include_blank => false, :label => "Enable keyboard shortcuts" %>
|
||||||
<%= f.input :new_post_navigation_layout, :as => :select, :label => "Pool links", :include_blank => false, :collection => [["Bottom", "true"], ["Top", "false"]], :hint => "When browsing pools, where do you want the navigation links to be placed?" %>
|
<%= f.input :new_post_navigation_layout, :as => :select, :label => "Pool links", :include_blank => false, :collection => [["Bottom", "true"], ["Top", "false"]], :hint => "When browsing pools, where do you want the navigation links to be placed?" %>
|
||||||
|
<%= f.input :enable_sequential_post_navigation, :as => :select, :label => "Enable slideshow mode", :hint => "Show prev/next links when viewing a post", :include_blank => false %>
|
||||||
|
|
||||||
<div class="input text optional field_with_hint">
|
<div class="input text optional field_with_hint">
|
||||||
<label class="text optional" for="user_favorite_tags">Favorite tags</label>
|
<label class="text optional" for="user_favorite_tags">Favorite tags</label>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddEnablePostSeqNavigationToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
execute "set statement_timeout = 0"
|
||||||
|
add_column :users, :enable_sequential_post_navigation, :boolean, :null => false, :default => true
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -2602,7 +2602,8 @@ CREATE TABLE users (
|
|||||||
bcrypt_password_hash text,
|
bcrypt_password_hash text,
|
||||||
enable_post_navigation boolean DEFAULT true NOT NULL,
|
enable_post_navigation boolean DEFAULT true NOT NULL,
|
||||||
new_post_navigation_layout boolean DEFAULT true NOT NULL,
|
new_post_navigation_layout boolean DEFAULT true NOT NULL,
|
||||||
enable_privacy_mode boolean DEFAULT false NOT NULL
|
enable_privacy_mode boolean DEFAULT false NOT NULL,
|
||||||
|
enable_sequential_post_navigation boolean DEFAULT true NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -6253,4 +6254,6 @@ INSERT INTO schema_migrations (version) VALUES ('20130308204213');
|
|||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20130318002652');
|
INSERT INTO schema_migrations (version) VALUES ('20130318002652');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20130318012517');
|
INSERT INTO schema_migrations (version) VALUES ('20130318012517');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20130318030619');
|
||||||
Reference in New Issue
Block a user