add new options for moving nav links
This commit is contained in:
@@ -127,25 +127,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_nav_help_link = function() {
|
Danbooru.Post.initialize_nav_help_link = function() {
|
||||||
$("#close-nav-help-link").click(function(e) {
|
|
||||||
Danbooru.Cookie.put("close-nav-help", "1");
|
|
||||||
$("#nav-help").hide();
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Danbooru.Cookie.get("close-nav-help") === "1") {
|
|
||||||
$("#nav-help").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#close-search-seq-nav").click(function(e) {
|
|
||||||
Danbooru.Cookie.put("close-search-seq", "1");
|
|
||||||
$("#search-seq-nav").hide();
|
|
||||||
e.preventDefault();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Danbooru.Cookie.get("close-search-seq") === "1") {
|
|
||||||
$("#search-seq-nav").hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Danbooru.Post.initialize_titles = function() {
|
Danbooru.Post.initialize_titles = function() {
|
||||||
|
|||||||
@@ -231,9 +231,18 @@ div#c-posts {
|
|||||||
margin: 0 1em;
|
margin: 0 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pool-nav, #search-seq-nav, #nav-help {
|
#nav-links {
|
||||||
margin: 1em 0;
|
margin: 1em 0;
|
||||||
|
padding: 1em 0.5em;
|
||||||
|
|
||||||
|
#keyboard-shortcuts-link {
|
||||||
|
margin-top: 1em;
|
||||||
|
font-size: 80%;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pool-nav, #search-seq-nav, #nav-help {
|
||||||
li {
|
li {
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -149,6 +149,18 @@ class AnonymousUser
|
|||||||
0
|
0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def enable_post_navigation
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_post_navigation_layout
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def enable_privacy_mode
|
||||||
|
false
|
||||||
|
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 :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, :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"
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ class PostPresenter < Presenter
|
|||||||
@tag_set_presenter.split_tag_list_html(template, options.merge(:show_extra_links => CurrentUser.user.is_privileged?))
|
@tag_set_presenter.split_tag_list_html(template, options.merge(:show_extra_links => CurrentUser.user.is_privileged?))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_nav_links?(template)
|
||||||
|
template.params[:tags].present? || @post.pools.active.any?
|
||||||
|
end
|
||||||
|
|
||||||
def post_footer_for_pool_html(template)
|
def post_footer_for_pool_html(template)
|
||||||
if template.params[:pool_id]
|
if template.params[:pool_id]
|
||||||
pool = Pool.where(:id => template.params[:pool_id]).first
|
pool = Pool.where(:id => template.params[:pool_id]).first
|
||||||
|
|||||||
13
app/views/posts/partials/show/_nav_links.html.erb
Normal file
13
app/views/posts/partials/show/_nav_links.html.erb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<% 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">
|
||||||
|
<% if params[:tags].present? && CurrentUser.user.enable_post_navigation && params[:tags] !~ /order:/ %>
|
||||||
|
<%= render "posts/partials/show/search_seq", :post => post %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if post.pools.active.any? %>
|
||||||
|
<%= render "posts/partials/show/pools", :post => post %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p id="keyboard-shortcuts-link"><%= link_to "Keyboard shortcuts available", keyboard_shortcuts_path %></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<div id="pool-nav" class="ui-corner-all nav-notice">
|
<div id="pool-nav">
|
||||||
<%= @post.presenter.pool_html(self) %>
|
<%= @post.presenter.pool_html(self) %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div id="search-seq-nav" class="ui-corner-all nav-notice">
|
<div id="search-seq-nav">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<%= link_to "«prev".html_safe, show_seq_post_path(post, :tags => params[:tags], :seq => "prev"), :rel => "prev", :class => "prev" %>
|
<%= link_to "«prev".html_safe, show_seq_post_path(post, :tags => params[:tags], :seq => "prev"), :rel => "prev", :class => "prev" %>
|
||||||
@@ -6,6 +6,4 @@
|
|||||||
<%= link_to "next»".html_safe, show_seq_post_path(post, :tags => params[:tags], :seq => "next"), :rel => "next", :class => "next" %>
|
<%= link_to "next»".html_safe, show_seq_post_path(post, :tags => params[:tags], :seq => "next"), :rel => "next", :class => "next" %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<span class="close-button ui-icon ui-icon-closethick" id="close-search-seq-nav"></span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<section id="content">
|
<section id="content">
|
||||||
|
<% if @post.presenter.has_nav_links?(self) %>
|
||||||
|
<%= render "posts/partials/show/nav_links", :post => @post, :position => "top" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render "posts/partials/show/notices", :post => @post %>
|
<%= render "posts/partials/show/notices", :post => @post %>
|
||||||
|
|
||||||
<%= render_advertisement("horizontal") %>
|
<%= render_advertisement("horizontal") %>
|
||||||
@@ -39,16 +43,8 @@
|
|||||||
<%= @post.presenter.image_html(self) %>
|
<%= @post.presenter.image_html(self) %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<% if params[:tags] || @post.pools.active.any? %>
|
<% if @post.presenter.has_nav_links?(self) %>
|
||||||
<%= render "posts/partials/show/nav_help" %>
|
<%= render "posts/partials/show/nav_links", :post => @post, :position => "bottom" %>
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if params[:tags] %>
|
|
||||||
<%= render "posts/partials/show/search_seq", :post => @post %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if @post.pools.active.any? %>
|
|
||||||
<%= render "posts/partials/show/pools", :post => @post %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<menu id="post-sections">
|
<menu id="post-sections">
|
||||||
|
|||||||
@@ -17,6 +17,9 @@
|
|||||||
<li><span class="key">n</span> New note</li>
|
<li><span class="key">n</span> New note</li>
|
||||||
<li><span class="key">e</span> Edit tags</li>
|
<li><span class="key">e</span> Edit tags</li>
|
||||||
<li><span class="key">/</span> Search</li>
|
<li><span class="key">/</span> Search</li>
|
||||||
|
<li><span class="key">space</span> Scroll down/next post</li>
|
||||||
|
<li><span class="key">←</span> Previous post</li>
|
||||||
|
<li><span class="key">→</span> Next post</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,16 +4,14 @@
|
|||||||
|
|
||||||
<%= simple_form_for @user do |f| %>
|
<%= simple_form_for @user do |f| %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<% if @user.feedback.negative.count == 0 %>
|
|
||||||
<%#= f.input :name, :as => :string %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= f.input :email, :required => Danbooru.config.enable_email_verification?, :hint => "Used for messages and for password resets", :as => :email %>
|
<%= f.input :email, :required => Danbooru.config.enable_email_verification?, :hint => "Used for messages and for password resets", :as => :email %>
|
||||||
<%= f.input :time_zone %>
|
<%= f.input :time_zone, :include_blank => false %>
|
||||||
<%= f.input :receive_email_notifications %>
|
<%= f.input :receive_email_notifications, :as => :select, :include_blank => false %>
|
||||||
<%= f.input :comment_threshold, :hint => "Comments below this score will be hidden by default" %>
|
<%= f.input :comment_threshold, :hint => "Comments below this score will be hidden by default" %>
|
||||||
<%= f.input :always_resize_images %>
|
<%= f.input :always_resize_images, :as => :select, :include_blank => false %>
|
||||||
<%= f.input :default_image_size, :hint => "Large is #{Danbooru.config.large_image_width} pixels wide, and original is whatever the original image is", :collection => %w(large original), :include_blank => false %>
|
<%= f.input :default_image_size, :hint => "Large is #{Danbooru.config.large_image_width} pixels wide, and original is whatever the original image is", :collection => %w(large original), :include_blank => false %>
|
||||||
|
<%= f.input :enable_post_navigation, :as => :select, :include_blank => false, :hint => "When searching, do you want to navigate from post to post?" %>
|
||||||
|
<%= 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 :favorite_tags, :hint => "A list of whitespace delimited tags that show up in your profile", :input_html => {:size => "40x5"} %>
|
<%= f.input :favorite_tags, :hint => "A list of whitespace delimited tags that show up in your profile", :input_html => {:size => "40x5"} %>
|
||||||
<%= f.input :blacklisted_tags, :hint => "A list of newline delimited tags that you never want to see", :input_html => {:size => "40x5"} %>
|
<%= f.input :blacklisted_tags, :hint => "A list of newline delimited tags that you never want to see", :input_html => {:size => "40x5"} %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
7
db/migrate/20130307225324_add_settings_to_users.rb
Normal file
7
db/migrate/20130307225324_add_settings_to_users.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class AddSettingsToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :enable_post_navigation, :boolean, :null => false, :default => true
|
||||||
|
add_column :users, :new_post_navigation_layout, :boolean, :null => false, :default => true
|
||||||
|
add_column :users, :enable_privacy_mode, :boolean, :null => false, :default => false
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -2597,7 +2597,10 @@ CREATE TABLE users (
|
|||||||
favorite_tags text,
|
favorite_tags text,
|
||||||
blacklisted_tags text,
|
blacklisted_tags text,
|
||||||
time_zone character varying(255) DEFAULT 'Eastern Time (US & Canada)'::character varying NOT NULL,
|
time_zone character varying(255) DEFAULT 'Eastern Time (US & Canada)'::character varying NOT NULL,
|
||||||
bcrypt_password_hash text
|
bcrypt_password_hash text,
|
||||||
|
enable_post_navigation boolean DEFAULT true NOT NULL,
|
||||||
|
new_post_navigation_layout boolean DEFAULT true NOT NULL,
|
||||||
|
enable_privacy_mode boolean DEFAULT false NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -6226,4 +6229,6 @@ INSERT INTO schema_migrations (version) VALUES ('20130221214811');
|
|||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20130302214500');
|
INSERT INTO schema_migrations (version) VALUES ('20130302214500');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20130305005138');
|
INSERT INTO schema_migrations (version) VALUES ('20130305005138');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20130307225324');
|
||||||
Reference in New Issue
Block a user