add HTML5 support

This commit is contained in:
Josh
2017-09-28 16:03:47 -04:00
parent 40ee86a6a4
commit da07eb749f
8 changed files with 76 additions and 13 deletions

View File

@ -19,13 +19,19 @@ class UsersController < ActionController::Base
# For updating a users background image.
def update
# Make sure they actually select a file.
if params[:user] then
if params[:commit] == t('upload')
# Make sure they actually select a file.
if params[:user] then
@user = User.find(params[:id])
@user.assign_attributes(background: user_params[:background])
flash[:danger] = t('invalid_file') unless @user.save
else
flash[:danger] = t('no_file')
end
elsif params[:commit] == t('switch_clients')
# Switch the users default client.
@user = User.find(params[:id])
@user.assign_attributes(background: user_params[:background])
flash[:danger] = t('invalid_file') unless @user.save
else
flash[:danger] = t('no_file')
@user.update_attributes(use_html5: !@user.use_html5)
end
# Reload the page to apply changes and show flash messages.