added upgrade mailer

This commit is contained in:
albert
2011-12-02 16:46:37 -05:00
parent caf39d1962
commit 4baf5be7a2
7 changed files with 28 additions and 4 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)

View File

@@ -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

View 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>

View File

@@ -0,0 +1 @@
<p>Account upgrades are currently disabled.</p>

View File

@@ -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_-]/, "_")