diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 88c01aeea..f7f15a4c6 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -38,6 +38,9 @@ } Danbooru.Post.initialize_gestures = function() { + if (Danbooru.meta("disable-mobile-gestures") === "true") { + return; + } var $body = $("body"); if ($body.data("hammer")) { return; diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index 0f9ef07ea..53ffb6c6d 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -261,6 +261,10 @@ class AnonymousUser false end + def disable_mobile_gestures? + false + end + User::Roles.reject {|r| r == :anonymous}.each do |name| define_method("is_#{name}?") do false diff --git a/app/models/user.rb b/app/models/user.rb index b3c1e75fa..79cf47fc2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -25,6 +25,15 @@ class User < ApplicationRecord :verified, ] + # candidates for removal: + # - enable_post_navigation (disabled by 700) + # - new_post_navigation_layout (disabled by 1364) + # - enable_sequential_post_navigation (disabled by 680) + # - hide_deleted_posts (enabled by 1904) + # - disable_categorized_saved_searches (enabled by 2291) + # - disable_tagged_filenames (enabled by 387) + # - enable_recent_searches (enabled by 499) + # - disable_cropped_thumbnails (enabled by 22) BOOLEAN_ATTRIBUTES = %w( is_banned has_mail @@ -46,13 +55,14 @@ class User < ApplicationRecord disable_tagged_filenames enable_recent_searches disable_cropped_thumbnails + disable_mobile_gestures ) include Danbooru::HasBitFlags has_bit_flags BOOLEAN_ATTRIBUTES, :field => "bit_prefs" attr_accessor :password, :old_password - attr_accessible :dmail_filter_attributes, :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, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :custom_style, :show_deleted_children, :disable_categorized_saved_searches, :disable_tagged_filenames, :enable_recent_searches, :disable_cropped_thumbnails, :as => [:moderator, :gold, :platinum, :member, :anonymous, :default, :builder, :admin] + attr_accessible :dmail_filter_attributes, :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, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :custom_style, :show_deleted_children, :disable_categorized_saved_searches, :disable_tagged_filenames, :enable_recent_searches, :disable_cropped_thumbnails, :disable_mobile_gestures, :as => [:moderator, :gold, :platinum, :member, :anonymous, :default, :builder, :admin] attr_accessible :level, :as => :admin validates :name, user_name: true, on: :create diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index cbd96de60..ca1e07620 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -26,6 +26,7 @@ + <%= content_tag(:meta, nil, name: "disable-mobile-gestures", content: CurrentUser.disable_mobile_gestures?) %> <%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %> <%= stylesheet_link_tag "application", :media => "screen" %> <% if CurrentUser.user.custom_style.present? %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 328339cad..85d538812 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -4,8 +4,8 @@ <%= simple_form_for @user do |f| %>

- <%= link_to "Basic settings", "#basic-settings", :class => "active" %> - | <%= link_to "Advanced settings", "#advanced-settings" %> + <%= link_to "Basic", "#basic-settings", :class => "active" %> + | <%= link_to "Advanced", "#advanced-settings" %> <% if CurrentUser.user.id == @user.id %> | <%= link_to "Change password", edit_user_password_path(:user_id => @user.id), :id => "change-password" %> | <%= link_to "Delete account", maintenance_user_deletion_path, :id => "delete-account" %> @@ -74,6 +74,8 @@ <%= f.input :disable_tagged_filenames, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %> + <%= f.input :disable_mobile_gestures, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %> + <%#= f.input :disable_cropped_thumbnails, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>