js: replace <meta> tags with <body> data attributes.
Refactor things to store information about the current user as data attributes on the <body> tag rather than as <meta> tags. These <meta> tags are now deprecated and will be eventually removed. * Store all of the current user's API attributes as data attributes on the <body> tag. * Add `CurrentUser.data` for getting data from the <body> tag, and use it instead of `Utility.meta`. * Add `CurrentUser.update` for updating the current user's settings. * Fix a bug with the user named "Anonymous" not being able to edit notes.
This commit is contained in:
@@ -175,7 +175,8 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def body_attributes(user = CurrentUser.user)
|
||||
attributes = [:id, :name, :level, :level_string, :theme, :can_approve_posts?, :can_upload_free?]
|
||||
attributes = user.api_attributes
|
||||
attributes -= [:custom_style, :blacklisted_tags, :favorite_tags]
|
||||
attributes += User::Roles.map { |role| :"is_#{role}?" }
|
||||
|
||||
controller_param = params[:controller].parameterize.dasherize
|
||||
|
||||
Reference in New Issue
Block a user