added upgrade mailer
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
div.paginator {
|
||||
display: block;
|
||||
padding: 2em 0 1em 0;
|
||||
font-size: 1.2em;
|
||||
font-size: 2em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
clear: both;
|
||||
|
||||
@@ -17,7 +17,7 @@ div#c-users {
|
||||
}
|
||||
|
||||
div#a-new {
|
||||
max-width: 50em;
|
||||
max-width: 40em;
|
||||
|
||||
p {
|
||||
font-size: 1.2em;
|
||||
@@ -44,7 +44,7 @@ div#c-users {
|
||||
}
|
||||
|
||||
div#a-upgrade-information {
|
||||
max-width: 55em;
|
||||
max-width: 40em;
|
||||
font-size: 1.2em;
|
||||
|
||||
form {
|
||||
@@ -63,7 +63,7 @@ div#c-users {
|
||||
margin-bottom: 1em;
|
||||
|
||||
div.column {
|
||||
width: 15em;
|
||||
width: 11em;
|
||||
float: left;
|
||||
border: 1px solid #666;
|
||||
@include border-radius(4px);
|
||||
|
||||
@@ -41,6 +41,16 @@ class UsersController < ApplicationController
|
||||
@user.update_attributes(params[:user], :as => CurrentUser.role)
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
def upgrade
|
||||
@user = User.find(params[:id])
|
||||
|
||||
if params[:email] =~ /paypal/
|
||||
UserMailer.upgrade_fail(params[:email]).deliver
|
||||
else
|
||||
UserMailer.upgrade(@user, params[:email]).deliver
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(user)
|
||||
|
||||
@@ -5,4 +5,12 @@ class UserMailer < ActionMailer::Base
|
||||
@dmail = dmail
|
||||
mail(:to => dmail.to.email, :subject => "#{Danbooru.config.app_name} - Message received from #{dmail.from.name}")
|
||||
end
|
||||
|
||||
def upgrade(user, email)
|
||||
mail(:to => email, :subject => "#{Danbooru.config.app_name} account upgrade")
|
||||
end
|
||||
|
||||
def upgrade_fail(email)
|
||||
mail(:to => email, :subject => "#{Danbooru.config.app_name} account upgrade")
|
||||
end
|
||||
end
|
||||
1
app/views/user_mailer/upgrade.html.erb
Normal file
1
app/views/user_mailer/upgrade.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<p>You can upgrade your account by sending $10 USD via Paypal to <%= mail_to Danbooru.config.upgrade_account_email %>. Be sure to include your username.</p>
|
||||
1
app/views/user_mailer/upgrade_fail.html.erb
Normal file
1
app/views/user_mailer/upgrade_fail.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<p>Account upgrades are currently disabled.</p>
|
||||
@@ -22,6 +22,10 @@ module Danbooru
|
||||
"webmaster@#{server_host}"
|
||||
end
|
||||
|
||||
def upgrade_account_email
|
||||
contact_email
|
||||
end
|
||||
|
||||
# Stripped of any special characters.
|
||||
def safe_app_name
|
||||
app_name.gsub(/[^a-zA-Z0-9_-]/, "_")
|
||||
|
||||
Reference in New Issue
Block a user