fixes #1817
This commit is contained in:
@@ -201,6 +201,10 @@ class AnonymousUser
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def custom_style
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
%w(member banned gold builder platinum contributor janitor moderator admin).each do |name|
|
%w(member banned gold 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, :enable_sequential_post_navigation, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :as => [:moderator, :janitor, :contributor, :gold, :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, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :custom_style, :as => [:moderator, :janitor, :contributor, :gold, :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"
|
||||||
@@ -515,7 +515,7 @@ class User < ActiveRecord::Base
|
|||||||
|
|
||||||
module ApiMethods
|
module ApiMethods
|
||||||
def hidden_attributes
|
def hidden_attributes
|
||||||
super + [:password_hash, :bcrypt_password_hash, :email, :email_verification_key, :time_zone, :updated_at, :receive_email_notifications, :last_logged_in_at, :last_forum_read_at, :has_mail, :default_image_size, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :recent_tags, :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :enable_sequential_post_navigation, :hide_deleted_posts, :per_page, :style_usernames, :enable_auto_complete]
|
super + [:password_hash, :bcrypt_password_hash, :email, :email_verification_key, :time_zone, :updated_at, :receive_email_notifications, :last_logged_in_at, :last_forum_read_at, :has_mail, :default_image_size, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :recent_tags, :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :enable_sequential_post_navigation, :hide_deleted_posts, :per_page, :style_usernames, :enable_auto_complete, :custom_style]
|
||||||
end
|
end
|
||||||
|
|
||||||
def serializable_hash(options = {})
|
def serializable_hash(options = {})
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
<meta name="enable-auto-complete" content="<%= CurrentUser.user.enable_auto_complete %>">
|
<meta name="enable-auto-complete" content="<%= CurrentUser.user.enable_auto_complete %>">
|
||||||
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
|
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
|
||||||
<%= stylesheet_link_tag "application", :media => "screen" %>
|
<%= stylesheet_link_tag "application", :media => "screen" %>
|
||||||
|
<style>
|
||||||
|
<%= CurrentUser.user.custom_style %>
|
||||||
|
</style>
|
||||||
<%= javascript_include_tag "application" %>
|
<%= javascript_include_tag "application" %>
|
||||||
<%= raw Danbooru.config.custom_html_header_content %>
|
<%= raw Danbooru.config.custom_html_header_content %>
|
||||||
<%= yield :html_header %>
|
<%= yield :html_header %>
|
||||||
|
|||||||
@@ -53,7 +53,8 @@
|
|||||||
<label class="text optional" for="user_favorite_tags">Frequent tags</label>
|
<label class="text optional" for="user_favorite_tags">Frequent tags</label>
|
||||||
<textarea id="user_favorite_tags" class="text optional" rows="5" name="user[favorite_tags]" cols="40"><%= raw @user.favorite_tags %></textarea>
|
<textarea id="user_favorite_tags" class="text optional" rows="5" name="user[favorite_tags]" cols="40"><%= raw @user.favorite_tags %></textarea>
|
||||||
<span class="hint">A list of tags that you use often. They will appear when using the list of Related Tags.</span>
|
<span class="hint">A list of tags that you use often. They will appear when using the list of Related Tags.</span>
|
||||||
</div>
|
</div>
|
||||||
|
<%= f.input :custom_style, :label => "Custom <a href='http://en.wikipedia.org/wiki/Cascading_Style_Sheets'>CSS</a> style" %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="change-password-section">
|
<fieldset id="change-password-section">
|
||||||
|
|||||||
5
db/migrate/20130712162600_add_custom_style_to_users.rb
Normal file
5
db/migrate/20130712162600_add_custom_style_to_users.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddCustomStyleToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :custom_style, :text
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user