added upgrade mailer
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
div.paginator {
|
div.paginator {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 2em 0 1em 0;
|
padding: 2em 0 1em 0;
|
||||||
font-size: 1.2em;
|
font-size: 2em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
clear: both;
|
clear: both;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ div#c-users {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#a-new {
|
div#a-new {
|
||||||
max-width: 50em;
|
max-width: 40em;
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
@@ -44,7 +44,7 @@ div#c-users {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#a-upgrade-information {
|
div#a-upgrade-information {
|
||||||
max-width: 55em;
|
max-width: 40em;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
|
|
||||||
form {
|
form {
|
||||||
@@ -63,7 +63,7 @@ div#c-users {
|
|||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
|
||||||
div.column {
|
div.column {
|
||||||
width: 15em;
|
width: 11em;
|
||||||
float: left;
|
float: left;
|
||||||
border: 1px solid #666;
|
border: 1px solid #666;
|
||||||
@include border-radius(4px);
|
@include border-radius(4px);
|
||||||
|
|||||||
@@ -41,6 +41,16 @@ class UsersController < ApplicationController
|
|||||||
@user.update_attributes(params[:user], :as => CurrentUser.role)
|
@user.update_attributes(params[:user], :as => CurrentUser.role)
|
||||||
respond_with(@user)
|
respond_with(@user)
|
||||||
end
|
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
|
private
|
||||||
def check_privilege(user)
|
def check_privilege(user)
|
||||||
|
|||||||
@@ -5,4 +5,12 @@ class UserMailer < ActionMailer::Base
|
|||||||
@dmail = dmail
|
@dmail = dmail
|
||||||
mail(:to => dmail.to.email, :subject => "#{Danbooru.config.app_name} - Message received from #{dmail.from.name}")
|
mail(:to => dmail.to.email, :subject => "#{Danbooru.config.app_name} - Message received from #{dmail.from.name}")
|
||||||
end
|
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
|
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}"
|
"webmaster@#{server_host}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def upgrade_account_email
|
||||||
|
contact_email
|
||||||
|
end
|
||||||
|
|
||||||
# Stripped of any special characters.
|
# Stripped of any special characters.
|
||||||
def safe_app_name
|
def safe_app_name
|
||||||
app_name.gsub(/[^a-zA-Z0-9_-]/, "_")
|
app_name.gsub(/[^a-zA-Z0-9_-]/, "_")
|
||||||
|
|||||||
Reference in New Issue
Block a user