diff --git a/app/logical/anonymous_user.rb b/app/logical/anonymous_user.rb index a9bb053a4..08df5cefb 100644 --- a/app/logical/anonymous_user.rb +++ b/app/logical/anonymous_user.rb @@ -201,6 +201,10 @@ class AnonymousUser true end + def custom_style + nil + end + %w(member banned gold builder platinum contributor janitor moderator admin).each do |name| define_method("is_#{name}?") do false diff --git a/app/models/user.rb b/app/models/user.rb index d9b5bb3af..b721217bc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -17,7 +17,7 @@ class User < ActiveRecord::Base end 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 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" @@ -515,7 +515,7 @@ class User < ActiveRecord::Base module ApiMethods 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 def serializable_hash(options = {}) diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 8e2225f14..eef5387eb 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -19,6 +19,9 @@ <%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %> <%= stylesheet_link_tag "application", :media => "screen" %> + <%= javascript_include_tag "application" %> <%= raw Danbooru.config.custom_html_header_content %> <%= yield :html_header %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 6728f4d40..7c709c3fd 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -53,7 +53,8 @@ A list of tags that you use often. They will appear when using the list of Related Tags. - + + <%= f.input :custom_style, :label => "Custom CSS style" %>
diff --git a/db/migrate/20130712162600_add_custom_style_to_users.rb b/db/migrate/20130712162600_add_custom_style_to_users.rb new file mode 100644 index 000000000..4b4ebba22 --- /dev/null +++ b/db/migrate/20130712162600_add_custom_style_to_users.rb @@ -0,0 +1,5 @@ +class AddCustomStyleToUsers < ActiveRecord::Migration + def change + add_column :users, :custom_style, :text + end +end